Skip to content

Commit

Permalink
Print --drb warnings to STDERR if no server is running. Release 0.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Jun 5, 2009
1 parent 5e990db commit 3dbe87a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
22 changes: 12 additions & 10 deletions History.txt
@@ -1,25 +1,27 @@
== 0.3.10 (In Git - The Spork Release!)
== 0.3.10 2009-06-05

The Spork Release!

This release has an exciting new feature - a new --drb switch! This magic switch lets you run your
features much faster than before, because you can eliminate the startup time for your code. This is
thanks to a brand new gem called Spork by Tim Harper and Ben Mabey. (You can find out more about Spork
here: http://github.com/timcharper/spork/tree/master). You can start Spork and have it preload your
application in a separate process. Spork listens for DRb connections, and when you run cucumber with
--drb they will run inside the Spork server instead. Spork provides two simple hooks for preloading your
application - one for framework/stable code (Spork.prefork) and one for the code that *you* write and
--drb the features will run inside the Spork server instead. Spork provides two simple hooks for preloading
your application - one for framework/stable code (Spork.prefork) and one for the code that *you* write and
change often (Spork.each_run). Keep in mind that all World, Before, and other Cucumber hooks need to be
in the Spork.each_run block. Using Spork works great for Ruby on Rails, which can take a while to load,
but Spork isn't tied to Rails. The new --drb switch also works great alongside autotest (just add --drb
to your autotest profile in cucumber.yml), so now you can get even faster feedback.
but --drb and Spork aren't tied to Rails at all. The new --drb switch also works great alongside autotest
(just add --drb to your autotest profile in cucumber.yml), so now you can get even faster feedback.

Cucumber's built-in cucumber generator now has a new --spork switch, so when you bootstrap your Rails
application for cucumber, you can have spork configuration set up out of the box. (It's just a
slightly different env.rb.)

Although Spork was in mind when this feature was added it is important to realize that all that was added
to Cucumber was a DRb client. Any DRb server that adheres to this protocol can interop with Cucumber.
While Spork is geared towards removing the load time to give you a faster feedback loop you could just as
easily use this client with a server that distributes your features to run in parallel. Someone just
Although Spork was in mind when the --drb switch was added it is important to realize that all that was added
to Cucumber was a DRb client. Any DRb server that adheres to this protocol can be used with Cucumber's --drb
switch. While Spork is geared towards removing the load time to give you a faster feedback loop you could
just as easily use this client with a server that distributes your features to run in parallel. Someone just
needs to write such a server. ;)

This release also has some minor bugfixes related to RSpec and Rails interop.
Expand All @@ -31,7 +33,7 @@ This release also has some minor bugfixes related to RSpec and Rails interop.

=== New features
* Spork support via --drb. (Ben Mabey)
* Added a Ast::Feature#name method for convenience
* Added a Ast::Feature#name method for convenience. (Aslak Hellesøy)

=== Changed features
* The HTML formatter wraps examples in a div, and distinguishes between Scenario and Scenario Outline. (Aslak Hellesøy)
Expand Down
4 changes: 2 additions & 2 deletions cucumber.gemspec
Expand Up @@ -2,11 +2,11 @@

Gem::Specification.new do |s|
s.name = %q{cucumber}
s.version = "0.3.9.5"
s.version = "0.3.10"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Aslak Helles\303\270y"]
s.date = %q{2009-06-04}
s.date = %q{2009-06-05}
s.default_executable = %q{cucumber}
s.description = %q{Executable Feature scenarios}
s.email = ["aslak.hellesoy@gmail.com"]
Expand Down
10 changes: 8 additions & 2 deletions features/drb_server_integration.feature
Expand Up @@ -61,9 +61,12 @@ Feature: DRb Server Integration

When I run cucumber features/sample.feature --drb
Then it should pass
And the output should contain
And STDERR should match
"""
No DRb server is running. Running features locally:
"""
And the output should contain
"""
I'm loading all the heavy stuff...
I'm loading the stuff just for this run...
"""
Expand All @@ -78,9 +81,12 @@ Feature: DRb Server Integration

When I run cucumber --profile server
Then it should pass
And the output should contain
And STDERR should match
"""
No DRb server is running. Running features locally:
"""
And the output should contain
"""
I'm loading all the heavy stuff...
I'm loading the stuff just for this run...
"""
2 changes: 1 addition & 1 deletion lib/cucumber/cli/main.rb
Expand Up @@ -37,7 +37,7 @@ def execute!(step_mother)
if DRbClient.run(@args, @error_stream, @out_stream)
return false
else
@out_stream.puts "No DRb server is running. Running features locally:"
@error_stream.puts "WARNING: No DRb server is running. Running features locally:"
configuration.parse!(@args)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/cucumber/version.rb
Expand Up @@ -2,8 +2,8 @@ module Cucumber #:nodoc:
class VERSION #:nodoc:
MAJOR = 0
MINOR = 3
TINY = 9
PATCH = 5 # Set to nil for official release
TINY = 10
PATCH = nil # Set to nil for official release

STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
end
Expand Down
8 changes: 4 additions & 4 deletions spec/cucumber/cli/main_spec.rb
Expand Up @@ -11,6 +11,7 @@ module Cli
describe Main do
before(:each) do
@out = StringIO.new
@err = StringIO.new
Kernel.stub!(:exit).and_return(nil)
end

Expand Down Expand Up @@ -97,16 +98,15 @@ module Cli
before(:each) do
@configuration = mock('Configuration', :drb? => true, :null_object => true)
Configuration.stub!(:new).and_return(@configuration)
@error_stream = mock('standard error')

@args = ['features']

@cli = Main.new(@args, @out, @error_stream)
@cli = Main.new(@args, @out, @err)
@step_mother = mock('StepMother', :null_object => true)
end

it "delegates the execution to the DRB client passing the args and streams" do
DRbClient.should_receive(:run).with(@args, @error_stream, @out).and_return(true)
DRbClient.should_receive(:run).with(@args, @err, @out).and_return(true)
@cli.execute!(@step_mother)
end

Expand All @@ -121,7 +121,7 @@ module Cli

it "alerts the user that execution will be performed locally" do
@cli.execute!(@step_mother)
@out.string.should include("No DRb server is running. Running features locally:")
@err.string.should include("WARNING: No DRb server is running. Running features locally:")
end

it "reparses the configuration since the --drb flag causes the initial parsing to short circuit" do
Expand Down

0 comments on commit 3dbe87a

Please sign in to comment.