dev_commands 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/command.rb +13 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d2f33d43fe9f2fd56a26bbf07a2a5a1c930f608
|
4
|
+
data.tar.gz: 43b67c8923bf42129f1c186db42cf98f6a9cf752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3fa1d8f8f987acdd988a27dc3a8de95aeb3047cef5983412c80914b54806fe0ba70c6cced0922f8134a76aa9ddeafc99e05558124126963678752361c1d5dbd
|
7
|
+
data.tar.gz: d9cebdf56480155b5e23dbffd49bae4406df5f635c0f9bed2d4a8aee7d41cd672f5ecc3aa24620a25849b5401b89e633d49280b81be1f91c4903f9bb4844ccf1
|
data/lib/command.rb
CHANGED
@@ -29,7 +29,7 @@ class Command < Hash
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def execute
|
32
|
-
puts "#{self[:input]}"
|
32
|
+
puts "#{self[:input]}" if(!self.has_key?(:quiet) || self[:quiet])
|
33
33
|
pwd=Dir.pwd
|
34
34
|
Dir.chdir(self[:directory]) if(self.has_key?(:directory) && File.exists?(self[:directory]))
|
35
35
|
self[:directory] = pwd if(self[:directory].length==0)
|
@@ -53,8 +53,8 @@ class Command < Hash
|
|
53
53
|
self[:end_time] = Time.now
|
54
54
|
else
|
55
55
|
begin
|
56
|
-
|
57
|
-
|
56
|
+
self[:output],self[:error],status= Open3.capture3(self[:input])
|
57
|
+
self[:exit_code]=status.to_i
|
58
58
|
self[:elapsed] = timer.elapsed_str
|
59
59
|
self[:end_time] = Time.now
|
60
60
|
rescue Exception => e
|
@@ -68,12 +68,14 @@ class Command < Hash
|
|
68
68
|
Dir.chdir(pwd) if pwd != Dir.pwd
|
69
69
|
|
70
70
|
if(self[:exit_code] != 0)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
if(!self.has_key?(:quiet) || self[:quiet])
|
72
|
+
puts ' '
|
73
|
+
puts "exit_code=#{self[:exit_code]}"
|
74
|
+
puts ' '
|
75
|
+
puts self[:output]
|
76
|
+
puts self[:error]
|
77
|
+
puts ' '
|
78
|
+
end
|
77
79
|
if(!self.has_key?(:ignore_failure) || !self[:ignore_failure])
|
78
80
|
raise "#{self[:input]} failed"
|
79
81
|
end #unless (self.has_key?(:ignore_failure) && self[:ignore_failure]==true)
|
@@ -97,6 +99,7 @@ class Command < Hash
|
|
97
99
|
def self.exit_code command
|
98
100
|
cmd = Command.new(command)
|
99
101
|
cmd[:ignore_failure]=true
|
102
|
+
cmd[:quiet]=true
|
100
103
|
cmd.execute
|
101
104
|
cmd[:exit_code]
|
102
105
|
end
|
@@ -104,6 +107,7 @@ class Command < Hash
|
|
104
107
|
def self.output command
|
105
108
|
cmd = Command.new(command)
|
106
109
|
cmd[:ignore_failure]=true
|
110
|
+
cmd[:quiet]=true
|
107
111
|
cmd.execute
|
108
112
|
cmd[:output]
|
109
113
|
end
|