Class: SSHKit::Backend::Local

Inherits:
Printer show all
Defined in:
lib/sshkit/backends/local.rb

Instance Attribute Summary

Attributes inherited from Abstract

#host

Instance Method Summary collapse

Methods included from CommandHelper

#make, #rake

Methods inherited from Abstract

#as, #background, config, configure, #debug, #error, #fatal, #info, #log, #make, #rake, #trace, #warn, #with, #within

Constructor Details

#initialize(&block) ⇒ Local

Returns a new instance of Local.



8
9
10
# File 'lib/sshkit/backends/local.rb', line 8

def initialize(&block)
  @block = block
end

Instance Method Details

#capture(*args) ⇒ Object



28
29
30
31
# File 'lib/sshkit/backends/local.rb', line 28

def capture(*args)
  options = args.extract_options!.merge(verbosity: Logger::DEBUG)
  _execute(*[*args, options]).full_stdout.strip
end

#execute(*args) ⇒ Object



24
25
26
# File 'lib/sshkit/backends/local.rb', line 24

def execute(*args)
  _execute(*args).success?
end

#runObject



12
13
14
# File 'lib/sshkit/backends/local.rb', line 12

def run
  instance_exec(&@block)
end

#test(*args) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/sshkit/backends/local.rb', line 16

def test(*args)
  options = args.extract_options!.merge(
    raise_on_non_zero_exit: false,
    verbosity: Logger::DEBUG
  )
  _execute(*[*args, options]).success?
end