class Blower::Local

Attributes

data[R]
name[R]

Public Class Methods

new(name, proxy: nil) click to toggle source
# File lib/blower/local.rb, line 18
def initialize (name, proxy: nil)
  @name, @proxy = name, proxy
  @data = {}
end

Public Instance Methods

log() click to toggle source

Produce a Logger prefixed with the host name. @api private

# File lib/blower/local.rb, line 42
def log
  @log ||= Logger.instance.with_prefix("on #{name}: ")
end
sh(command, as: nil, quiet: false) click to toggle source
# File lib/blower/local.rb, line 28
def sh (command, as: nil, quiet: false)
  command = "#{@proxy} #{command.shellescape}" if @proxy
  result = IO.popen(command) do |io|
    io.read
  end
  if $?.success?
    result
  else
    raise "Command failed"
  end
end
to_s() click to toggle source

Represent the host as a string.

# File lib/blower/local.rb, line 24
def to_s
  @name
end