Class: Sprinkle::Installers::Runner

Inherits:
Installer show all
Defined in:
lib/sprinkle/installers/runner.rb

Overview

The runner installer is great for running a simple command.

Example Usage

package :magic_beans do
  runner "make world"
end

You can also pass multiple commands as arguments or an array.

package :magic_beans do
  runner "make world", "destroy world"
  runner [ "make world", "destroy world" ]
end

Environment variables can be supplied throught the :env option.

package :magic_beans do
  runner "make world", :env => {
    :PATH => '/this/is/my/path:$PATH'
  }
end

Instance Attribute Summary collapse

Attributes inherited from Installer

#delivery, #options, #package, #post, #pre

Instance Method Summary collapse

Methods inherited from Installer

#announce, api, #commands_from_block, #defer, #escape_shell_arg, inherited, #install_sequence, #method_missing, #per_host?, #post_process, #process, subclasses, verify_api

Methods included from Sudo

#sudo?, #sudo_cmd, #sudo_stack

Methods included from Attributes

#defaults, #set_defaults

Constructor Details

#initialize(parent, cmds, options = {}, &block) ⇒ Runner

:nodoc:


41
42
43
44
45
46
# File 'lib/sprinkle/installers/runner.rb', line 41

def initialize(parent, cmds, options = {}, &block) #:nodoc:
  super parent, options, &block
  @env = options.delete(:env)
  @cmds = [*cmds].flatten
  raise "you need to specify a command" if cmds.nil?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sprinkle::Installers::Installer

Instance Attribute Details

#cmdsObject

:nodoc:


40
41
42
# File 'lib/sprinkle/installers/runner.rb', line 40

def cmds
  @cmds
end