module Scmd
Scmd::Command
is a base wrapper for handling system commands. Initialize it with with a string specifying the command to execute. You can then run the command and inspect its results. It can be used as is, or inherited from to create a more custom command wrapper.
Constants
- TimeoutError
- VERSION
Public Class Methods
add_command(cmd_str, &block)
click to toggle source
# File lib/scmd.rb, line 39 def self.add_command(cmd_str, &block) commands.add(cmd_str, &block) end
calls()
click to toggle source
# File lib/scmd.rb, line 28 def self.calls raise NoMethodError unless ENV["SCMD_TEST_MODE"] @calls ||= [] end
commands()
click to toggle source
# File lib/scmd.rb, line 20 def self.commands raise NoMethodError unless ENV["SCMD_TEST_MODE"] @commands ||= begin require "scmd/stored_commands" StoredCommands.new end end
new(*args)
click to toggle source
Scmd
can be run in “test mode”. This means that command spies will be used in place of “live” commands, each time a command is run or started will be logged in a collection and option-specific spies can be added and used to “stub” spies with specific attributes in specific contexts.
# File lib/scmd.rb, line 12 def self.new(*args) if !ENV["SCMD_TEST_MODE"] Command.new(*args) else commands.get(*args) end end
reset()
click to toggle source
# File lib/scmd.rb, line 33 def self.reset raise NoMethodError unless ENV["SCMD_TEST_MODE"] calls.clear commands.remove_all end