Class: Billy::Commands::My

Inherits:
Command
  • Object
show all
Defined in:
lib/billy/commands/my.rb

Instance Method Summary collapse

Methods inherited from Command

instance, #name, register_self!

Instance Method Details

#proceed!(arguments = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/billy/commands/my.rb', line 7

def proceed!( arguments = nil )
  if arguments.length < 1
    Billy::Util::UI.err 'Please provide Billy more info what do you need?'
    exit 1
  end
  sub_cmd = arguments.shift.downcase.to_sym rescue nil
  case sub_cmd
  when :key 
    res = Billy::Util::Ssh.get_pub_key
    if res.nil?
      Billy::Util::UI.err "Billy could not find your ssh key. Say billy hello."
      exit 1
    else
      Billy::Util::UI.inform "Billy found an ssh key:"
      Billy::Util::UI.succ res
      Billy::Util::UI.inform "Copy and add it to your deployment server."
    end
  when :config
    Billy::Commands::Config.instance.proceed!( arguments )
  else
    Billy::Util::UI.err "Billy doesn't know #{sub_cmd} command."
    exit 1
  end
end