orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 92 forks source link

NameError in preinstaller.rb #178

Closed AndyIsaacson closed 6 years ago

AndyIsaacson commented 6 years ago

I was running pod install on a new setup in CircelCI 2.0 when I got this error:

NameError - uninitialized constant CocoaPodsKeys::PreInstaller::Informative
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-keys-2.0.0/lib/preinstaller.rb:46:in `block in setup'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-keys-2.0.0/lib/preinstaller.rb:43:in `each'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-keys-2.0.0/lib/preinstaller.rb:43:in `setup'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-keys-2.0.0/lib/plugin.rb:17:in `setup'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-keys-2.0.0/lib/plugin.rb:11:in `block in singleton class'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/hooks_manager.rb:109:in `block (3 levels) in run'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/hooks_manager.rb:103:in `block (2 levels) in run'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/hooks_manager.rb:101:in `each'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/hooks_manager.rb:101:in `block in run'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/hooks_manager.rb:100:in `run'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:414:in `run_plugins_pre_install_hooks'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:139:in `block in prepare'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/user_interface.rb:142:in `message'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:135:in `prepare'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/installer.rb:115:in `install!'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/command/install.rb:41:in `run'
/Users/distiller/.gem/ruby/2.4.2/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/lib/cocoapods/command.rb:52:in `run'
/Users/distiller/.gem/ruby/2.4.2/gems/cocoapods-1.3.1/bin/pod:55:in `<top (required)>'
/Users/distiller/.gem/ruby/2.4.2/bin/pod:23:in `load'
/Users/distiller/.gem/ruby/2.4.2/bin/pod:23:in `<top (required)>'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:75:in `load'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:75:in `kernel_load'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:28:in `run'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/cli.rb:424:in `exec'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/cli.rb:27:in `dispatch'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/cli.rb:18:in `start'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/exe/bundle:30:in `block in <top (required)>'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
/Users/distiller/.gem/ruby/2.4.2/gems/bundler-1.16.0/exe/bundle:22:in `<top (required)>'
/Users/distiller/.gem/ruby/2.4.2/bin/bundle:23:in `load'
/Users/distiller/.gem/ruby/2.4.2/bin/bundle:23:in `<main>'

The relevant bit of code is:

if ci?
   raise Pod::Informative, "CocoaPods-Keys could not find a key named: #{key}"
end

It looks like there was a NameError trying to instantiate that Informative error, but alas, my ruby fu isn't quite good enough to understand why. The end result is that the error output is completely useless to someone debugging their issue with their keys.

Sure enough, if I ssh'ed into that same Circle instance, but unset the env vars that indicated it was a CI environment, I got the interactive error message about a missing key:

CocoaPods-Keys has detected a keys mismatch for your setup.
 What is the key for FooKey

Other possibly useful info:

   CocoaPods : 1.3.1
        Ruby : ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
    RubyGems : 2.6.13
        Host : Mac OS X 10.12.6 (16G29)
       Xcode : 9.2 (9C40b)
         Git : git version 2.14.3 (Apple Git-98)
Ruby lib dir : /Users/distiller/.rubies/ruby-2.4.2/lib
Repositories : master - https://github.com/cocoapods/specs.git @ 06f1a9a7ec3a23ffb13527ab7aa3b1103d321071

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-keys        : 2.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.2.0
cocoapods-try         : 1.1.0
AndyIsaacson commented 6 years ago

Actually, looks like this might have been fixed in https://github.com/orta/cocoapods-keys/issues/163 . I don't think I have 2.0.1 running on there. Will try with that.

AndyIsaacson commented 6 years ago

Yup! Nevermind :-)