nrser 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nrser/exec.rb +28 -1
- data/lib/nrser/version.rb +1 -1
- 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: 385b44525f971891d33ea5f79bed8bb753d56cdd
|
4
|
+
data.tar.gz: 175428eb1a8544148606e3f75813b23bb0e3b80b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 634f88d8cb06dcb733667b1234e5e4b8a296f0f426ecd22de23d2eb19d83b713f0440ce63011fdcaf4b67a92ef333587a4f74750eca6c690b4ea578464948883
|
7
|
+
data.tar.gz: b696d80c061d3d6f570e0192636763b80f468c873f698181b3db691cd4664451dc2067cb230fca573d5d17b5d72627f6b7c4e127d02a379152ca829b39b6beae
|
data/lib/nrser/exec.rb
CHANGED
@@ -3,6 +3,27 @@ require 'nrser'
|
|
3
3
|
using NRSER
|
4
4
|
|
5
5
|
module NRSER::Exec
|
6
|
+
class Result
|
7
|
+
attr_reader :cmd, :exitstatus, :output
|
8
|
+
|
9
|
+
def initialize cmd, exitstatus, output
|
10
|
+
@cmd = cmd
|
11
|
+
@exitstatus = exitstatus
|
12
|
+
@output = output
|
13
|
+
end
|
14
|
+
|
15
|
+
def raise_error
|
16
|
+
raise SystemCallError.new <<-BLOCK.unblock, @exitstatus
|
17
|
+
cmd `#{ @cmd }` failed with status #{ @exitstatus }
|
18
|
+
and output #{ @output.inspect }
|
19
|
+
BLOCK
|
20
|
+
end
|
21
|
+
|
22
|
+
def success?
|
23
|
+
@exitstatus == 0
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
6
27
|
# substitute stuff into a shell command after escaping with
|
7
28
|
# `Shellwords.escape`.
|
8
29
|
#
|
@@ -49,5 +70,11 @@ module NRSER::Exec
|
|
49
70
|
and output #{ output.inspect }
|
50
71
|
BLOCK
|
51
72
|
end
|
52
|
-
end # ::
|
73
|
+
end # ::run
|
74
|
+
|
75
|
+
def self.result cmd, subs = nil
|
76
|
+
cmd = sub(cmd, subs) unless subs.nil?
|
77
|
+
output = `#{ cmd } 2>&1`
|
78
|
+
Result.new cmd, $?.exitstatus, output
|
79
|
+
end # ::result
|
53
80
|
end
|
data/lib/nrser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nrser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nrser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|