Sha256: 93cf12e2cfe5acd6b7de8bf18254c7cc647f70194d6fe8b7d9dd6edd55e910f9
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
module CocoaPodsKeys class Installer def initialize(sandbox_root) @sandbox_root = sandbox_root end def install! require 'key_master' require 'keyring_liberator' keyring = KeyringLiberator.get_keyring(Dir.getwd) return unless keyring Pod::UI.section 'Adding keys' do key_master = KeyMaster.new(keyring) keys_folder = File.join(@sandbox_root, 'Keys') keys_headers_folder = File.join(@sandbox_root, 'Headers', 'Public', 'CocoaPods-Keys') interface_file = File.join(keys_headers_folder, key_master.name + '.h') implementation_file = File.join(keys_folder, key_master.name + '.m') Dir.mkdir keys_folder unless Dir.exists? keys_folder Dir.mkdir keys_headers_folder unless Dir.exists? keys_headers_folder File.open(interface_file, 'w') { |f| f.write(key_master.interface) } File.open(implementation_file, 'w') { |f| f.write(key_master.implementation) } project = Xcodeproj::Project.open File.join(@sandbox_root, 'Pods.xcodeproj') group = project.new_group('Keys') group.new_file(interface_file) implementation = group.new_file(implementation_file) pods_target = project.targets.detect { |t| t.name == 'Pods' } unless pods_target pods_target = project.targets.detect { |t| t.name == 'Pods-' + keyring.name } end pods_target.add_file_references [implementation] project.save end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cocoapods-keys-0.9.0 | lib/installer.rb |
cocoapods-keys-0.6.2 | lib/installer.rb |
cocoapods-keys-0.6.1 | lib/installer.rb |