aruba 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,4 +1,14 @@
1
- rvm:
2
- - 1.8.7
3
- - 1.9.2
1
+ rvm:
4
2
  - 1.9.3
3
+ - 1.9.2
4
+ - 1.8.7
5
+ # whitelist
6
+ branches:
7
+ only:
8
+ - master
9
+
10
+ notifications:
11
+ email:
12
+ - cukes-devs@googlegroups.com
13
+ irc:
14
+ - "irc.freenode.org#cucumber"
data/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [v0.4.8](https://github.com/cucumber/aruba/compare/v0.4.7...v0.4.8)
2
+
3
+ * Add before_run hook (Matt Wynne)
4
+ * Add JRuby performance tweaks (#93 Myron Marston / Matt Wynne)
5
+ * Invalid/Corrupt spec file for 0.4.7 - undefined method call for nil:Nilclass (#47 Aslak Hellesøy)
6
+
1
7
  ## [v0.4.7](https://github.com/cucumber/aruba/compare/v0.4.6...v0.4.7)
2
8
 
3
9
  * Remove rdiscount dependency. (#85 Aslak Hellesøy)
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.4.7'
5
+ s.version = '0.4.8'
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}"
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.homepage = 'http://github.com/cucumber/aruba'
11
11
 
12
12
  s.add_runtime_dependency 'cucumber', '>= 1.1.1'
13
- s.add_runtime_dependency 'childprocess', '>= 0.2.2'
14
- s.add_runtime_dependency 'ffi', '1.0.9' # https://github.com/ffi/ffi/issues/176
13
+ s.add_runtime_dependency 'childprocess', '>= 0.2.3'
14
+ s.add_runtime_dependency 'ffi', '1.0.11'
15
15
  s.add_runtime_dependency 'rspec', '>= 2.7.0'
16
16
  s.add_development_dependency 'bcat', '>= 0.6.1'
17
17
  s.add_development_dependency 'rdiscount', '>= 1.6.8'
@@ -0,0 +1,61 @@
1
+ Feature: before_run hooks
2
+
3
+ You can configure Aruba to run blocks of code before it runs
4
+ each command.
5
+
6
+ The command will be passed to the block.
7
+
8
+ Scenario: Run a simple command with a before hook
9
+ Given a file named "test.rb" with:
10
+ """
11
+ $: << '../../lib'
12
+ require 'aruba/api'
13
+
14
+ Aruba.configure do |config|
15
+ config.before_run do |cmd|
16
+ puts "about to run `#{cmd}`"
17
+ end
18
+ end
19
+
20
+ include Aruba::Api
21
+ run_simple("echo 'running'")
22
+ puts all_stdout
23
+ """
24
+ When I run `ruby test.rb`
25
+ Then it should pass with:
26
+ """
27
+ about to run `echo 'running'`
28
+ running
29
+ """
30
+
31
+ # This should move into a spec
32
+ Scenario: Use something from the context where the command was run
33
+ Given a file named "test.rb" with:
34
+ """
35
+ $: << '../../lib'
36
+ require 'aruba/api'
37
+
38
+ Aruba.configure do |config|
39
+ config.before_run do |cmd|
40
+ puts "I can see @your_context=#{@your_context}"
41
+ end
42
+ end
43
+
44
+ class Test
45
+ include Aruba::Api
46
+
47
+ def test
48
+ @your_context = "something"
49
+ run_simple("echo 'running'")
50
+ puts all_stdout
51
+ end
52
+ end
53
+
54
+ Test.new.test
55
+ """
56
+ When I run `ruby test.rb`
57
+ Then it should pass with:
58
+ """
59
+ I can see @your_context=something
60
+ running
61
+ """
data/lib/aruba.rb CHANGED
@@ -1 +1 @@
1
- # Load nothing - just keep the file here to keep bundler happy.
1
+ # Load nothing - just keep the file here to keep bundler happy.
data/lib/aruba/api.rb CHANGED
@@ -1,9 +1,14 @@
1
1
  require 'fileutils'
2
2
  require 'rbconfig'
3
+ require 'rspec/expectations'
3
4
  require 'aruba/process'
5
+ require 'aruba/config'
6
+ require 'aruba/jruby' if RUBY_PLATFORM == 'java'
4
7
 
5
8
  module Aruba
6
9
  module Api
10
+ include RSpec::Matchers
11
+
7
12
  def in_current_dir(&block)
8
13
  _mkdir(current_dir)
9
14
  Dir.chdir(current_dir, &block)
@@ -253,6 +258,8 @@ module Aruba
253
258
  cmd = detect_ruby(cmd)
254
259
 
255
260
  in_current_dir do
261
+ Aruba.config.hooks.execute(:before_run, cmd, self)
262
+
256
263
  announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
257
264
  announce_or_puts("$ #{cmd}") if @announce_cmd
258
265
 
@@ -0,0 +1,44 @@
1
+ module Aruba
2
+ class Config
3
+ attr_reader :hooks
4
+
5
+ def initialize
6
+ @hooks = Hooks.new
7
+ end
8
+
9
+ # Register a hook to be called before Aruba runs a command
10
+ def before_run(&block)
11
+ @hooks.append(:before_run, block)
12
+ end
13
+ end
14
+
15
+ #nodoc
16
+ class Hooks
17
+ def initialize
18
+ @store = Hash.new do |hash, key|
19
+ hash[key] = []
20
+ end
21
+ end
22
+
23
+ def append(label, block)
24
+ @store[label] << block
25
+ end
26
+
27
+ def execute(label, *args, context)
28
+ @store[label].each do |block|
29
+ context.instance_exec(*args, &block)
30
+ end
31
+ end
32
+ end
33
+
34
+ class << self
35
+ attr_accessor :config
36
+
37
+ def configure
38
+ yield config
39
+ end
40
+
41
+ end
42
+
43
+ self.config = Config.new
44
+ end
@@ -1,5 +1,5 @@
1
1
  require 'aruba/api'
2
- require 'aruba/hooks'
2
+ require 'aruba/cucumber/hooks'
3
3
  require 'aruba/reporting'
4
4
 
5
5
  World(Aruba::Api)
File without changes
@@ -0,0 +1,7 @@
1
+ Aruba.configure do |config|
2
+ config.before_run do
3
+ # ideas taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html
4
+ set_env('JRUBY_OPTS', '-X-C') # disable JIT since these processes are so short lived
5
+ set_env('JAVA_OPTS', '-d32') # force jRuby to use client JVM for faster startup times
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aruba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2011-11-09 00:00:00.000000000 Z
15
+ date: 2011-12-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: cucumber
19
- requirement: &2169217200 !ruby/object:Gem::Requirement
19
+ requirement: &2154130540 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,32 +24,32 @@ dependencies:
24
24
  version: 1.1.1
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2169217200
27
+ version_requirements: *2154130540
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: childprocess
30
- requirement: &2169216360 !ruby/object:Gem::Requirement
30
+ requirement: &2154129760 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.2.2
35
+ version: 0.2.3
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *2169216360
38
+ version_requirements: *2154129760
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: ffi
41
- requirement: &2169215480 !ruby/object:Gem::Requirement
41
+ requirement: &2154129000 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - =
45
45
  - !ruby/object:Gem::Version
46
- version: 1.0.9
46
+ version: 1.0.11
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *2169215480
49
+ version_requirements: *2154129000
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: rspec
52
- requirement: &2169214760 !ruby/object:Gem::Requirement
52
+ requirement: &2154144360 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: 2.7.0
58
58
  type: :runtime
59
59
  prerelease: false
60
- version_requirements: *2169214760
60
+ version_requirements: *2154144360
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: bcat
63
- requirement: &2169214160 !ruby/object:Gem::Requirement
63
+ requirement: &2154142940 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: 0.6.1
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *2169214160
71
+ version_requirements: *2154142940
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: rdiscount
74
- requirement: &2169213540 !ruby/object:Gem::Requirement
74
+ requirement: &2154141800 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ! '>='
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: 1.6.8
80
80
  type: :development
81
81
  prerelease: false
82
- version_requirements: *2169213540
82
+ version_requirements: *2154141800
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
- requirement: &2169212940 !ruby/object:Gem::Requirement
85
+ requirement: &2154141000 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ! '>='
@@ -90,7 +90,7 @@ dependencies:
90
90
  version: 0.9.2
91
91
  type: :development
92
92
  prerelease: false
93
- version_requirements: *2169212940
93
+ version_requirements: *2154141000
94
94
  description: CLI Steps for Cucumber, hand-crafted for you in Aruba
95
95
  email: cukes@googlegroups.com
96
96
  executables: []
@@ -109,6 +109,7 @@ files:
109
109
  - aruba.gemspec
110
110
  - config/.gitignore
111
111
  - cucumber.yml
112
+ - features/before_run_hooks.feature
112
113
  - features/exit_statuses.feature
113
114
  - features/file_system_commands.feature
114
115
  - features/flushing.feature
@@ -119,8 +120,10 @@ files:
119
120
  - features/support/env.rb
120
121
  - lib/aruba.rb
121
122
  - lib/aruba/api.rb
123
+ - lib/aruba/config.rb
122
124
  - lib/aruba/cucumber.rb
123
- - lib/aruba/hooks.rb
125
+ - lib/aruba/cucumber/hooks.rb
126
+ - lib/aruba/jruby.rb
124
127
  - lib/aruba/process.rb
125
128
  - lib/aruba/reporting.rb
126
129
  - templates/css/console.css
@@ -151,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
154
  version: '0'
152
155
  segments:
153
156
  - 0
154
- hash: -1641933628197378255
157
+ hash: -1312847667383042518
155
158
  required_rubygems_version: !ruby/object:Gem::Requirement
156
159
  none: false
157
160
  requirements:
@@ -160,14 +163,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
163
  version: '0'
161
164
  segments:
162
165
  - 0
163
- hash: -1641933628197378255
166
+ hash: -1312847667383042518
164
167
  requirements: []
165
168
  rubyforge_project:
166
169
  rubygems_version: 1.8.10
167
170
  signing_key:
168
171
  specification_version: 3
169
- summary: aruba-0.4.7
172
+ summary: aruba-0.4.8
170
173
  test_files:
174
+ - features/before_run_hooks.feature
171
175
  - features/exit_statuses.feature
172
176
  - features/file_system_commands.feature
173
177
  - features/flushing.feature