Class: Specinfra::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/specinfra/runner.rb

Class Method Summary collapse

Class Method Details

.method_missing(meth, *args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/specinfra/runner.rb', line 3

def self.method_missing(meth, *args)
  backend   = Specinfra.backend
  processor = Specinfra::Processor
  
  if ! os.include?(:family) || os[:family] != 'windows'
    if processor.respond_to?(meth)
      processor.send(meth, *args)
    elsif backend.respond_to?(meth)
      backend.send(meth, *args)
    else
      run(meth, *args)
    end
  else
    if backend.respond_to?(meth)
      backend.send(meth, *args)
    else
      run(meth, *args)
    end
  end
end

.run(meth, *args) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/specinfra/runner.rb', line 25

def self.run(meth, *args)
  cmd = Specinfra.command.get(meth, *args)
  ret = Specinfra.backend.run_command(cmd)
  if meth.to_s =~ /^check/
    ret.success?
  else
    ret
  end
end