RunIt 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/RunIt.rb +13 -13
- metadata +5 -5
data/Gemfile.lock
CHANGED
data/lib/RunIt.rb
CHANGED
@@ -27,7 +27,7 @@ require 'ostruct'
|
|
27
27
|
class RunIt
|
28
28
|
|
29
29
|
# Version
|
30
|
-
VERSION = "1.0.
|
30
|
+
VERSION = "1.0.1"
|
31
31
|
|
32
32
|
# cmd:: set/get the command to execute
|
33
33
|
attr_accessor :cmd
|
@@ -67,7 +67,7 @@ class RunIt
|
|
67
67
|
def initialize(cmd, input=nil)
|
68
68
|
self.cmd = cmd
|
69
69
|
self.input = input
|
70
|
-
|
70
|
+
@result = nil
|
71
71
|
@@mock = false
|
72
72
|
end
|
73
73
|
|
@@ -78,16 +78,16 @@ class RunIt
|
|
78
78
|
|
79
79
|
if @@mock
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
@result = OpenStruct.new(:success? => true, :exitstatus => 0)
|
82
|
+
@output = "Command entered: #{self.cmd}"
|
83
|
+
@error = ''
|
84
84
|
return true
|
85
85
|
|
86
86
|
else
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
88
|
+
@output = ''
|
89
|
+
@error = ''
|
90
|
+
@result = nil
|
91
91
|
|
92
92
|
begin
|
93
93
|
|
@@ -95,18 +95,18 @@ class RunIt
|
|
95
95
|
stdin.puts self.input unless self.input.nil?
|
96
96
|
stdin.close
|
97
97
|
until stdout.eof?
|
98
|
-
|
98
|
+
@output << stdout.gets
|
99
99
|
end
|
100
100
|
until stderr.eof?
|
101
|
-
|
101
|
+
@error << stderr.gets
|
102
102
|
end
|
103
|
-
|
103
|
+
@result = wait.value
|
104
104
|
end
|
105
105
|
|
106
106
|
rescue Exception => e
|
107
107
|
|
108
|
-
|
109
|
-
|
108
|
+
@result = OpenStruct.new(:success? => false, :exitstatus => -1)
|
109
|
+
@error << "#{cmd} raised an error: #{e.class}:#{e}"
|
110
110
|
|
111
111
|
end
|
112
112
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RunIt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
segments:
|
111
111
|
- 0
|
112
|
-
hash: -
|
112
|
+
hash: -2807326648539692323
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|
@@ -118,10 +118,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
segments:
|
120
120
|
- 0
|
121
|
-
hash: -
|
121
|
+
hash: -2807326648539692323
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.24
|
125
125
|
signing_key:
|
126
126
|
specification_version: 3
|
127
127
|
summary: A simple class to wrap Open3#popen3
|