bio-commandeer 0.2.0 → 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: 386271eaa4c39b91d6a3a76891dd64b3ad8d1744
4
- data.tar.gz: 56b7ee0ac4061f603d4c41491b5b81d968cd9332
3
+ metadata.gz: df4baa9e79d6744596ddb0d4f9549b131698cce6
4
+ data.tar.gz: 28b5b0e5f6813c5d61adba3ad0a4b1cda7dac555
5
5
  SHA512:
6
- metadata.gz: 17cfb131f6887eabf59776676610a6f1c9c39d2c8ba7c63e3179c2e53e4b25d85de44e371d2c1c30ff27c513469ce4a5938e9da8441e901010ce1e4a25faeea7
7
- data.tar.gz: fdba58dd87e0e144a108d8e454d0d194c9ebee19bb1e1d80700421291070bffebc151ddbd78ff9c4beaff472c04c96a719598d303f613fa8156ed18955da6597
6
+ metadata.gz: 333ee2f7fc6eb5b5ba24bc31ecc13cf1790e1a99a4e5719f5bdfcfd77617428d8ef071729d8b8ddd004a4bb669e6aaa100a3a2e12ab3cfa788992c81a528d202
7
+ data.tar.gz: f94154012f7505943ae437283fb79a37c0eb2a8a629ad6b85b1307b2af10e5bbbfa4847d76890d285d04bb2c9eae1731a6842fcac2d1dceadfeec797987ff4a4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.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
@@ -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.2.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-01 00:00:00.000000000 Z
11
+ date: 2017-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio-logger