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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/command.rb +13 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ba796e5048a64e2b520720283850e771417af10
4
- data.tar.gz: 24ca4fd01762a1a48f6df4ec6bb7332d6ebd2488
3
+ metadata.gz: 7d2f33d43fe9f2fd56a26bbf07a2a5a1c930f608
4
+ data.tar.gz: 43b67c8923bf42129f1c186db42cf98f6a9cf752
5
5
  SHA512:
6
- metadata.gz: 81af5cce3f8f0141004467a78b25eb5b155889c34c2ebf46890812fd90c614926d27553ff5f355f3c29e44d9d45ced3163e8163f15cde478a016f8651e91e946
7
- data.tar.gz: 820419d439ccac4fb9f44750bca31ac7478add38942f993c103b6d9b0ed5fa9a0c0294e4363d6936d4b2c686d096c8a0fdfc38f4db5eed70461e687445e39ec0
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
- self[:output],self[:error],status= Open3.capture3(self[:input])
57
- self[:exit_code]=status.to_i
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
- puts ' '
72
- puts "exit_code=#{self[:exit_code]}"
73
- puts ' '
74
- puts self[:output]
75
- puts self[:error]
76
- puts ' '
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow