Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rake task prepends 'bundle exec' if there is a Gemfile

  • Loading branch information...
commit cb792f37061e5893af46ef6ae07398447367940a 1 parent ad2af76
@dchelimsky dchelimsky authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/rspec/core/rake_task.rb
View
4 lib/rspec/core/rake_task.rb
@@ -102,6 +102,7 @@ def files_to_run # :nodoc:
def rcov_command(cmd_parts)
cmd_parts.unshift runner_options
cmd_parts.unshift runner
+ cmd_parts.unshift bundler
cmd_parts += files_to_run.map { |fn| %["#{fn}"] }
cmd_parts.join(" ")
end
@@ -114,6 +115,9 @@ def runner_options
rcov ? [rcov_opts] : [ruby_opts]
end
+ def bundler
+ File.exist?("./Gemfile") ? "bundle exec " : ""
+ end
end
end

2 comments on commit cb792f3

@cgriego

This works great in my project if I run $ rake but not if I run $ bundle exec rake.

$ bundle exec rake --trace
(in myproject)
** Invoke default (first_time)
** Invoke spec (first_time)
** Execute spec
/Library/Ruby/Gems/1.8/gems/bundler-1.0.0.beta.2/lib/bundler/shared_helpers.rb:128:in `bin_path': can't find executable bundle (Gem::Exception)
    from /usr/bin/bundle:19
rake aborted!
bundle exec  rcov --failure-threshold --exclude test/*,spec/*,features/*,gems/* -Ilib -Ispec "./spec/my_spec.rb" failed
/Library/Ruby/Gems/1.8/gems/rspec-core-2.0.0.beta.15/lib/rspec/core/rake_task.rb:68:in `define'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
/Library/Ruby/Gems/1.8/gems/rspec-core-2.0.0.beta.15/lib/rspec/core/rake_task.rb:61:in `send'
/Library/Ruby/Gems/1.8/gems/rspec-core-2.0.0.beta.15/lib/rspec/core/rake_task.rb:61:in `define'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
@dchelimsky
Owner

Please submit an issue to http://github.com/rspec/rspec-core/issues so I can keep track of and prioritize this.

Please sign in to comment.
Something went wrong with that request. Please try again.