Class: Pod::Command::Keys::List

Inherits:
Pod::Command::Keys show all
Defined in:
lib/pod/command/keys/list.rb

Instance Method Summary collapse

Methods inherited from Pod::Command::Keys

#create_keyring, #get_current_keyring

Instance Method Details

#display_current_keyring(keyring) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/pod/command/keys/list.rb', line 29

def display_current_keyring(keyring)
  UI.puts "Keys for #{keyring.name}"
  data = keyring.keychain_data
  data.each_with_index do |(key, value), index|
    prefix = (index == data.length - 1) ? '' : ''
    UI.puts prefix + " #{key} - #{value}"
  end
  UI.puts
end

#display_keyring(keyring) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/pod/command/keys/list.rb', line 39

def display_keyring(keyring)
  UI.puts "#{keyring.name} - #{keyring.path}"
  if keyring.keys.length == 1
    UI.puts '' + keyring.keys[0]
  else
    UI.puts '' + keyring.keys[0...-1].join(' ') + ' & ' + keyring.keys[-1]
  end
  UI.puts
end

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pod/command/keys/list.rb', line 15

def run
  # List all settings for current app
  this_keyring = get_current_keyring
  if this_keyring
    display_current_keyring this_keyring
  end

  # List all known bundle ids
  all_keyrings = CocoaPodsKeys::KeyringLiberator.get_all_keyrings
  all_keyrings.each do |keyring|
    display_keyring(keyring) if !this_keyring || keyring.path != this_keyring.path
  end
end