Sha256: b66e773382b8dbbf6f0cebcbad69b48a8c67fa24b50c0ebbfc7b31af6621b3b3
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module Superhosting module Helper module Cmd def command!(*command_args, **kwargs) self._command(*command_args, **kwargs) do |cmd| raise NetStatus::Exception.new(error: :error, code: :command_with_error, data: { error: [cmd.stdout, cmd.stderr].join("\n") }) end end def command(*command_args, **kwargs) self._command(command_args, **kwargs) end def _command(*command_args, debug: true, logger: nil, &b) self.with_logger(logger: logger) do desc = { code: :command, data: { command: command_args.join } } if debug self.debug_operation(desc: desc) do |&blk| self._command_without_debug(*command_args, &b) blk.call(code: :ok) end else self._command_without_debug(*command_args, &b) end {} # net_status end end def _command_without_debug(*command_args) self.with_dry_run do |dry_run| unless dry_run cmd = Mixlib::ShellOut.new(*command_args) cmd.run_command yield cmd if block_given? and !cmd.status.success? end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
superhosting-0.0.2 | lib/superhosting/helper/cmd.rb |