Class: Pod::Command::Keys::Get

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

Instance Method Summary collapse

Methods inherited from Pod::Command::Keys

#create_keyring, #get_current_keyring

Constructor Details

#initialize(argv) ⇒ Get

Returns a new instance of Get.



19
20
21
22
23
# File 'lib/pod/command/keys/get.rb', line 19

def initialize(argv)
  @key_name = argv.shift_argument
  @project_name = argv.shift_argument
  super
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/pod/command/keys/get.rb', line 31

def run
  keyring = get_current_keyring
  unless keyring
    raise Informative, 'Could not find a project for this folder'
  end

  if keyring.keys.include? @key_name
    data = keyring.keychain_value(@key_name)
    UI.puts data
  else
    raise Informative, 'Could not find value'
  end
end

#validate!Object



25
26
27
28
29
# File 'lib/pod/command/keys/get.rb', line 25

def validate!
  super
  verify_podfile_exists!
  help! 'A key name is required for lookup.' unless @key_name
end