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
- #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
Constructor Details
#initialize(keychain_yaml) ⇒ Keychain
Returns a new instance of Keychain.
17 18 19 20 21 22 23 24 |
# File 'lib/tug/keychain/keychain.rb', line 17 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"] @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(keychain_yaml) ⇒ Object
12 13 14 |
# File 'lib/tug/keychain/keychain.rb', line 12 def keychain(keychain_yaml) Tug::Keychain.new(keychain_yaml) end |
Instance Method Details
#create_keychain ⇒ Object
26 27 28 |
# File 'lib/tug/keychain/keychain.rb', line 26 def create_keychain system("security create-keychain -p tug #{name}.keychain") end |
#delete_keychain ⇒ Object
34 35 36 |
# File 'lib/tug/keychain/keychain.rb', line 34 def delete_keychain system("security delete-keychain #{name}.keychain") end |
#import_apple_certificate ⇒ Object
38 39 40 |
# File 'lib/tug/keychain/keychain.rb', line 38 def import_apple_certificate system(import_command(apple_certificate)) end |
#import_distribution_certificate ⇒ Object
42 43 44 |
# File 'lib/tug/keychain/keychain.rb', line 42 def import_distribution_certificate system(import_command(distribution_certificate)) end |
#import_private_key ⇒ Object
46 47 48 |
# File 'lib/tug/keychain/keychain.rb', line 46 def import_private_key system(import_command(private_key) + " -P '#{private_key_password}'") end |
#import_profile ⇒ Object
50 51 52 53 |
# File 'lib/tug/keychain/keychain.rb', line 50 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
30 31 32 |
# File 'lib/tug/keychain/keychain.rb', line 30 def select_keychain(keychain_name=name) system("security default-keychain -s #{keychain_name}.keychain") end |