class RSpecSystem::Helpers::Shell

Helper object behind RSpecSystem::Helpers#shell

Public Class Methods

new(opts, clr, &block) click to toggle source

Initializer for Shell object.

This should be initialized via the helper method, not directly.

@api private @param opts [Hash] options hash @param clr [Object] caller object @param block [Proc] code block @see RSpecSystem::Helpers#shell helper method

Calls superclass method RSpecSystem::Helper::new
# File lib/rspec-system/helpers/shell.rb, line 18
def initialize(opts, clr, &block)
  # Defaults
  opts = {
    :c => opts[:command],
    :command => opts[:c],
  }.merge(opts)

  if opts[:c].nil?
    raise "Cannot use shell with no :command or :c option"
  end

  super(opts, clr, &block)
end

Public Instance Methods

execute() click to toggle source

Gathers new results by executing the resource action

# File lib/rspec-system/helpers/shell.rb, line 33
def execute
  dest = opts[:n].name
  cmd = opts[:c]

  output << bold(color("#{dest}$", :green)) << " #{cmd}\n"
  RSpecSystem::NodeSet.create.run(opts)
end