Class: Taketo::Constructs::Command

Inherits:
BaseConstruct show all
Includes:
Shellwords
Defined in:
lib/taketo/constructs/command.rb

Instance Attribute Summary collapse

Attributes inherited from BaseConstruct

#default_server_config, #name, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseConstruct

#initialize, #node_type, #parents, #path, #qualified_name

Methods included from AssociatedNodes

included

Constructor Details

This class inherits a constructor from Taketo::Constructs::BaseConstruct

Instance Attribute Details

#commandObject

Returns the value of attribute command.



9
10
11
# File 'lib/taketo/constructs/command.rb', line 9

def command
  @command
end

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/taketo/constructs/command.rb', line 9

def description
  @description
end

Class Method Details

.defaultObject



11
12
13
# File 'lib/taketo/constructs/command.rb', line 11

def self.default
  new(:default).tap { |cmd| cmd.command = "bash" }
end

.explicit_command(command_string) ⇒ Object



15
16
17
# File 'lib/taketo/constructs/command.rb', line 15

def self.explicit_command(command_string)
  new(:explicit_command).tap { |cmd| cmd.command = command_string.to_s }
end

Instance Method Details

#render(server, options = {}) ⇒ Object



19
20
21
# File 'lib/taketo/constructs/command.rb', line 19

def render(server, options = {})
  %Q[#{location(server, options)} #{environment_variables(server)} #{command}].strip.squeeze(" ")
end

#to_sObject



23
24
25
# File 'lib/taketo/constructs/command.rb', line 23

def to_s
  command.to_s
end