lib/plugin.rb in cocoapods-keys-1.3.2 vs lib/plugin.rb in cocoapods-keys-1.4.0
- old
+ new
@@ -7,24 +7,30 @@
include FileUtils
def setup
require 'preinstaller'
- PreInstaller.new(user_options).setup
+ unless PreInstaller.new(user_options).setup
+ raise Pod::Informative, 'Could not load key data'
+ end
installation_root = Pod::Config.instance.installation_root
- keys_path = installation_root.+('Pods/CocoaPodsKeys/').relative_path_from(installation_root)
+ keys_path = installation_root.+('Pods/CocoaPodsKeys/')
# move our podspec in to the Pods
mkdir_p keys_path
podspec_path = Pathname(__dir__) + '../templates' + 'Keys.podspec.json'
cp podspec_path, keys_path
# Get all the keys
local_user_options = user_options || {}
project = local_user_options.fetch('project') { CocoaPodsKeys::NameWhisperer.get_project_name }
- keyring = KeyringLiberator.get_keyring_named(project) || KeyringLiberator.get_keyring(Pathname.pwd)
+
+ keyring = KeyringLiberator.get_keyring_named(project) ||
+ KeyringLiberator.get_keyring(Dir.getwd) ||
+ Keyring.new(project, Dir.getwd, local_user_options['keys'])
+
raise Pod::Informative, 'Could not load keyring' unless keyring
# Create the h & m files in the same folder as the podspec
key_master = KeyMaster.new(keyring)
interface_file = keys_path + (key_master.name + '.h')
@@ -32,10 +38,10 @@
File.write(interface_file, key_master.interface)
File.write(implementation_file, key_master.implementation)
# Add our template podspec
- add_keys_to_pods(keys_path, user_options)
+ add_keys_to_pods(keys_path.relative_path_from(installation_root), user_options)
end
def add_keys_to_pods(keys_path, options)
keys_targets = options['target'] || options['targets']