Module: Xcode::Keychains

Defined in:
lib/xcode/keychain.rb

Class Method Summary collapse

Class Method Details

.search_pathArray<Xcode::Keychain>

Get the list of search keychains

Returns:



18
19
20
21
22
# File 'lib/xcode/keychain.rb', line 18

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

Parameters:



29
30
31
32
33
34
35
36
37
38
# File 'lib/xcode/keychain.rb', line 29

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
# File 'lib/xcode/keychain.rb', line 8

def self.with_keychain_in_search_path(kc, &block)
  kc.in_search_path &block
end