Module: Beaker::CommandFactory
- Includes:
- Minitest::Assertions
- Included in:
- Aix::Exec, Aix::File, Aix::Group, Aix::User, FreeBSD::Exec, FreeBSD::Pkg, Mac::Exec, Mac::Group, Mac::Pkg, Mac::User, PSWindows::Exec, PSWindows::File, PSWindows::Group, PSWindows::Pkg, PSWindows::User, Unix::Exec, Unix::File, Unix::Group, Unix::Pkg, Unix::User, Windows::Exec, Windows::File, Windows::Group, Windows::Pkg, Windows::User
- Defined in:
- lib/beaker/command_factory.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#execute(command, options = {}) ⇒ String
private
Helper to create & run commands.
- #fail_test(msg) ⇒ Object
Instance Attribute Details
#assertions ⇒ Object
15 16 17 |
# File 'lib/beaker/command_factory.rb', line 15 def assertions @assertions || 0 end |
Instance Method Details
#execute(command, options = {}) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Note:
Host#exec gets passed a duplicate of the options hash argument.
Note:
Beaker::Command#initialize gets passed selected options from the options hash argument. Specifically, :prepend_cmds & :cmdexe.
Helper to create & run commands
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/beaker/command_factory.rb', line 31 def execute(command, = {}) = {} exec_opts = .dup [:prepend_cmds] = exec_opts.delete(:prepend_cmds) || nil [:cmdexe] = exec_opts.delete(:cmdexe) || false result = self.exec(Command.new(command, [], ), exec_opts) if block_given? yield result else result.stdout.chomp end end |
#fail_test(msg) ⇒ Object
45 46 47 |
# File 'lib/beaker/command_factory.rb', line 45 def fail_test(msg) assert(false, msg) end |