Sha256: fb1307282b6c4150e3373ec00a589fb7c886082f0451f3d2404584983bfc654c
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
module Sprinkle module Installers # 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 # class Runner < Installer api do def runner(*cmds, &block) options = cmds.extract_options! install Runner.new(self, cmds, options, &block) end # runs 'echo noop' on the remote host def noop install Runner.new(self, "echo noop") end end attr_accessor :cmds #:nodoc: def initialize(parent, cmds, options = {}, &block) #:nodoc: super parent, options, &block @cmds = [*cmds].flatten raise "you need to specify a command" if cmds.nil? end protected def install_commands #:nodoc: sudo? ? @cmds.map { |cmd| "#{sudo_cmd}#{cmd}"} : @cmds end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprinkle-0.7.2 | lib/sprinkle/installers/runner.rb |