guns 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/guns.gemspec +1 -1
  2. data/lib/guns.rb +15 -3
  3. metadata +1 -1
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'guns'
6
- s.version = '0.1.3'
6
+ s.version = '0.1.4'
7
7
  s.date = '2009-10-30'
8
8
 
9
9
  s.description = "Guns - It's got two pipes; got tickets to the show?"
@@ -50,9 +50,21 @@ module Guns
50
50
  module_function :sh
51
51
 
52
52
  def sh!(cmd, *args)
53
- out, err, code = sh(cmd, *args)
54
- cmd << " " << args.join(" ") if !args.empty?
55
- raise Failure, "(#{cmd})\n#{err}" if code != 0
53
+ env = args.pop if args.last.kind_of?(Hash)
54
+ env ||= {}
55
+ out, err, code = sh(cmd, *(args + [env]))
56
+ if code != 0
57
+ cmd << " " << args.join(" ") if !args.empty?
58
+ said = []
59
+ said << out if !out.empty?
60
+ said << err if !err.empty?
61
+ said = said.join "\n"
62
+ if !env.empty?
63
+ envs = env.map {|a| a * "=" }.join(" ")
64
+ cmd = envs << " " << cmd
65
+ end
66
+ raise Failure, "(#{cmd})\n#{said}}"
67
+ end
56
68
  [out, err, code]
57
69
  end
58
70
  module_function :sh!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany