Rails bundler doesn't install gems inside a group

后端 未结 6 2184
面向向阳花
面向向阳花 2020-12-23 08:51

I have several gems including ruby-debug in a bundler group called :development. When I run the bundle command, these gems are ignored and it only installs the gems that are

相关标签:
6条回答
  • 2020-12-23 09:27

    In fact Rails loads the :development group automatically when in development environment. Check whether Rails.env in you App really returns "development".

    More Information about groups in Bundler: http://gembundler.com/groups.html

    0 讨论(0)
  • 2020-12-23 09:28

    I had the same issue and --with flag worked for me. You need to pass group name, which you want to include. Like that:

    bundle install --with development
    
    0 讨论(0)
  • 2020-12-23 09:41

    If you are using rails, there will be a file config written to a hidden dir called .bundle in your rails root directory:

    .bundle/config
    

    This file, in my case, held exactly the without settings.

    So I just deleted the .bundle directory:

    rm .bundle -r
    

    After that:

    bundle install worked again as expected.

    Using: bundler (1.5.2)
    
    0 讨论(0)
  • 2020-12-23 09:42

    Within a term session, it remembers the without option. If you first ran

    bundle install --without development 
    

    it remembers that you did this and will automatically repeat this for the next

    bundle install #remembers and includes --without development
    

    running something else, like bundle install --without nothing should clear the cache. Am I right?

    update 20150214: This is fixed in bundler 2.0, according to issue referenced in comment by @Stan Bondi (https://github.com/bundler/bundler/issues/2862). Thanks Stan.

    0 讨论(0)
  • 2020-12-23 09:46

    I had a similar problem - thin in staging ignored - and the solution was to put it out if staging into the 'global' space:

    gem 'thin'
    
    group :production do
      gem 'puma'
    end
    
    0 讨论(0)
  • 2020-12-23 09:47
        gem 'aws-s3'
        gem 'paperclip'
          group :test do
            gem 'rspec'
            gem 'waitr'
            gem 'faker'
          end
    
    gem 'rest-client', :group => :development
    gem 'cucuber-rails', :groups => [:development,:test]  (cucuber-rails gems comes under both group)
    
    bundle install --without development #(ignore development group gems)
    bundle install #(still bundle remembers --without development so result is still ignore development groups it will not install all gems)
    
    bundle install --without nothing #(just clearing cache, now all the gems to be loaded into the ruby loadpath)
    

    More

    0 讨论(0)
提交回复
热议问题