Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Untitled #35

Closed
wants to merge 1 commit into from

2 participants

@Flameeyes

Hello,

I'm sending a quick fix to the Rakefile so that even if Cucumber is not available it can be used to run specs or rebuild documentation.

HTH,
Diego

@Flameeyes Flameeyes Don't force cucumber presence on Rakefile.
Only define the cucumber tasks if cucumber is available, allowing for the
Rakefile to work without Cucumber installed.
3bb7954
@dchelimsky
Owner

Cucumber is part of the bundle, so this doesn't actually work as/is.

@Flameeyes

We seriously can't use bundler and bundles when packaging, and still we'd rather not have cucumber forced on users when it is not needed.

What is wrong with rescuing the execution if Cucumber is not around?

@dchelimsky
Owner

Nothing wrong with that, but that's not what happens. Lines 1 and 2 of the Rakefile require and invoke Bundler, so just running rake -T raises an exception if Cucumber is not available. I'm sure there's a way to get it to work, but it doesn't as this patch is written.

That said, I'm not clear on the use case. rspec-mocks is specified with both Cucumber and RSpec, so if you want to run the specs for verification, you should be running both, otherwise you're not getting a complete picture.

Can you elaborate on "We seriously can't sue bundler and bundles when packaging" ? What are you packaging, and what are you trying to do that the presence of Cucumber is preventing you from doing?

@Flameeyes

Yeah it is true we also forcefully disable bundler as it is (and not just for rspecs), since it goes the opposite way of what we do in Gentoo (un-bundling).

Right now we're limiting our testing to RSpec, while it is not complete, we have trouble with Cucumber and Ruby 1.9 (it's a long story, we need to get a newer version of Cucumber in, but it's getting difficult), so if we have Cucumber forced on us we're not going to be able to run even the RSpec-based specs.

@Flameeyes

Don't force cucumber presence on Rakefile.

Only define the cucumber tasks if cucumber is available, allowing for the
Rakefile to work without Cucumber installed.

Note that Cucumber is still part of the bundle, so unless you're
disabling bundler as well, this patch has no effect.

See #35 for background.

@dchelimsky
Owner

Do you want to do same for rspec-core, rspec-expectations, and rspec-rails?

@Flameeyes

If they have the same construct, yes. Somehow those did pass tests without needing further tinkering though, but it might be a mistake in our packaging, will doublecheck them out tonight/tomorrow.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2011
  1. @Flameeyes

    Don't force cucumber presence on Rakefile.

    Flameeyes authored
    Only define the cucumber tasks if cucumber is available, allowing for the
    Rakefile to work without Cucumber installed.
This page is out of date. Refresh to see the latest.
Showing with 27 additions and 22 deletions.
  1. +27 −22 Rakefile
View
49 Rakefile
@@ -5,15 +5,6 @@ Bundler::GemHelper.install_tasks
require 'rake'
require 'rspec/core/rake_task'
require 'rspec/mocks/version'
-require 'cucumber/rake/task'
-
-class Cucumber::Rake::Task::ForkedCucumberRunner
- # When cucumber shells out, we still need it to run in the context of our
- # bundle.
- def run
- sh "bundle exec #{RUBY} " + args.join(" ")
- end
-end
task :cleanup_rcov_files do
rm_rf 'coverage.data'
@@ -24,8 +15,6 @@ RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w[--color]
end
-Cucumber::Rake::Task.new(:cucumber)
-
namespace :spec do
desc "Run all examples using rcov"
RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
@@ -35,17 +24,35 @@ namespace :spec do
end
end
-namespace :cucumber do
- desc "Run cucumber features using rcov"
- Cucumber::Rake::Task.new :rcov => :cleanup_rcov_files do |t|
- t.cucumber_opts = %w{--format progress}
- t.rcov = true
- t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
- t.rcov_opts << %[--text-report --sort coverage --aggregate coverage.data]
+task :default => :spec
+
+begin
+ require 'cucumber/rake/task'
+
+ class Cucumber::Rake::Task::ForkedCucumberRunner
+ # When cucumber shells out, we still need it to run in the context of our
+ # bundle.
+ def run
+ sh "bundle exec #{RUBY} " + args.join(" ")
+ end
end
-end
-task :default => [:spec, :cucumber]
+ Cucumber::Rake::Task.new(:cucumber)
+
+ namespace :cucumber do
+ desc "Run cucumber features using rcov"
+ Cucumber::Rake::Task.new :rcov => :cleanup_rcov_files do |t|
+ t.cucumber_opts = %w{--format progress}
+ t.rcov = true
+ t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
+ t.rcov_opts << %[--text-report --sort coverage --aggregate coverage.data]
+ end
+ end
+
+ task :default => :cucumber
+rescue LoadError
+ $stderr.puts "unable to load cucumber, some tasks unavailable"
+end
task :clobber do
rm_rf 'pkg'
@@ -66,5 +73,3 @@ task :relish, :version do |t, args|
raise "rake relish[VERSION]" unless args[:version]
sh "relish push rspec/rspec-mocks:#{args[:version]}"
end
-
-task :default => [:spec, :cucumber]
Something went wrong with that request. Please try again.