Module: Xcode::Keychains
- Defined in:
- lib/xcode/keychain.rb
Class Method Summary collapse
-
.search_path ⇒ Array<Xcode::Keychain>
Get the list of search keychains.
-
.search_path=(keychains) ⇒ Object
Set the keychains search path and order.
-
.with_keychain_in_search_path(kc, &block) ⇒ Object
Yield when the keychain is in the search path and remove it when the block returns.
Class Method Details
.search_path ⇒ Array<Xcode::Keychain>
Get the list of search keychains
24 25 26 27 28 |
# File 'lib/xcode/keychain.rb', line 24 def self.search_path `security list-keychain`.split.map do |keychain| Xcode::Keychain.new keychain.strip.gsub(/\"/,'') end end |
.search_path=(keychains) ⇒ Object
Set the keychains search path and order
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/xcode/keychain.rb', line 35 def self.search_path=(keychains) search_list = keychains.map do |kc| "\"#{kc.path}\"" end cmd = Xcode::Shell::Command.new "security" cmd << "list-keychain" cmd << "-s #{search_list.join(' ')}" cmd.execute end |
.with_keychain_in_search_path(kc, &block) ⇒ Object
Yield when the keychain is in the search path and remove it when the block returns
8 9 10 11 12 13 14 15 16 |
# File 'lib/xcode/keychain.rb', line 8 def self.with_keychain_in_search_path(kc, &block) keychains = self.search_path begin self.search_path = [kc] + keychains yield ensure self.search_path = keychains end end |