Skip to content

Commit

Permalink
Address feedback from Pre-Install PR
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Apr 4, 2016
1 parent 4d3cbe7 commit 29c0193
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 105 deletions.
5 changes: 0 additions & 5 deletions .rubocop_cocoapods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ SingleLineBlockParams:
Encoding:
Enabled: false

# Having these make it easier to *not* forget to add one when adding a new
# value and you can simply copy the previous line.
TrailingComma:
EnforcedStyleForMultiline: comma

Style/MultilineOperationIndentation:
EnforcedStyle: indented

Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Master

## 1.6.0
## 1.6.1

* Uses CocoaPods 0.37's pre-install plugins hooks, fixes issues with migrations to 1.0
* Uses CocoaPods 0.37's pre-install plugins hooks, this fixes issues with migrations to 1.0 [orta]

## 1.6.0

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in cocoapods-keys.gemspec
gemspec

gem 'cocoapods'
gem 'cocoapods', '1.0.0.beta.6'
110 changes: 58 additions & 52 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,93 +11,99 @@ GEM
RubyInline (3.12.4)
ZenTest (~> 4.3)
ZenTest (4.11.0)
activesupport (4.2.1)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
claide (0.8.1)
cocoapods (0.36.3)
activesupport (>= 3.2.15)
claide (~> 0.8.1)
cocoapods-core (= 0.36.3)
cocoapods-downloader (~> 0.9.0)
cocoapods-plugins (~> 0.4.1)
cocoapods-trunk (~> 0.6.0)
cocoapods-try (~> 0.4.3)
ast (2.2.0)
claide (1.0.0.beta.3)
cocoapods (1.0.0.beta.6)
activesupport (>= 4.0.2)
claide (>= 1.0.0.beta.3, < 2.0)
cocoapods-core (= 1.0.0.beta.6)
cocoapods-deintegrate (>= 1.0.0.beta.1, < 2.0)
cocoapods-downloader (>= 1.0.0.beta.2, < 2.0)
cocoapods-plugins (>= 1.0.0.beta.1, < 2.0)
cocoapods-search (>= 1.0.0.beta.1, < 2.0)
cocoapods-stats (>= 1.0.0.beta.3, < 2.0)
cocoapods-trunk (>= 1.0.0.beta.2, < 2.0)
cocoapods-try (>= 1.0.0.beta.3, < 2.0)
colored (~> 1.2)
escape (~> 0.0.4)
molinillo (~> 0.2.1)
nap (~> 0.8)
open4 (~> 1.3)
xcodeproj (~> 0.23.1)
cocoapods-core (0.36.3)
activesupport (>= 3.2.15)
fourflusher (~> 0.3.0)
molinillo (~> 0.4.4)
nap (~> 1.0)
xcodeproj (>= 1.0.0.beta.3, < 2.0)
cocoapods-core (1.0.0.beta.6)
activesupport (>= 4.0.2)
fuzzy_match (~> 2.0.4)
nap (~> 0.8.0)
cocoapods-downloader (0.9.0)
cocoapods-plugins (0.4.2)
nap (~> 1.0)
cocoapods-deintegrate (1.0.0.beta.1)
cocoapods-downloader (1.0.0.beta.2)
cocoapods-plugins (1.0.0.beta.1)
nap
cocoapods-trunk (0.6.0)
nap (>= 0.8)
cocoapods-search (1.0.0.beta.1)
cocoapods-stats (1.0.0.beta.3)
cocoapods-trunk (1.0.0.beta.2)
nap (>= 0.8, < 2.0)
netrc (= 0.7.8)
cocoapods-try (0.4.3)
cocoapods-try (1.0.0.beta.3)
colored (1.2)
diff-lcs (1.2.5)
dotenv (2.1.0)
dotenv (2.1.1)
escape (0.0.4)
fourflusher (0.3.0)
fuzzy_match (2.0.4)
i18n (0.7.0)
json (1.8.2)
minitest (5.5.1)
molinillo (0.2.3)
nap (0.8.0)
json (1.8.3)
minitest (5.8.4)
molinillo (0.4.4)
nap (1.1.0)
netrc (0.7.8)
open4 (1.3.4)
osx_keychain (1.0.1)
RubyInline (~> 3)
parser (2.2.2.2)
ast (>= 1.1, < 3.0)
parser (2.3.0.7)
ast (~> 2.2)
powerpack (0.1.1)
rainbow (2.0.0)
rake (10.3.2)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.2)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.0)
rainbow (2.1.0)
rake (11.1.2)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubocop (0.31.0)
astrolabe (~> 1.3)
parser (>= 2.2.2.1, < 3.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubocop (0.39.0)
parser (>= 2.3.0.7, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.7.5)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
xcodeproj (0.23.1)
unicode-display_width (1.0.3)
xcodeproj (1.0.0.beta.3)
activesupport (>= 3)
claide (>= 1.0.0.beta.1, < 2.0)
colored (~> 1.2)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.3)
cocoapods
cocoapods (= 1.0.0.beta.6)
cocoapods-keys!
rake
rspec
Expand Down
6 changes: 4 additions & 2 deletions cocoapods_keys.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
spec.authors = ["Orta Therox", 'Samuel E. Giddins']
spec.email = ["orta.therox@gmail.com", 'segiddins@segiddins.me']
spec.description = %q{A key value store for environment settings in Cocoa Apps.}
spec.summary = %q{CocoaPods Keys will store sensitive data in your Mac's keychain. Then on running pod install they will be installed into your app's source code via the Pods library.}
spec.homepage = "https://github.com/cocoapods/cocoapods-keys"
spec.summary = %q{CocoaPods Keys will store sensitive data in your Mac's keychain. Then on running `pod install` they will be installed into your app's source code by creating a Development Pod.}
spec.homepage = "https://github.com/orta/cocoapods-keys"
spec.license = "MIT"

spec.files = `git ls-files`.split($/)
Expand All @@ -20,6 +20,8 @@ Gem::Specification.new do |spec|

spec.add_runtime_dependency "osx_keychain"
spec.add_runtime_dependency "dotenv"
# spec.add_runtime_dependency "cocoapods", "> 1"

spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods_keys.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CocoaPodsKeys
VERSION = '1.7.0'
VERSION = '1.7.0'.freeze
end
2 changes: 1 addition & 1 deletion lib/key_master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(keyring, time = Time.now)
@time = time
@keys = keyring.camel_cased_keys
@name = keyring.code_name.capitalize + 'Keys'
if /^\d/.match(@name)
if /^\d/ =~ @name
@name = '_' + @name
end

Expand Down
4 changes: 2 additions & 2 deletions lib/keyring_liberator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def self.get_all_keyrings
rings
end

private

def self.get_keyring_at_path(path)
Keyring.from_hash(YAML.load(path.read)) if path.file?
end

private_class_method :get_keyring_at_path
end
end
5 changes: 4 additions & 1 deletion lib/name_whisperer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ def self.search_folders_for_xcodeproj
loop do
ui.print ' > '
answer = ui.gets.strip
break if answer.length > 0
break unless answer.empty?
end
answer
end
end

private_class_method :xcodeproj_from_podfile
private_class_method :search_folders_for_xcodeproj
end
end
27 changes: 7 additions & 20 deletions lib/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class << self
include FileUtils

# Register for the pre-install hooks to setup & run Keys
Pod::HooksManager.register('cocoapods-keys', :pre_install) do
CocoaPodsKeys.setup
Pod::HooksManager.register('cocoapods-keys', :pre_install) do |context, options|
CocoaPodsKeys.setup(context.podfile, options)
end

def setup
def setup(podfile, options)
require 'preinstaller'

unless PreInstaller.new(user_options).setup
unless PreInstaller.new(options).setup
raise Pod::Informative, 'Could not load key data'
end

Expand All @@ -27,7 +27,7 @@ def setup
cp podspec_path, keys_path

# Get all the keys
local_user_options = user_options || {}
local_user_options = options || {}
project = local_user_options.fetch('project') { CocoaPodsKeys::NameWhisperer.get_project_name }

keyring = KeyringLiberator.get_current_keyring(project, Dir.getwd) ||
Expand All @@ -44,7 +44,7 @@ def setup
File.write(implementation_file, key_master.implementation)

# Add our template podspec
add_keys_to_pods(keys_path.relative_path_from(installation_root), user_options)
add_keys_to_pods(podfile, keys_path.relative_path_from(installation_root), options)

# Remove the shared scheme for this pod
Pod::HooksManager.register('cocoapods-keys', :post_install) do
Expand All @@ -53,7 +53,7 @@ def setup
end
end

def add_keys_to_pods(keys_path, options)
def add_keys_to_pods(podfile, keys_path, options)
keys_targets = options['target'] || options['targets']

if keys_targets
Expand All @@ -79,18 +79,5 @@ def add_keys_to_pods(keys_path, options)
podfile.pod 'Keys', :path => keys_path.to_path
end
end

private

def podfile
Pod::Config.instance.podfile
end

def user_options
options = podfile.plugins['cocoapods-keys']
# Until CocoaPods provides a HashWithIndifferentAccess, normalize the hash keys here.
# See https://github.com/CocoaPods/CocoaPods/issues/3354
options.with_indifferent_access
end
end
end
2 changes: 1 addition & 1 deletion lib/pod/command/keys/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def display_current_keyring(keyring)
data = keyring.keychain_data
data.each_with_index do |(key, value), index|
prefix = (index == data.length - 1) ? ' └ ' : ' ├ '
UI.puts prefix + " #{key} - #{ value}"
UI.puts prefix + " #{key} - #{value}"
end
UI.puts
end
Expand Down
2 changes: 1 addition & 1 deletion lib/preinstaller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def setup
loop do
ui.print ' > '
answer = ui.gets.strip
break if answer.length > 0
break unless answer.empty?
end

ui.puts
Expand Down
4 changes: 3 additions & 1 deletion spec/functional_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
File.open('Podfile', 'w') do |podfile|
podfile.puts <<-PODFILE
platform :ios, '7'
install! 'cocoapods', :integrate_targets => false
plugin 'cocoapods-keys', {
:project => 'TestProject',
:keys => [
Expand All @@ -25,7 +27,7 @@
system('pod keys set KeyWithData such-data --silent')
system('pod keys set AnotherKeyWithData other-data --silent')
system('pod keys set UnusedKey - --silent')
system('pod install --silent --no-repo-update --no-integrate')
system('pod install --silent')
end
end

Expand Down
Loading

0 comments on commit 29c0193

Please sign in to comment.