Class: Bosh::Bootstrap::Commander::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh-bootstrap/commander/command.rb

Direct Known Subclasses

RemoteScriptCommand, UploadCommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, description, full_present_tense = nil, full_past_tense = nil) ⇒ Command

Returns a new instance of Command.



12
13
14
15
16
17
# File 'lib/bosh-bootstrap/commander/command.rb', line 12

def initialize(command, description, full_present_tense=nil, full_past_tense=nil)
  @command            = command
  @description        = description
  @full_present_tense = full_present_tense || "#{command} #{description}"
  @full_past_tense    = full_past_tense || "#{command} #{description}"
end

Instance Attribute Details

#commandObject (readonly)

verb e.g. “install”



6
7
8
# File 'lib/bosh-bootstrap/commander/command.rb', line 6

def command
  @command
end

#descriptionObject (readonly)

noun phrase, e.g. “packages”



7
8
9
# File 'lib/bosh-bootstrap/commander/command.rb', line 7

def description
  @description
end

#full_past_tenseObject (readonly)

e.g. “installed packages”



10
11
12
# File 'lib/bosh-bootstrap/commander/command.rb', line 10

def full_past_tense
  @full_past_tense
end

#full_present_tenseObject (readonly)

e.g. “installing packages”



9
10
11
# File 'lib/bosh-bootstrap/commander/command.rb', line 9

def full_present_tense
  @full_present_tense
end

Instance Method Details

#perform(server) ⇒ Object

Invoke this command (subclass) to call back upon server to perform a server helper



21
22
23
# File 'lib/bosh-bootstrap/commander/command.rb', line 21

def perform(server)
  raise "please implement this method to call back upon `server`"
end