Class: Machines::Command

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

Direct Known Subclasses

LogCommand, Upload

Class Attribute Summary (collapse)

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Command) initialize(command, check)

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

+ (Object) console

Returns the value of attribute console



4
5
6
# File 'lib/machines/command.rb', line 4

def console
  @console
end

+ (Object) debug

Returns the value of attribute debug



4
5
6
# File 'lib/machines/command.rb', line 4

def debug
  @debug
end

+ (Object) file

Returns the value of attribute file



4
5
6
# File 'lib/machines/command.rb', line 4

def file
  @file
end

Instance Attribute Details

- (Object) check

Returns the value of attribute check



7
8
9
# File 'lib/machines/command.rb', line 7

def check
  @check
end

- (Object) command

Returns the value of attribute command



7
8
9
# File 'lib/machines/command.rb', line 7

def command
  @command
end

Class Method Details

+ (Object) scp



21
22
23
# File 'lib/machines/command.rb', line 21

def self.scp
  @@scp
end

+ (Object) scp=(scp)



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

def self.scp= scp
  @@scp = scp
end

+ (Object) ssh



17
18
19
# File 'lib/machines/command.rb', line 17

def self.ssh
  @@ssh
end

+ (Object) ssh=(ssh)



13
14
15
# File 'lib/machines/command.rb', line 13

def self.ssh= ssh
  @@ssh = ssh
end

Instance Method Details

- (Object) info



39
40
41
# File 'lib/machines/command.rb', line 39

def info
  ("%-6s " % (@sudo ? 'SUDO' : 'RUN')) + command
end

- (Object) run



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

- (Object) use_sudo



31
32
33
# File 'lib/machines/command.rb', line 31

def use_sudo
  @sudo = 'sudo'
end