class Hocho::Drivers::Base

Attributes

base_dir[R]
host[R]
initializers[R]

Public Class Methods

new(host, base_dir: '.', initializers: []) click to toggle source
# File lib/hocho/drivers/base.rb, line 8
def initialize(host, base_dir: '.', initializers: [])
  @host = host
  @base_dir = base_dir
  @initializers = initializers
end

Public Instance Methods

finalize() click to toggle source
# File lib/hocho/drivers/base.rb, line 20
def finalize
end
run(dry_run: false) click to toggle source
# File lib/hocho/drivers/base.rb, line 16
def run(dry_run: false)
  raise NotImplementedError
end
run_list() click to toggle source
# File lib/hocho/drivers/base.rb, line 23
def run_list
  [*initializers, *host.run_list]
end

Private Instance Methods

node_json() click to toggle source
# File lib/hocho/drivers/base.rb, line 29
def node_json
  host.attributes.to_json
end
with_node_json_file() { |path| ... } click to toggle source
# File lib/hocho/drivers/base.rb, line 33
def with_node_json_file
  begin
    f = Tempfile.new('node-json')
    f.puts node_json
    f.flush
    yield f.path
  ensure
    f.close!
  end
end