Sha256: db15b05744de120ec3c3502700e46af4254e7994d2ab72401abfa11fc1a86061
Contents?: true
Size: 712 Bytes
Versions: 3
Compression:
Stored size: 712 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 "\t#{cmd}" if $verbose ret='' unless $dry ret = `#{cmd}` if $?.exitstatus != 0 ## return failure err=CommandError.new "Error Running:\t #{cmd}" err.command_output = ret err.return_code = $?.exitstatus raise err end end ret end def exit!(msg='Aborting') puts msg Kernel.exit 1 end end #module
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
devinstall-1.2.3 | lib/devinstall/utils.rb |
devinstall-1.2.2 | lib/devinstall/utils.rb |
devinstall-1.2.1 | lib/devinstall/utils.rb |