Class: Specinfra::Backend::ShellScript

Inherits:
Base
  • Object
show all
Defined in:
lib/specinfra/backend/shell_script.rb

Defined Under Namespace

Classes: Writer

Instance Method Summary collapse

Methods inherited from Base

clear, #command, #get_config, #host_inventory, instance, #os_info, #set_config, #set_example, #stderr_handler=, #stdout_handler=

Constructor Details

#initialize(config = {}) ⇒ ShellScript

Returns a new instance of ShellScript.



6
7
8
9
10
11
# File 'lib/specinfra/backend/shell_script.rb', line 6

def initialize(config = {})
  super

  @lines = [ "#!/bin/sh", "" ]
  ObjectSpace.define_finalizer(self, Writer.new(@lines))
end

Instance Method Details

#run_command(cmd, opts = {}) ⇒ Object



13
14
15
16
# File 'lib/specinfra/backend/shell_script.rb', line 13

def run_command(cmd, opts={})
  @lines << cmd
  CommandResult.new
end