ruby-on-railsbundlerruby-on-rails-3.2gem-bundler

Why Bundler.require is not working the way it should


I have an application where I segregated all my gem based on groups

source 'http://rubygems.org'

...
...
...


group :development, :test do
  gem 'ruby-debug19', :require => 'ruby-debug'
  gem 'web-app-theme', '>= 0.6.2'
  gem 'faker'
  gem 'mailcatcher'
  gem "pry"
  gem 'annotate'
  gem "unicorn"
  gem "capistrano"
end

The important Thing over here is ruby-debug19 now in my config/application.rb I have defined

  Bundler.require *Rails.groups(:assets => %w(development test))

Still when I start my server

rails server --debugger

it give me this below error

`require': no such file to load -- ruby-debug (LoadError)

I have remove the ruby-debug19 from development group and put it in default it the server works

I compared the both the Gemfile.lock in either case

cat Gemfile.lock > intial_lock (When ruby-debug19 is in development group)

ran

bundle list cat Gemfile.lock > final_lock (When ruby-debug19 is in default group)

also did a

diff initial_lock final_lock

No difference indicating the file are same

I also tried with

Bundler.require(:default, :assets, Rails.env)

Still no success

Can anyone let me know why Bundler.require is not working the way it should have


Solution

  • Check if you have not fall into the .bundle directory trap in your application directory It happen when you any time run anytime bundle install with --without options

    Straight from bundle Gemfile manual

    After running bundle install --without test, bundler will remember that you excluded the test group in the last installation. The next time you run bundle install, without any --without option, bundler will recall it.

    just remove .bundle/config directory from your application directory please first check the content first before removing it

    Hope this help