Sha256: 4befe4c7b0e9d0db3f3a91a7bfd293c797ad559023e34b37a03f6c5632af9de5
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
require 'rspec-system' module RSpecSystem::Helpers # Helper object behind RSpecSystem::Helpers#shell class Shell < RSpecSystem::Helper name 'shell' properties :stdout, :stderr, :exit_code # 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 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 # Gathers new results by executing the resource action def execute dest = opts[:n].name cmd = opts[:c] output << bold(color("#{dest}$", :green)) << " #{cmd}\n" RSpecSystem::NodeSet.create.run(opts) end end end
Version data entries
5 entries across 5 versions & 1 rubygems