Class: Tug::Keychain
- Inherits:
-
Object
- Object
- Tug::Keychain
- Defined in:
- lib/tug/keychain/keychain.rb
Instance Attribute Summary collapse
-
#apple_certificate ⇒ Object
readonly
Returns the value of attribute apple_certificate.
-
#distribution_certificate ⇒ Object
readonly
Returns the value of attribute distribution_certificate.
-
#distribution_profile ⇒ Object
readonly
Returns the value of attribute distribution_profile.
-
#name ⇒ Object
Returns the value of attribute name.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
-
#private_key_password ⇒ Object
Returns the value of attribute private_key_password.
Class Method Summary collapse
Instance Method Summary collapse
- #configure(options) ⇒ Object
- #create_keychain ⇒ Object
- #delete_keychain ⇒ Object
- #import_apple_certificate ⇒ Object
- #import_distribution_certificate ⇒ Object
- #import_private_key ⇒ Object
- #import_profile ⇒ Object
-
#initialize(keychain_yaml) ⇒ Keychain
constructor
A new instance of Keychain.
- #select_keychain(keychain_name = name) ⇒ Object
- #set_timeout ⇒ Object
- #unlock_keychain ⇒ Object
Constructor Details
#initialize(keychain_yaml) ⇒ Keychain
Returns a new instance of Keychain.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tug/keychain/keychain.rb', line 19 def initialize(keychain_yaml) @apple_certificate = keychain_yaml["apple_certificate"] @distribution_certificate = keychain_yaml["distribution_certificate"] @distribution_profile = keychain_yaml["distribution_profile"] @private_key = keychain_yaml["private_key"] # these defaults are also set in Interface @private_key_password = ENV['TUG_P12_PASSWORD'] @name = "tug" end |
Instance Attribute Details
#apple_certificate ⇒ Object (readonly)
Returns the value of attribute apple_certificate.
4 5 6 |
# File 'lib/tug/keychain/keychain.rb', line 4 def apple_certificate @apple_certificate end |
#distribution_certificate ⇒ Object (readonly)
Returns the value of attribute distribution_certificate.
5 6 7 |
# File 'lib/tug/keychain/keychain.rb', line 5 def distribution_certificate @distribution_certificate end |
#distribution_profile ⇒ Object (readonly)
Returns the value of attribute distribution_profile.
6 7 8 |
# File 'lib/tug/keychain/keychain.rb', line 6 def distribution_profile @distribution_profile end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/tug/keychain/keychain.rb', line 9 def name @name end |
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
7 8 9 |
# File 'lib/tug/keychain/keychain.rb', line 7 def private_key @private_key end |
#private_key_password ⇒ Object
Returns the value of attribute private_key_password.
8 9 10 |
# File 'lib/tug/keychain/keychain.rb', line 8 def private_key_password @private_key_password end |
Class Method Details
.keychain(config) ⇒ Object
12 13 14 15 16 |
# File 'lib/tug/keychain/keychain.rb', line 12 def keychain(config) if config.has_key?("keychain") Tug::Keychain.new(config["keychain"]) end end |
Instance Method Details
#configure(options) ⇒ Object
30 31 32 33 |
# File 'lib/tug/keychain/keychain.rb', line 30 def configure() @name = [:keychain] @private_key_password = [:password] end |
#create_keychain ⇒ Object
35 36 37 |
# File 'lib/tug/keychain/keychain.rb', line 35 def create_keychain system("security create-keychain -p tug #{name}.keychain") end |
#delete_keychain ⇒ Object
43 44 45 |
# File 'lib/tug/keychain/keychain.rb', line 43 def delete_keychain system("security delete-keychain #{name}.keychain") end |
#import_apple_certificate ⇒ Object
55 56 57 |
# File 'lib/tug/keychain/keychain.rb', line 55 def import_apple_certificate system(import_command(apple_certificate)) end |
#import_distribution_certificate ⇒ Object
59 60 61 |
# File 'lib/tug/keychain/keychain.rb', line 59 def import_distribution_certificate system(import_command(distribution_certificate)) end |
#import_private_key ⇒ Object
63 64 65 |
# File 'lib/tug/keychain/keychain.rb', line 63 def import_private_key system(import_command(private_key) + " -P '#{private_key_password}'") end |
#import_profile ⇒ Object
67 68 69 70 |
# File 'lib/tug/keychain/keychain.rb', line 67 def import_profile FileUtils.mkdir_p "#{File.expand_path('~')}/Library/MobileDevice/Provisioning\ Profiles/" system("cp #{distribution_profile} #{profile_export_path}") end |
#select_keychain(keychain_name = name) ⇒ Object
39 40 41 |
# File 'lib/tug/keychain/keychain.rb', line 39 def select_keychain(keychain_name=name) system("security default-keychain -s #{keychain_name}.keychain") end |
#set_timeout ⇒ Object
51 52 53 |
# File 'lib/tug/keychain/keychain.rb', line 51 def set_timeout system("security set-keychain-settings -t 3600 -u #{name}.keychain") end |
#unlock_keychain ⇒ Object
47 48 49 |
# File 'lib/tug/keychain/keychain.rb', line 47 def unlock_keychain system("security unlock-keychain -p tug #{name}.keychain") end |