guns 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/guns.gemspec +1 -1
- data/lib/guns.rb +15 -3
- metadata +1 -1
data/guns.gemspec
CHANGED
@@ -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.
|
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?"
|
data/lib/guns.rb
CHANGED
@@ -50,9 +50,21 @@ module Guns
|
|
50
50
|
module_function :sh
|
51
51
|
|
52
52
|
def sh!(cmd, *args)
|
53
|
-
|
54
|
-
|
55
|
-
|
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!
|