system_command_helper 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07912a718174390ca7f52102bca47c97655ea5b8
4
- data.tar.gz: 1bad63aa7ececc7812f9235426721748745f295b
3
+ metadata.gz: 094be426f33bd1b99456c42d10f910de289754c8
4
+ data.tar.gz: 7df1f2601254348b60b3c26cd1f8f4a09cd39597
5
5
  SHA512:
6
- metadata.gz: 3d5a4fe6a6795a67903f97052822fd0b82399585859f3d2fedbeb1e05196875cba4cf1c2b9f28fb56a73e16ea1bf7f733c5e132e5efecb4e9900bd940b00d2f0
7
- data.tar.gz: 09e5b9baa517bda4c1dfd5028f63f75173b7c98a74b79e66694403f47537761954a9a4643e21a8bcbf680c032b2a4351a68c490ac1846b913ae1ddfe528a141b
6
+ metadata.gz: 7c09d24440cf28ddca0247082f840b66348853a1ddec24b8c1ab0a13f6a27941a6ddc6d6700163cd3925e986014c9ad5c9b6c342655555d9416c28fcd98fadc0
7
+ data.tar.gz: 4d0f2eec67667d907951fb528bfad02c1bb8638abb02917211908fdb8bc23d496cfa439f1175bd035dcaf861842a9d9410c35d1dab0b9912543928e11f625660
@@ -3,29 +3,33 @@ require "system_command_helper/version"
3
3
  module SystemCommandHelper
4
4
  attr_accessor :no_exec, :quiet
5
5
 
6
+ @@no_exec = false
7
+ @@quiet = false
8
+ @@on_error = nil
9
+
6
10
  def sys(cmd)
7
- unless @quiet
11
+ unless @@quiet
8
12
  puts "\e[35m#{Dir.pwd}$\e[0m #{cmd}"
9
13
  end
10
- unless @no_exec
14
+ unless @@no_exec
11
15
  result = system cmd
12
- if !result && @on_error
13
- @on_error.call(cmd, result)
16
+ if !result && @@on_error
17
+ @@on_error.call(cmd, result)
14
18
  end
15
19
  result
16
20
  end
17
21
  end
18
22
 
19
23
  def cap(cmd)
20
- unless @quiet
24
+ unless @@quiet
21
25
  puts "\e[35m#{Dir.pwd}$\e[0m `#{cmd}`"
22
26
  end
23
- unless @no_exec
27
+ unless @@no_exec
24
28
  `#{cmd}`
25
29
  end
26
30
  end
27
31
 
28
32
  def on_error(&block)
29
- @on_error = block
33
+ @@on_error = block
30
34
  end
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module SystemCommandHelper
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: system_command_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Narazaka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-23 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler