aruba 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.md +7 -2
- data/LICENSE +1 -1
- data/README.md +100 -44
- data/aruba.gemspec +2 -2
- data/cucumber.yml +2 -2
- data/features/custom_ruby_process.feature +12 -0
- data/features/exit_statuses.feature +2 -2
- data/features/interactive.feature +1 -1
- data/features/support/custom_main.rb +24 -0
- data/lib/aruba.rb +8 -1
- data/lib/aruba/api.rb +14 -12
- data/lib/aruba/cucumber/hooks.rb +1 -0
- data/lib/aruba/in_process.rb +51 -0
- data/lib/aruba/reporting.rb +2 -2
- data/lib/aruba/{process.rb → spawn_process.rb} +15 -19
- data/spec/aruba/{process_spec.rb → spawn_process_spec.rb} +8 -8
- metadata +93 -175
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c32a3208631d64e4bb80c234b0631c7747f9e173
|
4
|
+
data.tar.gz: c8badeb14b86f1e2c1654127a2042adbdf223614
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02ccf28c607e88a1216c32c30c52dd8414fb4f26b19035378c7a891587148aa147223e4d1eb24204742a1097a3e168628201d6009f4a2198d5b2b73a1486b627
|
7
|
+
data.tar.gz: ea7267f34b7e1a6352d84377b58500554dcf5b9d6af94d0b2593224e5413932d5c534270b80512dfec76501d161f6fa7e331d96c36d73d4c40b056095a898e89
|
data/History.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
## [v0.5.
|
1
|
+
## [v0.5.2](https://github.com/cucumber/aruba/compare/v0.5.1..v0.5.2)
|
2
|
+
|
3
|
+
* Plugin API for greater speed. Test Ruby CLI programs in a single Ruby process (#148 Aslak Hellesøy)
|
4
|
+
* Fix memory leak when several commands are executed in a single run (#144 @y-higuchi)
|
5
|
+
|
6
|
+
## [v0.5.1](https://github.com/cucumber/aruba/compare/v0.5.0..v0.5.1)
|
2
7
|
* Individual timeout settings when running commands (#124 Jarl Friis)
|
3
8
|
* Varous fixes for JRuby tests, should now work on more versions of JRuby
|
4
9
|
|
5
|
-
## [v0.5](https://github.com/cucumber/aruba/compare/v0.4.10..v0.5)
|
10
|
+
## [v0.5.0](https://github.com/cucumber/aruba/compare/v0.4.10..v0.5.0)
|
6
11
|
* Add #with_file_content to the DSL (#110 Pavel Argentov)
|
7
12
|
* Make JRuby performance tweaks optional (#102 Taylor Carpenter, #125 Andy Lindeman)
|
8
13
|
* Add assert_partial_output_interactive so you can peek at the output from a running process (#104 Taylor Carpenter)
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010 Aslak Hellesøy, David Chelimsky
|
1
|
+
Copyright (c) 2010,2011,2012,2013 Aslak Hellesøy, David Chelimsky and Mike Sassak
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -14,7 +14,9 @@ If you have a `Gemfile`, add `aruba`. Otherwise, install it like this:
|
|
14
14
|
|
15
15
|
Then, `require` the library in one of your ruby files under `features/support` (e.g. `env.rb`)
|
16
16
|
|
17
|
-
|
17
|
+
```ruby
|
18
|
+
require 'aruba/cucumber'
|
19
|
+
```
|
18
20
|
|
19
21
|
You now have a bunch of step definitions that you can use in your features. Look at `lib/aruba/cucumber.rb`
|
20
22
|
to see them all. Look at `features/*.feature` for examples (which are also testing Aruba
|
@@ -29,10 +31,11 @@ Aruba has some default behaviour that you can change if you need to.
|
|
29
31
|
Per default Aruba will create a directory `tmp/aruba` where it performs its file operations.
|
30
32
|
If you want to change this behaviour put this into your `features/support/env.rb`:
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
```ruby
|
35
|
+
Before do
|
36
|
+
@dirs = ["somewhere/else"]
|
37
|
+
end
|
38
|
+
```
|
36
39
|
|
37
40
|
### Modify the PATH
|
38
41
|
|
@@ -42,15 +45,17 @@ can test those commands as though the gem were already installed.
|
|
42
45
|
|
43
46
|
If you need other directories to be added to the `PATH`, you can put the following in `features/support/env.rb`:
|
44
47
|
|
45
|
-
ENV['PATH'] = "/my/special/bin/path
|
48
|
+
ENV['PATH'] = "/my/special/bin/path#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
46
49
|
|
47
50
|
### Increasing timeouts
|
48
51
|
|
49
52
|
A process sometimes takes longer than expected to terminate, and Aruba will kill them off (and fail your scenario) if it is still alive after 3 seconds. If you need more time you can modify the timeout by assigning a different value to `@aruba_timeout_seconds` in a `Before` block:
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
```ruby
|
55
|
+
Before do
|
56
|
+
@aruba_timeout_seconds = 5
|
57
|
+
end
|
58
|
+
```
|
54
59
|
|
55
60
|
### Increasing IO wait time
|
56
61
|
|
@@ -59,9 +64,11 @@ but the interactive process has not yet flushed or read some content. To help pr
|
|
59
64
|
before reading or writing to the process if it is still running. You can control the wait by setting
|
60
65
|
`@aruba_io_wait_seconds` to an appropriate value. This is particularly useful with tags:
|
61
66
|
|
62
|
-
|
63
|
-
|
64
|
-
|
67
|
+
```ruby
|
68
|
+
Before('@slow_process') do
|
69
|
+
@aruba_io_wait_seconds = 5
|
70
|
+
end
|
71
|
+
```
|
65
72
|
|
66
73
|
### Tags
|
67
74
|
|
@@ -101,21 +108,64 @@ make assertions about coloured output. Still, there might be cases where you wan
|
|
101
108
|
scenario with `@ansi`. Alternatively you can add your own Before
|
102
109
|
hook that sets `@aruba_keep_ansi = true`.
|
103
110
|
|
111
|
+
### Testing Ruby CLI programs without spawning a new Ruby process.
|
112
|
+
|
113
|
+
If your CLI program is written in Ruby you can speed up your suite of scenarios by running
|
114
|
+
your CLI in the same process as Cucumber/Aruba itself. In order to be able to do this, the
|
115
|
+
entry point for your CLI application must be a class that has a constructor with a particular
|
116
|
+
signature and an `execute!` method:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
class MyMain
|
120
|
+
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
|
121
|
+
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
|
122
|
+
end
|
123
|
+
|
124
|
+
def execute!
|
125
|
+
# your code here, assign a value to exitstatus
|
126
|
+
@kernel.exit(exitstatus)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
```
|
130
|
+
|
131
|
+
Your `bin/something` executable would look something like the following:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
require 'my_main'
|
135
|
+
MyMain.new(ARGV.dup).execute!
|
136
|
+
```
|
137
|
+
|
138
|
+
Then wire it all up in your `features/support/env.rb` file:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
require 'aruba'
|
142
|
+
require 'aruba/in_process'
|
143
|
+
|
144
|
+
Aruba::InProcess.main_class = MyMain
|
145
|
+
Aruba.process = Aruba::InProcess
|
146
|
+
```
|
147
|
+
|
148
|
+
That's it! Everything will now run inside the same ruby process, making your suite
|
149
|
+
a lot faster. Cucumber itself uses this approach to test itself, so check out the
|
150
|
+
Cucumber source code for an example.
|
151
|
+
|
104
152
|
### JRuby Tips
|
105
153
|
|
106
154
|
Improve startup time by disabling JIT and forcing client JVM mode. This can be accomplished by adding
|
107
155
|
|
108
|
-
|
156
|
+
```ruby
|
157
|
+
require 'aruba/jruby'
|
158
|
+
```
|
109
159
|
|
110
160
|
or setting a hook like this example:
|
111
161
|
|
112
|
-
```
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
162
|
+
```ruby
|
163
|
+
Aruba.configure do |config|
|
164
|
+
config.before_cmd do |cmd|
|
165
|
+
set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
|
166
|
+
set_env('JAVA_OPTS', "-d32 #{ENV['JAVA_OPTS']}") # force jRuby to use client JVM for faster startup times
|
167
|
+
end
|
168
|
+
end if RUBY_PLATFORM == 'java'
|
119
169
|
```
|
120
170
|
|
121
171
|
*Note* - no conflict resolution on the JAVA/JRuby environment options is
|
@@ -124,10 +174,10 @@ environment variables in the hook or externally.
|
|
124
174
|
|
125
175
|
A larger process timeout for java may be needed
|
126
176
|
|
127
|
-
```
|
128
|
-
|
129
|
-
|
130
|
-
|
177
|
+
```ruby
|
178
|
+
Before do
|
179
|
+
@aruba_timeout_seconds = RUBY_PLATFORM == 'java' ? 60 : 10
|
180
|
+
end
|
131
181
|
```
|
132
182
|
|
133
183
|
Refer to http://blog.headius.com/2010/03/jruby-startup-time-tips.html for other tips on startup time.
|
@@ -162,34 +212,40 @@ as css, javascript and images. All of these files will be copied over to the rep
|
|
162
212
|
There are some edge cases where Gherkin and Markdown don't agree. Bullet lists using `*` is one example. The `*` is also an alias for
|
163
213
|
step keywords in Gherkin. Markdown headers (the kind starting with a `#`) is another example. They are parsed as comments by Gherkin. To use either of these, just escape them with a backslash. So instead of writing:
|
164
214
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
215
|
+
```gherkin
|
216
|
+
Scenario: Make tea
|
217
|
+
## Making tea
|
218
|
+
* Get a pot
|
219
|
+
* And some hot water
|
220
|
+
|
221
|
+
Given...
|
222
|
+
```
|
171
223
|
|
172
224
|
You'd write:
|
173
225
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
226
|
+
```gherkin
|
227
|
+
Scenario: Make tea
|
228
|
+
\## Making tea
|
229
|
+
\* Get a pot
|
230
|
+
\* And some hot water
|
231
|
+
|
232
|
+
Given...
|
233
|
+
```
|
180
234
|
|
181
235
|
This way Gherkin won't recognize these lines as special tokens, and the reporter will render them as Markdown. (The reporter strips
|
182
236
|
away any leading the backslashes before handing it off to the Markdown parser).
|
183
237
|
|
184
238
|
Another option is to use alternative Markdown syntax and omit conflicts and escaping altogether:
|
185
239
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
240
|
+
```gherkin
|
241
|
+
Scenario: Make tea
|
242
|
+
Making tea
|
243
|
+
----------
|
244
|
+
- Get a pot
|
245
|
+
- And some hot water
|
246
|
+
|
247
|
+
Given...
|
248
|
+
```
|
193
249
|
|
194
250
|
## Note on Patches/Pull Requests
|
195
251
|
|
@@ -203,4 +259,4 @@ Another option is to use alternative Markdown syntax and omit conflicts and esca
|
|
203
259
|
|
204
260
|
## Copyright
|
205
261
|
|
206
|
-
Copyright (c) 2010,2011 Aslak Hellesøy, David Chelimsky and Mike Sassak. See LICENSE for details.
|
262
|
+
Copyright (c) 2010,2011,2012,2013 Aslak Hellesøy, David Chelimsky and Mike Sassak. See LICENSE for details.
|
data/aruba.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'aruba'
|
5
|
-
s.version = '0.5.
|
5
|
+
s.version = '0.5.2'
|
6
6
|
s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak", "Matt Wynne"]
|
7
7
|
s.description = 'CLI Steps for Cucumber, hand-crafted for you in Aruba'
|
8
8
|
s.summary = "aruba-#{s.version}"
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.add_runtime_dependency 'childprocess', '~> 0.3.6'
|
14
14
|
s.add_runtime_dependency 'rspec-expectations', '>= 2.7.0'
|
15
15
|
s.add_development_dependency 'bcat', '>= 0.6.1'
|
16
|
-
s.add_development_dependency '
|
16
|
+
s.add_development_dependency 'kramdown', '~> 0.14'
|
17
17
|
s.add_development_dependency 'rake', '>= 0.9.2'
|
18
18
|
s.add_development_dependency 'rspec', '>= 2.7.0'
|
19
19
|
|
data/cucumber.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
<%
|
2
2
|
std_opts = "--color --tags ~@wip"
|
3
|
-
std_opts << " --tags ~@wip-jruby" if defined?(JRUBY_VERSION)
|
3
|
+
std_opts << " --tags ~@wip-jruby-1.6" if defined?(JRUBY_VERSION) && (JRUBY_VERSION < '1.7.0')
|
4
4
|
|
5
5
|
wip_opts = "--color --tags @wip:3"
|
6
|
-
wip_opts = "--color --tags @wip:3,@wip-jruby:3" if defined?(JRUBY_VERSION)
|
6
|
+
wip_opts = "--color --tags @wip:3,@wip-jruby-1.6:3" if defined?(JRUBY_VERSION) && (JRUBY_VERSION < '1.7.0')
|
7
7
|
%>
|
8
8
|
default: <%= std_opts %>
|
9
9
|
wip: --wip <%= wip_opts %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Custom Ruby Process
|
2
|
+
|
3
|
+
Running a lot of scenarios where each scenario uses Aruba
|
4
|
+
to spawn a new ruby process can be time consuming.
|
5
|
+
|
6
|
+
Aruba lets you plug in your own process class that can
|
7
|
+
run a command in the same ruby process as Cucumber/Aruba.
|
8
|
+
|
9
|
+
@in-process
|
10
|
+
Scenario: Run a passing custom process
|
11
|
+
When I run `reverse olleh dlrow`
|
12
|
+
Then the output should contain "hello world"
|
@@ -18,11 +18,11 @@ Feature: exit statuses
|
|
18
18
|
|
19
19
|
Scenario: Successfully run something for a long time
|
20
20
|
Given The default aruba timeout is 0 seconds
|
21
|
-
When I successfully run `
|
21
|
+
When I successfully run `sleep 1` for up to 2 seconds
|
22
22
|
|
23
23
|
Scenario: Unsuccessfully run something that takes too long
|
24
24
|
Given The default aruba timeout is 0 seconds
|
25
|
-
When I do aruba I successfully run `
|
25
|
+
When I do aruba I successfully run `sleep 1`
|
26
26
|
Then aruba should fail with "process still alive after 0 seconds"
|
27
27
|
|
28
28
|
Scenario: Unsuccessfully run something
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'aruba'
|
2
|
+
require 'aruba/spawn_process'
|
3
|
+
require 'aruba/in_process'
|
4
|
+
require 'shellwords'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
class CustomMain
|
8
|
+
def initialize(argv, stdin, stdout, stderr, kernel)
|
9
|
+
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute!
|
13
|
+
@stdout.puts(@argv.map{|arg| arg.reverse}.join(' '))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Before('@in-process') do
|
18
|
+
Aruba::InProcess.main_class = CustomMain
|
19
|
+
Aruba.process = Aruba::InProcess
|
20
|
+
end
|
21
|
+
|
22
|
+
After('~@in-process') do
|
23
|
+
Aruba.process = Aruba::SpawnProcess
|
24
|
+
end
|
data/lib/aruba.rb
CHANGED
data/lib/aruba/api.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'rbconfig'
|
3
3
|
require 'rspec/expectations'
|
4
|
-
require 'aruba
|
4
|
+
require 'aruba'
|
5
5
|
require 'aruba/config'
|
6
6
|
|
7
7
|
module Aruba
|
@@ -144,7 +144,9 @@ module Aruba
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def unescape(string)
|
147
|
-
string.gsub('\n', "\n").gsub('\"', '"').gsub('\e', "\e")
|
147
|
+
string = string.gsub('\n', "\n").gsub('\"', '"').gsub('\e', "\e")
|
148
|
+
string = string.gsub(/\e\[\d+(?>(;\d+)*)m/, '') unless @aruba_keep_ansi
|
149
|
+
string
|
148
150
|
end
|
149
151
|
|
150
152
|
def regexp(string_or_regexp)
|
@@ -153,27 +155,27 @@ module Aruba
|
|
153
155
|
|
154
156
|
def output_from(cmd)
|
155
157
|
cmd = detect_ruby(cmd)
|
156
|
-
get_process(cmd).output
|
158
|
+
get_process(cmd).output
|
157
159
|
end
|
158
160
|
|
159
161
|
def stdout_from(cmd)
|
160
162
|
cmd = detect_ruby(cmd)
|
161
|
-
get_process(cmd).stdout
|
163
|
+
get_process(cmd).stdout
|
162
164
|
end
|
163
165
|
|
164
166
|
def stderr_from(cmd)
|
165
167
|
cmd = detect_ruby(cmd)
|
166
|
-
get_process(cmd).stderr
|
168
|
+
get_process(cmd).stderr
|
167
169
|
end
|
168
170
|
|
169
171
|
def all_stdout
|
170
172
|
stop_processes!
|
171
|
-
only_processes.inject("") { |out, ps| out << ps.stdout
|
173
|
+
only_processes.inject("") { |out, ps| out << ps.stdout }
|
172
174
|
end
|
173
175
|
|
174
176
|
def all_stderr
|
175
177
|
stop_processes!
|
176
|
-
only_processes.inject("") { |out, ps| out << ps.stderr
|
178
|
+
only_processes.inject("") { |out, ps| out << ps.stderr }
|
177
179
|
end
|
178
180
|
|
179
181
|
def all_output
|
@@ -291,7 +293,7 @@ module Aruba
|
|
291
293
|
announcer.dir(Dir.pwd)
|
292
294
|
announcer.cmd(cmd)
|
293
295
|
|
294
|
-
process =
|
296
|
+
process = Aruba.process.new(cmd, timeout, io_wait)
|
295
297
|
register_process(cmd, process)
|
296
298
|
process.run!
|
297
299
|
|
@@ -324,7 +326,7 @@ module Aruba
|
|
324
326
|
end
|
325
327
|
|
326
328
|
def type(input)
|
327
|
-
return eot if "" == input
|
329
|
+
return eot if "" == input
|
328
330
|
_write_interactive(_ensure_newline(input))
|
329
331
|
end
|
330
332
|
|
@@ -338,7 +340,7 @@ module Aruba
|
|
338
340
|
end
|
339
341
|
|
340
342
|
def _read_interactive
|
341
|
-
@interactive.read_stdout
|
343
|
+
@interactive.read_stdout
|
342
344
|
end
|
343
345
|
|
344
346
|
def _ensure_newline(str)
|
@@ -415,11 +417,11 @@ module Aruba
|
|
415
417
|
end
|
416
418
|
|
417
419
|
def stop_process(process)
|
418
|
-
@last_exit_status = process.stop(announcer
|
420
|
+
@last_exit_status = process.stop(announcer)
|
419
421
|
end
|
420
422
|
|
421
423
|
def terminate_process(process)
|
422
|
-
process.terminate
|
424
|
+
process.terminate
|
423
425
|
end
|
424
426
|
|
425
427
|
def announcer
|
data/lib/aruba/cucumber/hooks.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'shellwords'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
module Aruba
|
5
|
+
class InProcess
|
6
|
+
include Shellwords
|
7
|
+
|
8
|
+
class FakeKernel
|
9
|
+
attr_reader :exitstatus
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@exitstatus = 0
|
13
|
+
end
|
14
|
+
|
15
|
+
def exit(exitstatus)
|
16
|
+
@exitstatus = exitstatus
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.main_class=(main_class)
|
21
|
+
@@main_class = main_class
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(cmd, exit_timeout, io_wait)
|
25
|
+
args = shellwords(cmd)
|
26
|
+
@argv = args[1..-1]
|
27
|
+
@stdin = StringIO.new
|
28
|
+
@stdout = StringIO.new
|
29
|
+
@stderr = StringIO.new
|
30
|
+
@kernel = FakeKernel.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def run!(&block)
|
34
|
+
raise "You need to call Aruba::InProcess.main_class = YourMainClass" unless @@main_class
|
35
|
+
@@main_class.new(@argv, @stdin, @stdout, @stderr, @kernel).execute!
|
36
|
+
yield self if block_given?
|
37
|
+
end
|
38
|
+
|
39
|
+
def stop(reader)
|
40
|
+
@kernel.exitstatus
|
41
|
+
end
|
42
|
+
|
43
|
+
def stdout
|
44
|
+
@stdout.string
|
45
|
+
end
|
46
|
+
|
47
|
+
def stderr
|
48
|
+
@stderr.string
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/aruba/reporting.rb
CHANGED
@@ -6,7 +6,7 @@ if(ENV['ARUBA_REPORT_DIR'])
|
|
6
6
|
require 'cgi'
|
7
7
|
require 'bcat/ansi'
|
8
8
|
require 'rdiscount'
|
9
|
-
require 'aruba/
|
9
|
+
require 'aruba/spawn_process'
|
10
10
|
|
11
11
|
module Aruba
|
12
12
|
module Reporting
|
@@ -19,7 +19,7 @@ if(ENV['ARUBA_REPORT_DIR'])
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def pygmentize(file)
|
22
|
-
pygmentize =
|
22
|
+
pygmentize = SpawnProcess.new(%{pygmentize -f html -O encoding=utf-8 "#{file}"}, 3, 0.5)
|
23
23
|
pygmentize.run! do |p|
|
24
24
|
exit_status = p.stop(false)
|
25
25
|
if(exit_status == 0)
|
@@ -4,7 +4,7 @@ require 'shellwords'
|
|
4
4
|
require 'aruba/errors'
|
5
5
|
|
6
6
|
module Aruba
|
7
|
-
class
|
7
|
+
class SpawnProcess
|
8
8
|
include Shellwords
|
9
9
|
|
10
10
|
def initialize(cmd, exit_timeout, io_wait)
|
@@ -36,48 +36,48 @@ module Aruba
|
|
36
36
|
@process.io.stdin
|
37
37
|
end
|
38
38
|
|
39
|
-
def output
|
40
|
-
stdout
|
39
|
+
def output
|
40
|
+
stdout + stderr
|
41
41
|
end
|
42
42
|
|
43
|
-
def stdout
|
43
|
+
def stdout
|
44
44
|
wait_for_io do
|
45
45
|
@out.rewind
|
46
|
-
|
46
|
+
@out.read
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def stderr
|
50
|
+
def stderr
|
51
51
|
wait_for_io do
|
52
52
|
@err.rewind
|
53
|
-
|
53
|
+
@err.read
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def read_stdout
|
57
|
+
def read_stdout
|
58
58
|
wait_for_io do
|
59
59
|
@process.io.stdout.flush
|
60
|
-
|
60
|
+
open(@out.path).read
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
def stop(reader
|
64
|
+
def stop(reader)
|
65
65
|
return @exit_code unless @process
|
66
66
|
unless @process.exited?
|
67
67
|
@process.poll_for_exit(@exit_timeout)
|
68
68
|
end
|
69
|
-
reader.stdout stdout
|
70
|
-
reader.stderr stderr
|
69
|
+
reader.stdout stdout
|
70
|
+
reader.stderr stderr
|
71
71
|
@exit_code = @process.exit_code
|
72
72
|
@process = nil
|
73
73
|
@exit_code
|
74
74
|
end
|
75
75
|
|
76
|
-
def terminate
|
76
|
+
def terminate
|
77
77
|
if @process
|
78
|
-
stdout
|
78
|
+
stdout && stderr # flush output
|
79
79
|
@process.stop
|
80
|
-
stdout
|
80
|
+
stdout && stderr # flush output
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -88,9 +88,5 @@ module Aruba
|
|
88
88
|
yield
|
89
89
|
end
|
90
90
|
|
91
|
-
def filter_ansi(string, keep_ansi)
|
92
|
-
keep_ansi ? string : string.gsub(/\e\[\d+(?>(;\d+)*)m/, '')
|
93
|
-
end
|
94
|
-
|
95
91
|
end
|
96
92
|
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
require 'aruba/
|
1
|
+
require 'aruba/spawn_process'
|
2
2
|
|
3
3
|
module Aruba
|
4
|
-
describe
|
4
|
+
describe SpawnProcess do
|
5
5
|
|
6
|
-
let(:process) {
|
6
|
+
let(:process) { SpawnProcess.new('echo "yo"', 0.1, 0.1) }
|
7
7
|
|
8
8
|
describe "#stdout" do
|
9
9
|
before { process.run! }
|
10
10
|
|
11
11
|
it "returns the stdout" do
|
12
|
-
process.stdout
|
12
|
+
process.stdout.should == "yo\n"
|
13
13
|
end
|
14
14
|
|
15
15
|
it "returns all the stdout, every time you call it" do
|
16
|
-
process.stdout
|
17
|
-
process.stdout
|
16
|
+
process.stdout.should == "yo\n"
|
17
|
+
process.stdout.should == "yo\n"
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -25,13 +25,13 @@ module Aruba
|
|
25
25
|
it "sends any output to the reader" do
|
26
26
|
reader = stub.as_null_object
|
27
27
|
reader.should_receive(:stdout).with("yo\n")
|
28
|
-
process.stop(reader
|
28
|
+
process.stop(reader)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#run!" do
|
33
33
|
context "upon process launch error" do
|
34
|
-
let(:process_failure) {
|
34
|
+
let(:process_failure) { SpawnProcess.new('does_not_exists', 1, 1) }
|
35
35
|
|
36
36
|
it "raises a Aruba::LaunchError" do
|
37
37
|
lambda{process_failure.run!}.should raise_error(::Aruba::LaunchError)
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aruba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Aslak Hellesøy
|
@@ -12,28 +11,25 @@ authors:
|
|
12
11
|
autorequire:
|
13
12
|
bindir: bin
|
14
13
|
cert_chain: []
|
15
|
-
date:
|
14
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
16
15
|
dependencies:
|
17
16
|
- !ruby/object:Gem::Dependency
|
18
17
|
name: cucumber
|
19
18
|
requirement: !ruby/object:Gem::Requirement
|
20
|
-
none: false
|
21
19
|
requirements:
|
22
|
-
- -
|
20
|
+
- - '>='
|
23
21
|
- !ruby/object:Gem::Version
|
24
22
|
version: 1.1.1
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
|
-
- -
|
27
|
+
- - '>='
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 1.1.1
|
33
30
|
- !ruby/object:Gem::Dependency
|
34
31
|
name: childprocess
|
35
32
|
requirement: !ruby/object:Gem::Requirement
|
36
|
-
none: false
|
37
33
|
requirements:
|
38
34
|
- - ~>
|
39
35
|
- !ruby/object:Gem::Version
|
@@ -41,7 +37,6 @@ dependencies:
|
|
41
37
|
type: :runtime
|
42
38
|
prerelease: false
|
43
39
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
40
|
requirements:
|
46
41
|
- - ~>
|
47
42
|
- !ruby/object:Gem::Version
|
@@ -49,81 +44,71 @@ dependencies:
|
|
49
44
|
- !ruby/object:Gem::Dependency
|
50
45
|
name: rspec-expectations
|
51
46
|
requirement: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
47
|
requirements:
|
54
|
-
- -
|
48
|
+
- - '>='
|
55
49
|
- !ruby/object:Gem::Version
|
56
50
|
version: 2.7.0
|
57
51
|
type: :runtime
|
58
52
|
prerelease: false
|
59
53
|
version_requirements: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
54
|
requirements:
|
62
|
-
- -
|
55
|
+
- - '>='
|
63
56
|
- !ruby/object:Gem::Version
|
64
57
|
version: 2.7.0
|
65
58
|
- !ruby/object:Gem::Dependency
|
66
59
|
name: bcat
|
67
60
|
requirement: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
61
|
requirements:
|
70
|
-
- -
|
62
|
+
- - '>='
|
71
63
|
- !ruby/object:Gem::Version
|
72
64
|
version: 0.6.1
|
73
65
|
type: :development
|
74
66
|
prerelease: false
|
75
67
|
version_requirements: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
68
|
requirements:
|
78
|
-
- -
|
69
|
+
- - '>='
|
79
70
|
- !ruby/object:Gem::Version
|
80
71
|
version: 0.6.1
|
81
72
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
73
|
+
name: kramdown
|
83
74
|
requirement: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
75
|
requirements:
|
86
|
-
- -
|
76
|
+
- - ~>
|
87
77
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
78
|
+
version: '0.14'
|
89
79
|
type: :development
|
90
80
|
prerelease: false
|
91
81
|
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
82
|
requirements:
|
94
|
-
- -
|
83
|
+
- - ~>
|
95
84
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
85
|
+
version: '0.14'
|
97
86
|
- !ruby/object:Gem::Dependency
|
98
87
|
name: rake
|
99
88
|
requirement: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
89
|
requirements:
|
102
|
-
- -
|
90
|
+
- - '>='
|
103
91
|
- !ruby/object:Gem::Version
|
104
92
|
version: 0.9.2
|
105
93
|
type: :development
|
106
94
|
prerelease: false
|
107
95
|
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
96
|
requirements:
|
110
|
-
- -
|
97
|
+
- - '>='
|
111
98
|
- !ruby/object:Gem::Version
|
112
99
|
version: 0.9.2
|
113
100
|
- !ruby/object:Gem::Dependency
|
114
101
|
name: rspec
|
115
102
|
requirement: !ruby/object:Gem::Requirement
|
116
|
-
none: false
|
117
103
|
requirements:
|
118
|
-
- -
|
104
|
+
- - '>='
|
119
105
|
- !ruby/object:Gem::Version
|
120
106
|
version: 2.7.0
|
121
107
|
type: :development
|
122
108
|
prerelease: false
|
123
109
|
version_requirements: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
110
|
requirements:
|
126
|
-
- -
|
111
|
+
- - '>='
|
127
112
|
- !ruby/object:Gem::Version
|
128
113
|
version: 2.7.0
|
129
114
|
description: CLI Steps for Cucumber, hand-crafted for you in Aruba
|
@@ -132,165 +117,98 @@ executables: []
|
|
132
117
|
extensions: []
|
133
118
|
extra_rdoc_files: []
|
134
119
|
files:
|
135
|
-
-
|
136
|
-
|
137
|
-
-
|
138
|
-
|
139
|
-
-
|
140
|
-
|
141
|
-
-
|
142
|
-
|
143
|
-
-
|
144
|
-
|
145
|
-
-
|
146
|
-
|
147
|
-
-
|
148
|
-
|
149
|
-
-
|
150
|
-
|
151
|
-
-
|
152
|
-
|
153
|
-
-
|
154
|
-
|
155
|
-
-
|
156
|
-
|
157
|
-
-
|
158
|
-
|
159
|
-
-
|
160
|
-
|
161
|
-
-
|
162
|
-
|
163
|
-
-
|
164
|
-
|
165
|
-
-
|
166
|
-
|
167
|
-
-
|
168
|
-
|
169
|
-
-
|
170
|
-
|
171
|
-
-
|
172
|
-
|
173
|
-
-
|
174
|
-
|
175
|
-
-
|
176
|
-
|
177
|
-
-
|
178
|
-
|
179
|
-
-
|
180
|
-
|
181
|
-
-
|
182
|
-
|
183
|
-
-
|
184
|
-
|
185
|
-
-
|
186
|
-
|
187
|
-
-
|
188
|
-
bGliL2FydWJhL2N1Y3VtYmVyLnJi
|
189
|
-
- !binary |-
|
190
|
-
bGliL2FydWJhL2N1Y3VtYmVyL2hvb2tzLnJi
|
191
|
-
- !binary |-
|
192
|
-
bGliL2FydWJhL2Vycm9ycy5yYg==
|
193
|
-
- !binary |-
|
194
|
-
bGliL2FydWJhL2pydWJ5LnJi
|
195
|
-
- !binary |-
|
196
|
-
bGliL2FydWJhL3Byb2Nlc3MucmI=
|
197
|
-
- !binary |-
|
198
|
-
bGliL2FydWJhL3JlcG9ydGluZy5yYg==
|
199
|
-
- !binary |-
|
200
|
-
c3BlYy9hcnViYS9hcGlfc3BlYy5yYg==
|
201
|
-
- !binary |-
|
202
|
-
c3BlYy9hcnViYS9ob29rc19zcGVjLnJi
|
203
|
-
- !binary |-
|
204
|
-
c3BlYy9hcnViYS9qcnVieV9zcGVjLnJi
|
205
|
-
- !binary |-
|
206
|
-
c3BlYy9hcnViYS9wcm9jZXNzX3NwZWMucmI=
|
207
|
-
- !binary |-
|
208
|
-
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
209
|
-
- !binary |-
|
210
|
-
dGVtcGxhdGVzL2Nzcy9jb25zb2xlLmNzcw==
|
211
|
-
- !binary |-
|
212
|
-
dGVtcGxhdGVzL2Nzcy9maWxlc3lzdGVtLmNzcw==
|
213
|
-
- !binary |-
|
214
|
-
dGVtcGxhdGVzL2Nzcy9weWdtZW50cy1hdXR1bW4uY3Nz
|
215
|
-
- !binary |-
|
216
|
-
dGVtcGxhdGVzL2ZpbGVzLmVyYg==
|
217
|
-
- !binary |-
|
218
|
-
dGVtcGxhdGVzL2ltYWdlcy9MSUNFTlNF
|
219
|
-
- !binary |-
|
220
|
-
dGVtcGxhdGVzL2ltYWdlcy9mb2xkZXIucG5n
|
221
|
-
- !binary |-
|
222
|
-
dGVtcGxhdGVzL2ltYWdlcy9wYWdlX3doaXRlLnBuZw==
|
223
|
-
- !binary |-
|
224
|
-
dGVtcGxhdGVzL2ltYWdlcy9wYWdlX3doaXRlX2doZXJraW4ucG5n
|
225
|
-
- !binary |-
|
226
|
-
dGVtcGxhdGVzL2ltYWdlcy9wYWdlX3doaXRlX3J1YnkucG5n
|
227
|
-
- !binary |-
|
228
|
-
dGVtcGxhdGVzL2luZGV4LmVyYg==
|
229
|
-
- !binary |-
|
230
|
-
dGVtcGxhdGVzL2pzL2ZpbGVzeXN0ZW0uanM=
|
231
|
-
- !binary |-
|
232
|
-
dGVtcGxhdGVzL2pzL2pxdWVyeS0xLjYuMS5taW4uanM=
|
233
|
-
- !binary |-
|
234
|
-
dGVtcGxhdGVzL21haW4uZXJi
|
120
|
+
- .document
|
121
|
+
- .gitignore
|
122
|
+
- .rspec
|
123
|
+
- .rvmrc
|
124
|
+
- .travis.yml
|
125
|
+
- Gemfile
|
126
|
+
- History.md
|
127
|
+
- LICENSE
|
128
|
+
- README.md
|
129
|
+
- Rakefile
|
130
|
+
- aruba.gemspec
|
131
|
+
- config/.gitignore
|
132
|
+
- cucumber.yml
|
133
|
+
- features/before_cmd_hooks.feature
|
134
|
+
- features/custom_ruby_process.feature
|
135
|
+
- features/exit_statuses.feature
|
136
|
+
- features/file_system_commands.feature
|
137
|
+
- features/flushing.feature
|
138
|
+
- features/interactive.feature
|
139
|
+
- features/no_clobber.feature
|
140
|
+
- features/output.feature
|
141
|
+
- features/step_definitions/aruba_dev_steps.rb
|
142
|
+
- features/support/custom_main.rb
|
143
|
+
- features/support/env.rb
|
144
|
+
- features/support/jruby.rb
|
145
|
+
- lib/aruba.rb
|
146
|
+
- lib/aruba/api.rb
|
147
|
+
- lib/aruba/config.rb
|
148
|
+
- lib/aruba/cucumber.rb
|
149
|
+
- lib/aruba/cucumber/hooks.rb
|
150
|
+
- lib/aruba/errors.rb
|
151
|
+
- lib/aruba/in_process.rb
|
152
|
+
- lib/aruba/jruby.rb
|
153
|
+
- lib/aruba/reporting.rb
|
154
|
+
- lib/aruba/spawn_process.rb
|
155
|
+
- spec/aruba/api_spec.rb
|
156
|
+
- spec/aruba/hooks_spec.rb
|
157
|
+
- spec/aruba/jruby_spec.rb
|
158
|
+
- spec/aruba/spawn_process_spec.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
- templates/css/console.css
|
161
|
+
- templates/css/filesystem.css
|
162
|
+
- templates/css/pygments-autumn.css
|
163
|
+
- templates/files.erb
|
164
|
+
- templates/images/LICENSE
|
165
|
+
- templates/images/folder.png
|
166
|
+
- templates/images/page_white.png
|
167
|
+
- templates/images/page_white_gherkin.png
|
168
|
+
- templates/images/page_white_ruby.png
|
169
|
+
- templates/index.erb
|
170
|
+
- templates/js/filesystem.js
|
171
|
+
- templates/js/jquery-1.6.1.min.js
|
172
|
+
- templates/main.erb
|
235
173
|
homepage: http://github.com/cucumber/aruba
|
236
174
|
licenses: []
|
175
|
+
metadata: {}
|
237
176
|
post_install_message:
|
238
177
|
rdoc_options:
|
239
178
|
- --charset=UTF-8
|
240
179
|
require_paths:
|
241
180
|
- lib
|
242
181
|
required_ruby_version: !ruby/object:Gem::Requirement
|
243
|
-
none: false
|
244
182
|
requirements:
|
245
|
-
- -
|
183
|
+
- - '>='
|
246
184
|
- !ruby/object:Gem::Version
|
247
185
|
version: '0'
|
248
|
-
segments:
|
249
|
-
- 0
|
250
|
-
hash: 1656561211491698914
|
251
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
|
-
none: false
|
253
187
|
requirements:
|
254
|
-
- -
|
188
|
+
- - '>='
|
255
189
|
- !ruby/object:Gem::Version
|
256
190
|
version: '0'
|
257
|
-
segments:
|
258
|
-
- 0
|
259
|
-
hash: 1656561211491698914
|
260
191
|
requirements: []
|
261
192
|
rubyforge_project:
|
262
|
-
rubygems_version:
|
193
|
+
rubygems_version: 2.0.0
|
263
194
|
signing_key:
|
264
|
-
specification_version:
|
265
|
-
summary: aruba-0.5.
|
195
|
+
specification_version: 4
|
196
|
+
summary: aruba-0.5.2
|
266
197
|
test_files:
|
267
|
-
-
|
268
|
-
|
269
|
-
-
|
270
|
-
|
271
|
-
-
|
272
|
-
|
273
|
-
-
|
274
|
-
|
275
|
-
-
|
276
|
-
|
277
|
-
-
|
278
|
-
|
279
|
-
-
|
280
|
-
|
281
|
-
-
|
282
|
-
|
283
|
-
-
|
284
|
-
ZmVhdHVyZXMvc3VwcG9ydC9lbnYucmI=
|
285
|
-
- !binary |-
|
286
|
-
ZmVhdHVyZXMvc3VwcG9ydC9qcnVieS5yYg==
|
287
|
-
- !binary |-
|
288
|
-
c3BlYy9hcnViYS9hcGlfc3BlYy5yYg==
|
289
|
-
- !binary |-
|
290
|
-
c3BlYy9hcnViYS9ob29rc19zcGVjLnJi
|
291
|
-
- !binary |-
|
292
|
-
c3BlYy9hcnViYS9qcnVieV9zcGVjLnJi
|
293
|
-
- !binary |-
|
294
|
-
c3BlYy9hcnViYS9wcm9jZXNzX3NwZWMucmI=
|
295
|
-
- !binary |-
|
296
|
-
c3BlYy9zcGVjX2hlbHBlci5yYg==
|
198
|
+
- features/before_cmd_hooks.feature
|
199
|
+
- features/custom_ruby_process.feature
|
200
|
+
- features/exit_statuses.feature
|
201
|
+
- features/file_system_commands.feature
|
202
|
+
- features/flushing.feature
|
203
|
+
- features/interactive.feature
|
204
|
+
- features/no_clobber.feature
|
205
|
+
- features/output.feature
|
206
|
+
- features/step_definitions/aruba_dev_steps.rb
|
207
|
+
- features/support/custom_main.rb
|
208
|
+
- features/support/env.rb
|
209
|
+
- features/support/jruby.rb
|
210
|
+
- spec/aruba/api_spec.rb
|
211
|
+
- spec/aruba/hooks_spec.rb
|
212
|
+
- spec/aruba/jruby_spec.rb
|
213
|
+
- spec/aruba/spawn_process_spec.rb
|
214
|
+
- spec/spec_helper.rb
|