Sha256: af36d6f048b3b5301d55801856d3750227bd3932f0f45e8825b8cb5596c71d92
Contents?: true
Size: 709 Bytes
Versions: 1
Compression:
Stored size: 709 Bytes
Contents
module Utils class CommandError < RuntimeError attr_accessor :command_output, :return_code def verbose_message if $verbose puts self.message puts '#'*20 puts self.command_output puts '#'*20 puts "Exit code: #{self.return_code}" end end end def command(cmd) puts cmd if $verbose ret='' unless $dry ret = `#{cmd}` if $?.exitstatus != 0 ## return failure err=CommandError.new "ErrorRunning #{cmd}" err.command_output = ret err.return_code = $?.exitstatus raise err end end ret end def exit!(msg=nil) puts msg || 'Aborting!' Kernel.exit 1 end end #module
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devinstall-1.0.1 | lib/devinstall/utils.rb |