komenda 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/komenda/process.rb +3 -0
- data/lib/komenda/process_builder.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5776b8baf0623308ba5d91c4af70d4de9e6a63c6
|
4
|
+
data.tar.gz: de78e64e458c3d8efe96cecbb630c7e5fb6274b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1644ff0df3f0e8954c6e9b81a736ae37763dc4a8efd0dd78bcab82d43048020d409a44a2fdbb2e131376224465e441b2122efdd040c5b314bfe7f158b5b0d206
|
7
|
+
data.tar.gz: 82d702d169daebb599300567684df3272d8c5aa3cd3fcbdf0e1cee2fec22aff15a1a7ccca596a82801a3196e9d9f712942bffbcc4f0703fa8d080a5ad2069a40
|
data/README.md
CHANGED
@@ -34,6 +34,7 @@ The `run()` method has a second argument `options`, which accepts these optional
|
|
34
34
|
- **`env`** (Hash): Additional environment variables to set.
|
35
35
|
- **`use_bundler_env`** (Boolean): Use the environment variable of the current [bundle](http://bundler.io/). Defaults to `false`.
|
36
36
|
- **`cwd`** (String): Directory to change to before running the process.
|
37
|
+
- **`fail_on_fail`** (Boolean): Whether to raise an error when the exit code is not "0". Defaults to `false`.
|
37
38
|
|
38
39
|
### Advanced usage
|
39
40
|
The `create()` method creates a `Process` which can be `run()` (or `start()`ed as a Thread).
|
data/lib/komenda/process.rb
CHANGED
@@ -28,6 +28,9 @@ module Komenda
|
|
28
28
|
def wait_for
|
29
29
|
fail 'Process not started' unless started?
|
30
30
|
@thread.join
|
31
|
+
if @process_builder.fail_on_fail && !result.success?
|
32
|
+
fail "Process failed with exit status `#{result.exitstatus}` and output:\n#{result.output}"
|
33
|
+
end
|
31
34
|
result
|
32
35
|
end
|
33
36
|
|
@@ -5,6 +5,7 @@ module Komenda
|
|
5
5
|
attr_reader :env
|
6
6
|
attr_reader :use_bundler_env
|
7
7
|
attr_reader :cwd
|
8
|
+
attr_reader :fail_on_fail
|
8
9
|
attr_reader :events
|
9
10
|
|
10
11
|
# @param [String, String[]] command
|
@@ -14,6 +15,7 @@ module Komenda
|
|
14
15
|
env: {},
|
15
16
|
use_bundler_env: false,
|
16
17
|
cwd: nil,
|
18
|
+
fail_on_fail: false,
|
17
19
|
events: {}
|
18
20
|
}
|
19
21
|
options = defaults.merge(options)
|
@@ -22,6 +24,7 @@ module Komenda
|
|
22
24
|
self.env = options[:env]
|
23
25
|
self.use_bundler_env = options[:use_bundler_env]
|
24
26
|
self.cwd = options[:cwd]
|
27
|
+
self.fail_on_fail = options[:fail_on_fail]
|
25
28
|
self.events = options[:events]
|
26
29
|
end
|
27
30
|
|
@@ -54,6 +57,11 @@ module Komenda
|
|
54
57
|
@cwd = cwd.nil? ? nil : String(cwd)
|
55
58
|
end
|
56
59
|
|
60
|
+
# @param [Boolean] fail_on_fail
|
61
|
+
def fail_on_fail=(fail_on_fail)
|
62
|
+
@fail_on_fail = fail_on_fail ? true : false
|
63
|
+
end
|
64
|
+
|
57
65
|
# @param [Hash<Symbol, Proc>]
|
58
66
|
def events=(events)
|
59
67
|
@events = Hash[events.to_hash.map { |k, v| [k.to_sym, v.to_proc] }]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: komenda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cargo Media
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: events
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.6.2
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Convenience wrapper around `Open3` to run shell commands in Ruby.
|