Class: Rundock::Backend::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rundock/backend.rb

Direct Known Subclasses

Local, Ssh

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Base

Returns a new instance of Base.



24
25
26
27
# File 'lib/rundock/backend.rb', line 24

def initialize(options)
  @options = parse(options)
  @backend = create_specinfra_backend
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



100
101
102
# File 'lib/rundock/backend.rb', line 100

def method_missing(method, *args)
  @backend.send(method, *args)
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



22
23
24
# File 'lib/rundock/backend.rb', line 22

def backend
  @backend
end

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/rundock/backend.rb', line 21

def options
  @options
end

Instance Method Details

#run_commands(cmd, exec_options = {}) ⇒ Object



29
30
31
32
33
# File 'lib/rundock/backend.rb', line 29

def run_commands(cmd, exec_options = {})
  Array(cmd).each do |c|
    run_command(c, exec_options)
  end
end

#send_file(from, to) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/rundock/backend.rb', line 35

def send_file(from, to)
  system("test -d #{from}")
  recursive = $?.to_i == 0

  if !recursive
    @backend.send_file(from, to)
  else
    @backend.send_directory(from, to)
  end
end

#specinfra_run_command(command) ⇒ Object



46
47
48
# File 'lib/rundock/backend.rb', line 46

def specinfra_run_command(command)
  @backend.run_command(command)
end