Class: Machines::Command
- Inherits:
-
Object
- Object
- Machines::Command
- Defined in:
- lib/machines/command.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.console ⇒ Object
Returns the value of attribute console.
-
.debug ⇒ Object
Returns the value of attribute debug.
-
.file ⇒ Object
Returns the value of attribute file.
Instance Attribute Summary collapse
-
#check ⇒ Object
Returns the value of attribute check.
-
#command ⇒ Object
Returns the value of attribute command.
Class Method Summary collapse
Instance Method Summary collapse
- #info ⇒ Object
-
#initialize(command, check) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
- #use_sudo ⇒ Object
Constructor Details
#initialize(command, check) ⇒ Command
Returns a new instance of Command.
25 26 27 28 29 |
# File 'lib/machines/command.rb', line 25 def initialize(command, check) @command = command @check = check @sudo = false end |
Class Attribute Details
.console ⇒ Object
Returns the value of attribute console.
4 5 6 |
# File 'lib/machines/command.rb', line 4 def console @console end |
.debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/machines/command.rb', line 4 def debug @debug end |
.file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/machines/command.rb', line 4 def file @file end |
Instance Attribute Details
#check ⇒ Object
Returns the value of attribute check.
7 8 9 |
# File 'lib/machines/command.rb', line 7 def check @check end |
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/machines/command.rb', line 7 def command @command end |
Class Method Details
.scp ⇒ Object
21 22 23 |
# File 'lib/machines/command.rb', line 21 def self.scp @@scp end |
.scp=(scp) ⇒ Object
9 10 11 |
# File 'lib/machines/command.rb', line 9 def self.scp= scp @@scp = scp end |
.ssh ⇒ Object
17 18 19 |
# File 'lib/machines/command.rb', line 17 def self.ssh @@ssh end |
.ssh=(ssh) ⇒ Object
13 14 15 |
# File 'lib/machines/command.rb', line 13 def self.ssh= ssh @@ssh = ssh end |
Instance Method Details
#info ⇒ Object
39 40 41 |
# File 'lib/machines/command.rb', line 39 def info ("%-6s " % (@sudo ? 'SUDO' : 'RUN')) + command end |
#run ⇒ Object
35 36 37 |
# File 'lib/machines/command.rb', line 35 def run process {Command.file.log @@ssh.exec! wrap_in_export_and_sudo(@command)} end |
#use_sudo ⇒ Object
31 32 33 |
# File 'lib/machines/command.rb', line 31 def use_sudo @sudo = 'sudo' end |