cocoapods-keys 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/cocoapods_keys.rb +1 -1
- data/lib/key_master.rb +3 -2
- data/lib/keyring.rb +5 -1
- data/lib/name_whisperer.rb +4 -4
- data/lib/plugin.rb +10 -4
- data/lib/pod/command/keys.rb +2 -0
- data/lib/preinstaller.rb +6 -3
- data/spec/keyring_spec.rb +19 -0
- metadata +4 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c5cc6251eb10bbe87ceee4a1f3643dfe4b7506da
         | 
| 4 | 
            +
              data.tar.gz: c243d7584efda5c4c4693c090ba4b50bd7228857
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 252122f84b76036ad1ad0ec68ae54673f8e76d3c2b02d7305b0a63ffcb4729ade9f8f6736441f8b29635975d82941291b0215f86430ddd47ce6173ffc190a139
         | 
| 7 | 
            +
              data.tar.gz: e46843504016015797d39a682b6a23fb53ccbb1b2e330f07bd0481b9b2e86e833e7ac61752d9b0845e451f81acd027a7f3c12c7f1ee40741e5e36cc49cdddefb
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/cocoapods_keys.rb
    CHANGED
    
    
    
        data/lib/key_master.rb
    CHANGED
    
    | @@ -9,8 +9,9 @@ module CocoaPodsKeys | |
| 9 9 |  | 
| 10 10 | 
             
                def initialize(keyring, time = Time.now)
         | 
| 11 11 | 
             
                  @time = time
         | 
| 12 | 
            -
                  @keys =  | 
| 13 | 
            -
                  @name = keyring.code_name + 'Keys'
         | 
| 12 | 
            +
                  @keys = keyring.camel_cased_keys
         | 
| 13 | 
            +
                  @name = keyring.code_name.capitalize + 'Keys'
         | 
| 14 | 
            +
             | 
| 14 15 | 
             
                  @used_indexes = Set.new
         | 
| 15 16 | 
             
                  @indexed_keys = {}
         | 
| 16 17 | 
             
                  @data = generate_data
         | 
    
        data/lib/keyring.rb
    CHANGED
    
    | @@ -34,8 +34,12 @@ module CocoaPodsKeys | |
| 34 34 | 
             
                def keychain_data
         | 
| 35 35 | 
             
                  keychain = OSXKeychain.new
         | 
| 36 36 | 
             
                  Hash[
         | 
| 37 | 
            -
                    @keys.map { |key| [key, keychain[self.class.keychain_prefix + name, key]] }
         | 
| 37 | 
            +
                    @keys.map { |key| [key, ENV[key] || keychain[self.class.keychain_prefix + name, key]] }
         | 
| 38 38 | 
             
                  ]
         | 
| 39 39 | 
             
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                def camel_cased_keys
         | 
| 42 | 
            +
                  Hash[keychain_data.map { |(key, value)| [key[0].downcase + key[1..-1], value] }]
         | 
| 43 | 
            +
                end
         | 
| 40 44 | 
             
              end
         | 
| 41 45 | 
             
            end
         | 
    
        data/lib/name_whisperer.rb
    CHANGED
    
    | @@ -7,15 +7,15 @@ module CocoaPodsKeys | |
| 7 7 | 
             
                  if podfile
         | 
| 8 8 | 
             
                    user_xcodeproj = xcodeproj_from_podfile(podfile)
         | 
| 9 9 | 
             
                  end
         | 
| 10 | 
            -
                  user_xcodeproj  | 
| 11 | 
            -
                  user_xcodeproj.basename('.xcodeproj')
         | 
| 10 | 
            +
                  user_xcodeproj || search_folders_for_xcodeproj
         | 
| 12 11 | 
             
                end
         | 
| 13 12 |  | 
| 14 13 | 
             
                private
         | 
| 15 14 |  | 
| 16 15 | 
             
                def self.xcodeproj_from_podfile(podfile)
         | 
| 17 16 | 
             
                  unless podfile.target_definition_list.empty?
         | 
| 18 | 
            -
                     | 
| 17 | 
            +
                    project_path = podfile.target_definition_list.first.user_project_path
         | 
| 18 | 
            +
                    File.basename(project_path, '.xcodeproj') if project_path
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| @@ -23,7 +23,7 @@ module CocoaPodsKeys | |
| 23 23 | 
             
                  ui = Pod::UserInterface
         | 
| 24 24 | 
             
                  xcodeprojects = Pathname.glob('**/*.xcodeproj')
         | 
| 25 25 | 
             
                  if xcodeprojects.length == 1
         | 
| 26 | 
            -
                    Pathname(xcodeprojects.first).basename
         | 
| 26 | 
            +
                    Pathname(xcodeprojects.first).basename('.xcodeproj')
         | 
| 27 27 | 
             
                  else
         | 
| 28 28 | 
             
                    error_message = (xcodeprojects.length > 1) ? 'found too many' : "couldn't find any"
         | 
| 29 29 | 
             
                    ui.puts 'CocoaPods-Keys ' + error_message + ' Xcode projects. Please give a name for this project.'
         | 
    
        data/lib/plugin.rb
    CHANGED
    
    | @@ -9,10 +9,12 @@ module CocoaPodsKeys | |
| 9 9 | 
             
                def setup
         | 
| 10 10 | 
             
                  require 'preinstaller'
         | 
| 11 11 |  | 
| 12 | 
            -
                  PreInstaller.new(user_options).setup
         | 
| 12 | 
            +
                  unless PreInstaller.new(user_options).setup
         | 
| 13 | 
            +
                    raise Pod::Informative, 'Could not load key data'
         | 
| 14 | 
            +
                  end
         | 
| 13 15 |  | 
| 14 16 | 
             
                  installation_root = Pod::Config.instance.installation_root
         | 
| 15 | 
            -
                  keys_path = installation_root.+('Pods/CocoaPodsKeys/') | 
| 17 | 
            +
                  keys_path = installation_root.+('Pods/CocoaPodsKeys/')
         | 
| 16 18 |  | 
| 17 19 | 
             
                  # move our podspec in to the Pods
         | 
| 18 20 | 
             
                  mkdir_p keys_path
         | 
| @@ -22,7 +24,11 @@ module CocoaPodsKeys | |
| 22 24 | 
             
                  # Get all the keys
         | 
| 23 25 | 
             
                  local_user_options = user_options || {}
         | 
| 24 26 | 
             
                  project = local_user_options.fetch('project') { CocoaPodsKeys::NameWhisperer.get_project_name }
         | 
| 25 | 
            -
             | 
| 27 | 
            +
             | 
| 28 | 
            +
                  keyring = KeyringLiberator.get_keyring_named(project) ||
         | 
| 29 | 
            +
                    KeyringLiberator.get_keyring(Dir.getwd) ||
         | 
| 30 | 
            +
                    Keyring.new(project, Dir.getwd, local_user_options['keys'])
         | 
| 31 | 
            +
             | 
| 26 32 | 
             
                  raise Pod::Informative, 'Could not load keyring' unless keyring
         | 
| 27 33 |  | 
| 28 34 | 
             
                  # Create the h & m files in the same folder as the podspec
         | 
| @@ -34,7 +40,7 @@ module CocoaPodsKeys | |
| 34 40 | 
             
                  File.write(implementation_file, key_master.implementation)
         | 
| 35 41 |  | 
| 36 42 | 
             
                  # Add our template podspec
         | 
| 37 | 
            -
                  add_keys_to_pods(keys_path, user_options)
         | 
| 43 | 
            +
                  add_keys_to_pods(keys_path.relative_path_from(installation_root), user_options)
         | 
| 38 44 | 
             
                end
         | 
| 39 45 |  | 
| 40 46 | 
             
                def add_keys_to_pods(keys_path, options)
         | 
    
        data/lib/pod/command/keys.rb
    CHANGED
    
    
    
        data/lib/preinstaller.rb
    CHANGED
    
    | @@ -4,6 +4,8 @@ module CocoaPodsKeys | |
| 4 4 | 
             
                  @user_options = user_options
         | 
| 5 5 | 
             
                end
         | 
| 6 6 |  | 
| 7 | 
            +
                # Returns `true` if all keys specified by the user are satisfied by either an existing keyring or environment
         | 
| 8 | 
            +
                # variables.
         | 
| 7 9 | 
             
                def setup
         | 
| 8 10 | 
             
                  require 'key_master'
         | 
| 9 11 | 
             
                  require 'keyring_liberator'
         | 
| @@ -17,14 +19,14 @@ module CocoaPodsKeys | |
| 17 19 | 
             
                  project = options.fetch('project') { CocoaPodsKeys::NameWhisperer.get_project_name }
         | 
| 18 20 | 
             
                  keyring = KeyringLiberator.get_keyring_named(project) || KeyringLiberator.get_keyring(current_dir)
         | 
| 19 21 |  | 
| 22 | 
            +
                  existing_keyring = !keyring.nil?
         | 
| 20 23 | 
             
                  keyring = CocoaPodsKeys::Keyring.new(project, current_dir, []) unless keyring
         | 
| 21 24 |  | 
| 22 25 | 
             
                  data = keyring.keychain_data
         | 
| 23 26 | 
             
                  has_shown_intro = false
         | 
| 24 27 | 
             
                  keys = options.fetch('keys', [])
         | 
| 25 28 | 
             
                  keys.each do |key|
         | 
| 26 | 
            -
                    unless data.keys.include? | 
| 27 | 
            -
             | 
| 29 | 
            +
                    unless ENV[key] || data.keys.include?(key)
         | 
| 28 30 | 
             
                      unless has_shown_intro
         | 
| 29 31 | 
             
                        ui.puts "\n CocoaPods-Keys has detected a keys mismatch for your setup."
         | 
| 30 32 | 
             
                        has_shown_intro = true
         | 
| @@ -42,9 +44,10 @@ module CocoaPodsKeys | |
| 42 44 | 
             
                      args = CLAide::ARGV.new([key, answer, keyring.name])
         | 
| 43 45 | 
             
                      setter = Pod::Command::Keys::Set.new(args)
         | 
| 44 46 | 
             
                      setter.run
         | 
| 45 | 
            -
             | 
| 46 47 | 
             
                    end
         | 
| 47 48 | 
             
                  end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  existing_keyring || !keys.empty?
         | 
| 48 51 | 
             
                end
         | 
| 49 52 | 
             
              end
         | 
| 50 53 | 
             
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'keyring'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            include CocoaPodsKeys
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            describe KeyringLiberator do
         | 
| 7 | 
            +
              before(:each) do
         | 
| 8 | 
            +
                ENV['ARMyKey'] = 'Hello'
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              after(:each) do
         | 
| 12 | 
            +
                ENV['ARMyKey'] = nil
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              it 'can get keys from ENV' do
         | 
| 16 | 
            +
                keyring = Keyring.new('test', '/', ['ARMyKey'])
         | 
| 17 | 
            +
                expect(keyring.keychain_data).to eq('ARMyKey' => 'Hello')
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cocoapods-keys
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Orta Therox
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2015- | 
| 12 | 
            +
            date: 2015-07-01 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: osx_keychain
         | 
| @@ -122,6 +122,7 @@ files: | |
| 122 122 | 
             
            - spec/functional_spec.rb
         | 
| 123 123 | 
             
            - spec/key_master_spec.rb
         | 
| 124 124 | 
             
            - spec/keyring_liberator_spec.rb
         | 
| 125 | 
            +
            - spec/keyring_spec.rb
         | 
| 125 126 | 
             
            - spec/plugin_spec.rb
         | 
| 126 127 | 
             
            - spec/spec_helper.rb
         | 
| 127 128 | 
             
            - templates/Keys.h.erb
         | 
| @@ -161,5 +162,6 @@ test_files: | |
| 161 162 | 
             
            - spec/functional_spec.rb
         | 
| 162 163 | 
             
            - spec/key_master_spec.rb
         | 
| 163 164 | 
             
            - spec/keyring_liberator_spec.rb
         | 
| 165 | 
            +
            - spec/keyring_spec.rb
         | 
| 164 166 | 
             
            - spec/plugin_spec.rb
         | 
| 165 167 | 
             
            - spec/spec_helper.rb
         |