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, 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
11
# File 'lib/sshkit/backends/local.rb', line 8

def initialize(&block)
  @host = Host.new(hostname: 'localhost') # just for logging
  @block = block
end

Instance Method Details

#capture(*args) ⇒ Object



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

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

#execute(*args) ⇒ Object



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

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

#runObject



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

def run
  instance_exec(&@block)
end

#test(*args) ⇒ Object



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

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