Modifying cruise.rake like this should help..... maybe we can add this to the documentation?
require 'rubygems'
require 'rake'
require 'fileutils'
require "bundler"
desc "Task for cruise Control"
task :cruise do
RAILS_ENV = ENV['RAILS_ENV'] = 'test'
sh "bundle install"
Bundler.setup(:default, :test)
I'm not sure if this is a problem with bundler or not, but we run
'bundle install' in a separate parallel interpreter session kicked off
before the tests run (in their own process). Historically (e.g. with
config.gems or geminstaller) , this was necessary to ensure that the
RubyGems cache was not out of date and missing newly-installed gems.
Bundler may not have that problem, though.
Can anyone prove or disprove that you need to run 'bundle install' in
a separate process from your tests?
-- Chad
_______________________________________________
Cruisecontrolrb-users mailing list
Cruisecont...@rubyforge.org
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users
In a Rails 2.x app, it can be done from cruise.rake, I think it also
works from preinitializer.rb. Just put it in a 'system' call.
Your best bet is to read up on http://gembundler.com/ and ask on the
bundler mailing list if you still have questions. I might tell you
something outdated, as I haven't played with Bundler much since 1.0 :)
Yeah, like I said I'm kinda vague on this. But you DON'T necessarily
need to run bundle install BEFORE cruise.rake executes, but you DO
need to run it before rails loads the environment (which happens when
you run a rails rake task. So what you have may be ok, if the '...'
turns into something like "system('rake default') or raise 'rake
failed'"
I THINK that in rails 2.x, calling bundle install from
preinitializer.rb (which runs before environment actually loads)
should accomplish the same thing - even though it gets run twice (a
quirk of rails 2.x init).
Again, I'm almost positive there's some good rails 2.x + bundler docs
on the bundler site which are relevant to the latest 1.x bundler
release, including what you need to stick in preinitializer.rb. And
the bundler list is a better place to ask this stuff (and please feel
free to follow up here with a definitive answer).
Good luck,
ruby -e "require 'rubygems' rescue nil; require 'rake'; load '/Users/tsedano/cruisecontrol-1.4.0/tasks/cc_build.rake'; ARGV << '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" rake aborted!
Bundler couldn't find some gems.Did you run `bundle install`?
The way I read this error, I think it means that the default cruise control rake is failing and needs bundler to run before it even gets to my rake task for the project. I am not a cruise control developer. so I could be wrong. There could be a more elegant way to solve this. I was hoping that modifying cruisecontrol-1.4.0/tasks/cc_build.rake, but it didn't work for me.
The way we get around this it to check an environment variable -
"IS_CI_BOX" - in preinitializer.rb. We only run bundle install if
this is true. So, developers have to run it manually, but it always
runs on CI.
> Here is the reason I think I need to call bundle install before the cruise
> control rake file gets started, I see the error message:
>
> ruby -e "require 'rubygems' rescue nil; require 'rake'; load
> '/Users/tsedano/cruisecontrol-1.4.0/tasks/cc_build.rake'; ARGV <<
> '--nosearch' << 'cc:build'; Rake.application.run; ARGV.clear" rake aborted!
>
> Bundler couldn't find some gems.Did you run `bundle install`?
Bundler has to be trying to run before it installs gems. This is
probably because you didn't call 'bundle install' in
preinitializer.rb. You can debug this pretty easily, put some debug
statments into preinitializer.rb and make sure 'bundle install' runs
before your rails environment (and bundler) attempts to set up the
load path.
>
> The way I read this error, I think it means that the default cruise control
> rake is failing and needs bundler to run before it even gets to my rake task
> for the project. I am not a cruise control developer. so I could be wrong.
> There could be a more elegant way to solve this. I was hoping that modifying
> cruisecontrol-1.4.0/tasks/cc_build.rake, but it didn't work for me.
>