Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundler ignores groups in rails apps

This problem was fixed in 0.9.8, but seems to have recurred in the 1.x branch.

In my Gemfile I have a group for the test and development environments that use the rspec gems. On my production server rspec is not installed. I used the command bundle install --without test development in my rails app

Starting my rails app in production mode gives the exception:

Could not find gem 'rspec (>= 0)' in any of the gem sources listed in your Gemfile.

If I comment out the test group the same error happens with the development group.

The same problem exists if I start in development mode, then it tries to load the gems in the test group.

It seems that bundler completely ignores the environment groups and tries to load all gems in Gemfile:

    group :test do
      gem "rspec"
    end

    group :development do
      gem "rspec-rails"
    end


  versions:
  bundle 1.0.15
  rails 3.0.7
  ruby 1.9.2-p180
like image 461
agreif Avatar asked Jun 11 '11 06:06

agreif


1 Answers

I was having this problem too, the problem was that .bundle/config file had something like "--without development test" even tho I had never ran the bundle command with this parameters(maybe I cloned the repository from the Webbynode server and their system added this automatically for production...)

anyway, the fix was

rm .bundle/config
bundle install
like image 56
Breno Salgado Avatar answered Oct 24 '22 01:10

Breno Salgado