Class: SimpleWorker::SshWorker

Inherits:
Object
  • Object
show all
Includes:
AbstractWorker
Defined in:
lib/simpleworker/ssh_worker.rb

Instance Attribute Summary collapse

Attributes included from AbstractWorker

#cmd, #script

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AbstractWorker

#env, #start, #stop, #wait

Constructor Details

#initializeSshWorker

Returns a new instance of SshWorker.



8
9
10
11
# File 'lib/simpleworker/ssh_worker.rb', line 8

def initialize
  @script = %W[bash #{File.expand_path(File.dirname(__FILE__))}/bash/ssh-remoteworker]
  @env = {}
end

Instance Attribute Details

#directoryObject

Returns the value of attribute directory.



6
7
8
# File 'lib/simpleworker/ssh_worker.rb', line 6

def directory
  @directory
end

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/simpleworker/ssh_worker.rb', line 6

def host
  @host
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/simpleworker/ssh_worker.rb', line 6

def user
  @user
end

Class Method Details

.create(config = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/simpleworker/ssh_worker.rb', line 13

def self.create(config = {})
  worker = new
  worker.script = config['script'] if config.has_key? 'script'
  worker.cmd = config['cmd'] if config.has_key? 'cmd'
  worker.user = config['user'] if config.has_key? 'user'
  worker.host = config['host'] if config.has_key? 'host'
  worker.directory = config['directory'] if config.has_key? 'directory'
  worker
end