Using config.gem to freeze rspec (not #577)


#1

We have a project running on edge rails that has rspec and rspec-rails
1.1.9
frozen in vendor/gems. To freeze the gems we added two lines of code to
environment.rb:

config.gem ‘rspec-rails’, :lib => ‘spec/rails’, :version => ‘1.1.9’
config.gem ‘rspec’, :lib => ‘spec’, :version => ‘1.1.9’

and then ran:

rake gems:install
rake gems:unpack
rake gems:unpack:dependencies
rake gems:build

The main goal is to freeze all common gems into the project so the
production server can simply run ‘rake gems:build’ and not worry about
installing anything. This method of deployment is causing me to receive
the
following error on my production machine whenever I run rake:

rake aborted!
no such file to load – spec/rake/spectask
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/Users/Jacob/git/scratchco_back/vendor/rails/activesupport/lib/active_support/dependencies.rb:148:in
require' /Users/Jacob/git/scratchco_back/vendor/rails/activesupport/lib/active_support/dependencies.rb:507:innew_constants_in’
/Users/Jacob/git/scratchco_back/vendor/rails/activesupport/lib/active_support/dependencies.rb:148:in
`require’
/Users/Jacob/git/scratchco_back/lib/tasks/rspec.rake:9

I can see that spectask.rb exists in
vendor/gems/rspec-1.1.9/lib/spec/rake/.
Running ‘script/generate rspec’ did not solve my problem.

View this message in context:
http://www.nabble.com/using-config.gem-to-freeze-rspec-(not--577)-tp20118125p20118125.html
Sent from the rspec-users mailing list archive at Nabble.com.


#2

On Fri, Oct 24, 2008 at 9:45 PM, jacobhenry removed_email_address@domain.invalid wrote:

We have a project running on edge rails that has rspec and rspec-rails 1.1.9
frozen in vendor/gems. To freeze the gems we added two lines of code to
environment.rb:

config.gem ‘rspec-rails’, :lib => ‘spec/rails’, :version => ‘1.1.9’
config.gem ‘rspec’, :lib => ‘spec’, :version => ‘1.1.9’

First - there were some problems with 1.1.9 gems that have been mostly
addressed in 1.1.11, so please upgrade to 1.1.11.

Second, there is still one open issue with 1.1.11 gems, which is that
if you configure both rspec and rspec-rails gems, in that order (rspec
first), you’ll have problems with rake tasks. To workaround that you
can either configure them in the order you have them (rspec-rails,
then rspec), or you can just configure rspec-rails, which has a hard
dependency on rspec so rspec will also get installed w/ rake
gems:install (unless you’re on an older version of rubygems - I forget
which one started installing deps by default, but that definitely
happens w/ >= 1.2).

HTH,
David