orta/cocoapods-keys

NilClass Error

jianpx opened this issue · 4 comments

first time I run pod install --no-repo-update, then ask me to input the key value , I input "a b c" string , then it throws error below:

### Error


NoMethodError - undefined method `*' for nil:NilClass
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/key_master.rb:32:in `generate_data'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/key_master.rb:20:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/plugin.rb:34:in `new'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/plugin.rb:34:in `setup'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/plugin.rb:98:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.2/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.2/lib/cocoapods/command/project.rb:101:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.2/lib/cocoapods/command.rb:48:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.2/bin/pod:44:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
orta commented

I wonder if keys doesn't support spaces. I've never seen an API key with spaces in it. You're welcome to add support for this, or an error message when a user puts this in.

So I have the same problem with the Artsy ones. I've entered all the keys (no spaces) and I get this:

Command

/usr/local/bin/pod install

Report

  • What did you do?

pod install, entered all the keys, and then the error occurs straight after entering the last key.

  • What did you expect to happen?

That it wouldn't error..? :D

  • What happened instead?

This beautiful markdown template came up. The keys are properly set in the keychain though, so I'm unsure what else should have happened after? (apart from installing the other pods). When I run pod install again it does install the others and says it's using keys.

screen shot 2016-02-09 at 11 37 43

Stack

   CocoaPods : 0.39.0
        Ruby : ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]
    RubyGems : 2.0.14
        Host : Mac OS X 10.11.2 (15C50)
       Xcode : 7.2 (7C68)
         Git : git version 2.5.4 (Apple Git-61)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : artsy - https://github.com/artsy/Specs.git @ ef8ffbf6d794b7853a662bdc067036382380d45b
               master - https://github.com/CocoaPods/Specs.git @ aa4f8e9db0e840100187c562bd02e01b585ca6f5

Plugins

cocoapods-deintegrate : 0.2.1
cocoapods-keys        : 1.6.0
cocoapods-open        : 0.0.8
cocoapods-plugins     : 0.4.2
cocoapods-search      : 0.1.0
cocoapods-stats       : 0.6.2
cocoapods-trunk       : 0.6.4
cocoapods-try         : 0.5.1

Podfile

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/artsy/Specs.git'

platform :ios, '8.0'

# Yep.
inhibit_all_warnings!

plugin 'cocoapods-keys', {
    :project => "Folio",
    :target => "ArtsyFolio",
    :keys => [
    "ArtsyAPIClientSecret",
    "ArtsyAPIClientKey",
    "HockeyAppBetaID",
    "HockeyAppLiveID",
    "IntercomAppID",
    "IntercomAPIKey",
    "SegmentProduction",
    "SegmentBeta",
    "SegmentDev"
]}

target 'ArtsyFolio' do
    # Artsy
    pod 'Artsy+UILabels'
    pod 'Artsy+UIColors'
    pod 'UIView+BooleanAnimations'
    pod 'ORStackView'
    pod "Artsy+Authentication", :subspecs => ["email"]

    if ENV['ARTSY_STAFF_MEMBER'] || ENV['CI'] == 'true'
        pod 'Artsy+UIFonts', :git => "https://github.com/artsy/Artsy-UIFonts.git", :branch => "old_fonts_new_lib"
    else
      pod 'Artsy+OSSUIFonts'
    end


    # Nicities
    pod 'ObjectiveSugar', :git => 'https://github.com/supermarin/ObjectiveSugar.git'
    pod 'KVOController'

    # Networking
    pod 'Reachability', '~> 3.0'
    pod 'AFNetworking', :git => "https://github.com/orta/AFNetworking", :branch => "no_ifdefs"
    pod 'ISO8601DateFormatter', '~> 0.7'

    # Misc
    pod 'DRBOperationTree', '0.0.1'
    pod 'SFHFKeychainUtils', '~> 0.0.1'
    pod 'ZipArchive'
    pod 'WYPopoverController', :git => 'https://github.com/orta/WYPopoverController.git', :branch => 'artsy'
    pod 'JLRoutes'

    # Templating
    pod 'GHMarkdownParser'
    pod 'GRMustache', '~> 7.0'

    # Analytics
    pod 'ARAnalytics', :subspecs => ['Segmentio', 'HockeyApp'], :git => 'https://github.com/orta/ARAnalytics.git'
    pod 'Intercom'

    # Logging
    pod 'CocoaLumberjack', '~> 1.0'
    pod 'SSDataSources'

    # @weakify / @strongify / @keypath
    pod 'libextobjc/EXTKeyPathCoding', '~> 0.3'
    pod 'libextobjc/EXTScope', '~> 0.3'

    pod 'TPKeyboardAvoiding', :git => 'https://github.com/michaeltyson/TPKeyboardAvoiding.git'
    pod 'ARTiledImageView', :git => 'https://github.com/dblock/ARTiledImageView.git'
    pod 'ARCollectionViewMasonryLayout'
    pod 'FLKAutoLayout', '0.1.1'

    # This is not an Artsy project
    pod 'ARGenericTableViewController', :git => 'https://github.com/orta/ARGenericTableViewController.git'
end

target 'ArtsyFolio Tests' do
    pod 'Specta'
    pod 'Expecta'
    pod 'OHHTTPStubs', '~> 3.0'

    pod 'Expecta+Snapshots', "2.0.0"
    pod 'Expecta+ContainerClasses', '~> 1.0'
    pod 'Expecta+Comparison', '~> 0.1'

    pod 'XCTest+OHHTTPStubSuiteCleanUp'
    pod 'OCMock'
    pod 'Forgeries/Mocks', :git => "https://github.com/ashfurrow/Forgeries.git", :branch => "remove"
end

post_install do |installer|
  # Disable bitcode for now. Specifically needed for HockeySDK and ARAnalytics.
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

Error

NoMethodError - undefined method `*' for nil:NilClass
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/key_master.rb:32:in `generate_data'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/key_master.rb:20:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/plugin.rb:34:in `new'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/plugin.rb:34:in `setup'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-keys-1.6.0/lib/plugin.rb:98:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Can confirm that this seems to be a "happens first time"bug. After coming across the same error message and running pod update, the error message did not crop up again.

netbe commented

Same here, fails the first time but not afterwards. No spaces in keys