bio-commandeer 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/bio-commandeer/commandeer.rb +7 -4
- data/spec/bio-commandeer_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df4baa9e79d6744596ddb0d4f9549b131698cce6
|
4
|
+
data.tar.gz: 28b5b0e5f6813c5d61adba3ad0a4b1cda7dac555
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 333ee2f7fc6eb5b5ba24bc31ecc13cf1790e1a99a4e5719f5bdfcfd77617428d8ef071729d8b8ddd004a4bb669e6aaa100a3a2e12ab3cfa788992c81a528d202
|
7
|
+
data.tar.gz: f94154012f7505943ae437283fb79a37c0eb2a8a629ad6b85b1307b2af10e5bbbfa4847d76890d285d04bb2c9eae1731a6842fcac2d1dceadfeec797987ff4a4
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -11,10 +11,7 @@ module Bio
|
|
11
11
|
# :log: if true, turn on logging. If given an object use it as the logger
|
12
12
|
def self.run(command, options={})
|
13
13
|
obj = run_to_finish(command, options)
|
14
|
-
|
15
|
-
if obj.status.exitstatus != 0
|
16
|
-
raise Bio::CommandFailedException, "Command returned non-zero exit status (#{obj.status.exitstatus}), likely indicating failure. Command run was #{command} and the STDERR was:\n#{obj.stderr}\nSTDOUT was: #{obj.stdout}"
|
17
|
-
end
|
14
|
+
obj.raise_if_failed
|
18
15
|
|
19
16
|
return obj.stdout
|
20
17
|
end
|
@@ -48,6 +45,12 @@ module Bio
|
|
48
45
|
|
49
46
|
class CommandResult
|
50
47
|
attr_accessor :stdout, :stderr, :command, :status
|
48
|
+
|
49
|
+
def raise_if_failed
|
50
|
+
if @status.exitstatus != 0
|
51
|
+
raise Bio::CommandFailedException, "Command returned non-zero exit status (#{@status.exitstatus}), likely indicating failure. Command run was #{@command} and the STDERR was:\n#{@stderr}\nSTDOUT was: #{@stdout}"
|
52
|
+
end
|
53
|
+
end
|
51
54
|
end
|
52
55
|
|
53
56
|
class CommandFailedException < Exception; end
|
data/spec/bio-commandeer_spec.rb
CHANGED
@@ -59,4 +59,9 @@ describe "BioCommandeer" do
|
|
59
59
|
expect(obj.stderr).to eq "cat: /definitelyNotAFile: No such file or directory\n"
|
60
60
|
expect(obj.command).to eq "cat /definitelyNotAFile"
|
61
61
|
end
|
62
|
+
|
63
|
+
it 'should raise if failed' do
|
64
|
+
obj = Bio::Commandeer.run_to_finish("cat /definitelyNotAFile")
|
65
|
+
expect{obj.raise_if_failed}.to raise_error(Bio::CommandFailedException)
|
66
|
+
end
|
62
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-commandeer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben J. Woodcroft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bio-logger
|