Forum: RSpec using config.gem to freeze rspec (not #577)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
jacobhenry (Guest)
on 2008-10-25 06:50
(Received via mailing list)
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:in
`require'
/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:in
`new_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-r...
Sent from the rspec-users mailing list archive at Nabble.com.
David C. (Guest)
on 2008-10-25 17:34
(Received via mailing list)
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
This topic is locked and can not be replied to.