Class: Fauxpaas::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/fauxpaas/command.rb

Overview

Represetns a command within Fauxpaas

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Command

Returns a new instance of Command.



8
9
10
# File 'lib/fauxpaas/command.rb', line 8

def initialize(options)
  @options = options
end

Instance Method Details

#binObject



12
13
14
# File 'lib/fauxpaas/command.rb', line 12

def bin
  "help"
end

#default_keysObject



20
21
22
# File 'lib/fauxpaas/command.rb', line 20

def default_keys
  [:instance_name, :server]
end

#executeObject



16
17
18
# File 'lib/fauxpaas/command.rb', line 16

def execute
  Fauxpaas.system_runner.run(ssh_command)
end

#extra_keysObject



24
25
26
# File 'lib/fauxpaas/command.rb', line 24

def extra_keys
  []
end

#keysObject



28
29
30
# File 'lib/fauxpaas/command.rb', line 28

def keys
  default_keys | extra_keys
end

#missingObject



32
33
34
# File 'lib/fauxpaas/command.rb', line 32

def missing
  keys.select {|k| options[k].nil? }
end

#valid?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fauxpaas/command.rb', line 36

def valid?
  missing.empty?
end