liftoffcli / liftoff

CLI for creating and configuring new Xcode projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`get_binding': undefined local variable or method `use_cocoapods' for #<Liftoff::ProjectConfiguration:0x007f8a5c11fbf0> (NameError)

shaotianchi opened this issue · comments

I install the v1.2 and I use the default liftoffrc at https://github.com/thoughtbot/liftoff/blob/master/defaults/liftoffrc

this error appear after Generating the 'swift' project template

(erb):7:in `get_binding': undefined local variable or method `use_cocoapods' for #<Liftoff::ProjectConfiguration:0x007f8a5c11fbf0> (NameError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/erb.rb:849:in `eval'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/erb.rb:849:in `result'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/string_renderer.rb:8:in `render'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:74:in `render_template'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:66:in `move_template'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:48:in `block in copy_template_directory'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/find.rb:43:in `block in find'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/find.rb:42:in `catch'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/find.rb:42:in `find'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:46:in `copy_template_directory'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:15:in `generate'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/settings_generator.rb:32:in `move_settings_bundle'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/settings_generator.rb:9:in `generate'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/launchpad.rb:67:in `generate_settings'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/launchpad.rb:18:in `block in liftoff'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:5:in `chdir'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/file_manager.rb:5:in `create_project_dir'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/launchpad.rb:14:in `liftoff'
from /usr/local/Cellar/liftoff/1.6.0/rubylib/liftoff/cli.rb:10:in `run'
from /usr/local/bin/liftoff:14:in `<main>'

I'm unable to reproduce this issue locally. Can you provide a little more information for me?

  • What's the output of liftoff --version?
  • Can you paste your liftoffrc?
  • How did you install liftoff?

Version: 1.6.0 sorry I said 1.2 upside

############################################################################
# The following keys can be used to configure defaults for project creation
# project_name:
# company:
# author:
# prefix:
# company_identifier:
############################################################################

test_target_name: UnitTests
configure_git: true
warnings_as_errors: true
enable_static_analyzer: true
indentation_level: 4
use_tabs: false
dependency_managers: cocoapods
enable_settings: true
strict_prompts: false
deployment_target: 8.0

run_script_phases:
  - file: todo.sh
    name: Warn for TODO and FIXME comments
  - file: bundle_version.sh
    name: Set version number

templates:
  - travis.yml: .travis.yml
  - Gemfile.rb: Gemfile
  - test.sh: bin/test
  - setup.sh: bin/setup
  - README.md: README.md

warnings:
  - GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED
  - GCC_WARN_MISSING_PARENTHESES
  - GCC_WARN_ABOUT_RETURN_TYPE
  - GCC_WARN_SIGN_COMPARE
  - GCC_WARN_CHECK_SWITCH_STATEMENTS
  - GCC_WARN_UNUSED_FUNCTION
  - GCC_WARN_UNUSED_LABEL
  - GCC_WARN_UNUSED_VALUE
  - GCC_WARN_UNUSED_VARIABLE
  - GCC_WARN_SHADOW
  - GCC_WARN_64_TO_32_BIT_CONVERSION
  - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS
  - GCC_WARN_ABOUT_MISSING_NEWLINE
  - GCC_WARN_UNDECLARED_SELECTOR
  - GCC_WARN_TYPECHECK_CALLS_TO_PRINTF
  - GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS
  - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
  - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF
  - CLANG_WARN_IMPLICIT_SIGN_CONVERSION
  - CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
  - CLANG_WARN_EMPTY_BODY
  - CLANG_WARN_ENUM_CONVERSION
  - CLANG_WARN_INT_CONVERSION
  - CLANG_WARN_CONSTANT_CONVERSION

xcode_command: open -a 'Xcode' .

project_template: swift

app_target_templates:
  objc:
    - <%= project_name %>:
      - Categories:
      - Protocols:
      - Headers:
      - Models:
      - ViewModels:
      - Controllers:
        - <%= prefix %>AppDelegate.h
        - <%= prefix %>AppDelegate.m
      - Views:
      - Resources:
        - Images.xcassets
        - Storyboards:
          - Main.storyboard
        - Nibs:
          - LaunchScreen.xib
        - Other-Sources:
          - Info.plist
          - <%= project_name %>-Prefix.pch
          - main.m
  swift:
    - <%= project_name %>:
      - Extensions:
      - Protocols:
      - Models:
      - ViewModels:
      - Controllers:
        - AppDelegate.swift
      - Views:
      - Resources:
        - Images.xcassets
        - Storyboards:
          - Main.storyboard
        - Nibs:
          - LaunchScreen.xib
        - Other-Sources:
          - Info.plist

test_target_templates:
  objc:
    - <%= test_target_name %>:
      - Resources:
        - <%= test_target_name %>-Info.plist
        - <%= test_target_name %>-Prefix.pch
      - Helpers:
      - Tests:
  swift:
    - <%= test_target_name %>:
      - Resources:
        - <%= test_target_name %>-Info.plist
      - Helpers:
      - Tests:

this is my liftoffrc

i use

brew tap thoughtbot/formulae
brew install liftoff

to install

I find where is wrong.
In ord version's Setting.bundle it use use_cocoapods in Root.plist
I change that the error is gone

I'm glad you were able to track this down. Were you using custom templates? Our template on master doesn't use the use_cocoapods method anymore. code here

If you aren't overriding anything, you shouldn't need a liftoffrc. You also don't need to override the default templates unless you want to change something. Sounds like you're just copying the defaults into your own setup.

Since you were able to resolve this and it doesn't seem like a problem within liftoff, I'm going to close for now.