aruba 0.3.4 → 0.3.5

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.
@@ -1,3 +1,8 @@
1
+ == 0.3.5
2
+
3
+ === Bugfixes
4
+ * Store processes in an array to ensure order of operations on Ruby 1.8.x (#48 Mike Sassak)
5
+
1
6
  == 0.3.4
2
7
 
3
8
  * Use backticks (`) instead of quotes (") to specify command line. Quote still works, but is deprecated. (Anthony Eden, Aslak Hellesøy)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'aruba'
5
- s.version = '0.3.4'
5
+ s.version = '0.3.5'
6
6
  s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak"]
7
7
  s.description = 'CLI Steps for Cucumber, hand-crafted for you in Aruba'
8
8
  s.summary = "aruba-#{s.version}"
@@ -6,7 +6,7 @@ Feature: file system commands
6
6
 
7
7
  Scenario: create a dir
8
8
  Given a directory named "foo/bar"
9
- When I run "ruby -e \"puts test ?d, 'foo'\""
9
+ When I run `ruby -e "puts test ?d, 'foo'"`
10
10
  Then the stdout should contain "true"
11
11
 
12
12
  Scenario: create a file
@@ -14,7 +14,7 @@ Feature: file system commands
14
14
  """
15
15
  puts "hello world"
16
16
  """
17
- When I run "ruby foo/bar/example.rb"
17
+ When I run `ruby foo/bar/example.rb`
18
18
  Then the output should contain "hello world"
19
19
 
20
20
  Scenario: append to a file
@@ -26,12 +26,12 @@ Feature: file system commands
26
26
  """
27
27
  puts "this was appended"
28
28
  """
29
- When I run "ruby foo/bar/example.rb"
29
+ When I run `ruby foo/bar/example.rb`
30
30
  Then the output should contain "hello world"
31
31
  And the output should contain "this was appended"
32
32
 
33
33
  Scenario: clean up files generated in previous scenario
34
- When I run "ruby foo/bar/example.rb"
34
+ When I run `ruby foo/bar/example.rb`
35
35
  Then the exit status should be 1
36
36
  And the output should contain "No such file or directory -- foo/bar/example.rb"
37
37
 
@@ -41,11 +41,11 @@ Feature: file system commands
41
41
  puts "hello world"
42
42
  """
43
43
  When I cd to "foo/bar"
44
- And I run "ruby example.rb"
44
+ And I run `ruby example.rb`
45
45
  Then the output should contain "hello world"
46
46
 
47
47
  Scenario: Reset current directory from previous scenario
48
- When I run "ruby example.rb"
48
+ When I run `ruby example.rb`
49
49
  Then the exit status should be 1
50
50
 
51
51
  Scenario: Holler if cd to bad dir
@@ -115,26 +115,25 @@ module Aruba
115
115
 
116
116
  def output_from(cmd)
117
117
  cmd = detect_ruby(cmd)
118
- processes[cmd].output
118
+ get_process(cmd).output
119
119
  end
120
120
 
121
121
  def stdout_from(cmd)
122
122
  cmd = detect_ruby(cmd)
123
- processes[cmd].stdout
123
+ get_process(cmd).stdout
124
124
  end
125
125
 
126
126
  def stderr_from(cmd)
127
127
  cmd = detect_ruby(cmd)
128
- processes[cmd].stderr
128
+ get_process(cmd).stderr
129
129
  end
130
130
 
131
131
  def all_stdout
132
- processes.values.inject("") { |out, ps| out << ps.stdout }
132
+ only_processes.inject("") { |out, ps| out << ps.stdout }
133
133
  end
134
134
 
135
- # Note, with pre-1.9 ruby, the ordering of this may change. Use ruby 1.9.x or later.
136
135
  def all_stderr
137
- processes.values.inject("") { |out, ps| out << ps.stderr }
136
+ only_processes.inject("") { |out, ps| out << ps.stderr }
138
137
  end
139
138
 
140
139
  def all_output
@@ -180,7 +179,7 @@ module Aruba
180
179
  end
181
180
 
182
181
  def processes
183
- @processes ||= {}
182
+ @processes ||= []
184
183
  end
185
184
 
186
185
  def stop_processes!
@@ -189,6 +188,18 @@ module Aruba
189
188
  end
190
189
  end
191
190
 
191
+ def register_process(name, process)
192
+ processes << [name, process]
193
+ end
194
+
195
+ def get_process(wanted)
196
+ processes.find{ |name, _| name == wanted }[-1]
197
+ end
198
+
199
+ def only_processes
200
+ processes.collect{ |_, process| process }
201
+ end
202
+
192
203
  def run(cmd)
193
204
  cmd = detect_ruby(cmd)
194
205
 
@@ -196,7 +207,8 @@ module Aruba
196
207
  announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
197
208
  announce_or_puts("$ #{cmd}") if @announce_cmd
198
209
 
199
- process = processes[cmd] = Process.new(cmd, exit_timeout, io_wait)
210
+ process = Process.new(cmd, exit_timeout, io_wait)
211
+ register_process(cmd, process)
200
212
  process.run!
201
213
 
202
214
  block_given? ? yield(process) : process
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: aruba
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.4
5
+ version: 0.3.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Aslak Helles\xC3\xB8y"
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-03-20 00:00:00 +00:00
15
+ date: 2011-03-22 00:00:00 +00:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- hash: 2705483300968521573
98
+ hash: 1240099733914019053
99
99
  segments:
100
100
  - 0
101
101
  version: "0"
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
105
  - - ">="
106
106
  - !ruby/object:Gem::Version
107
- hash: 2705483300968521573
107
+ hash: 1240099733914019053
108
108
  segments:
109
109
  - 0
110
110
  version: "0"
@@ -114,7 +114,7 @@ rubyforge_project:
114
114
  rubygems_version: 1.6.2
115
115
  signing_key:
116
116
  specification_version: 3
117
- summary: aruba-0.3.4
117
+ summary: aruba-0.3.5
118
118
  test_files:
119
119
  - features/exit_statuses.feature
120
120
  - features/file_system_commands.feature