em-systemcommand 1.0.1 → 1.0.2
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.
- data/README.md +3 -3
- data/lib/em-systemcommand/pipe.rb +1 -0
- data/lib/em-systemcommand/version.rb +1 -1
- data/spec/em-systmcommand_spec.rb +31 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -25,7 +25,7 @@ To simply run a process you can instatiate an `EM::SystemCommand`
|
|
25
25
|
object and set up the callbacks in the yielded block.
|
26
26
|
|
27
27
|
EM.run do
|
28
|
-
EM::SystemCommand 'my_command' do |on|
|
28
|
+
EM::SystemCommand.execute 'my_command' do |on|
|
29
29
|
on.success do |ps|
|
30
30
|
puts "Success!"
|
31
31
|
end
|
@@ -40,7 +40,7 @@ When you want to retreive output, you can use the methods
|
|
40
40
|
`#update`, `#line` and `#data` on a pipe object like so:
|
41
41
|
|
42
42
|
EM.run do
|
43
|
-
EM::SystemCommand 'my_command' do |on|
|
43
|
+
EM::SystemCommand.execute 'my_command' do |on|
|
44
44
|
on.success do |ps|
|
45
45
|
puts "Success!"
|
46
46
|
end
|
@@ -66,7 +66,7 @@ When you want to retreive output, you can use the methods
|
|
66
66
|
you match output against a regular expression:
|
67
67
|
|
68
68
|
EM.run do
|
69
|
-
EM::SystemCommand 'echo "25%\n"; sleep 1; echo "50%\n"; sleep 1; echo "75%\n"; sleep 1; echo "100%\n"; exit 0;' do |on|
|
69
|
+
EM::SystemCommand.execute 'echo "25%\n"; sleep 1; echo "50%\n"; sleep 1; echo "75%\n"; sleep 1; echo "100%\n"; exit 0;' do |on|
|
70
70
|
on.success do |ps|
|
71
71
|
puts "Success!"
|
72
72
|
end
|
@@ -106,4 +106,35 @@ describe EM::SystemCommand do
|
|
106
106
|
}
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
it 'should pass multiple command executions', focus: true do
|
111
|
+
counter = 0
|
112
|
+
EM.run do
|
113
|
+
2.times do
|
114
|
+
EM::SystemCommand.execute 'ls' do |on|
|
115
|
+
on.success do
|
116
|
+
2.times do
|
117
|
+
EM::SystemCommand.execute 'ls' do |on2|
|
118
|
+
on2.success do
|
119
|
+
if counter >= 3
|
120
|
+
EM.stop_event_loop
|
121
|
+
else
|
122
|
+
counter += 1
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
on2.failure do
|
127
|
+
if counter >= 3
|
128
|
+
EM.stop_event_loop
|
129
|
+
else
|
130
|
+
counter += 1
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
109
140
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-systemcommand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
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: 2012-
|
12
|
+
date: 2012-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
segments:
|
149
149
|
- 0
|
150
|
-
hash:
|
150
|
+
hash: 1875739728938098131
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
153
153
|
requirements:
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
segments:
|
158
158
|
- 0
|
159
|
-
hash:
|
159
|
+
hash: 1875739728938098131
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
162
|
rubygems_version: 1.8.24
|