Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundler --without is not excluding gem installation of provided groups

I have the following Gemfile

source "http://rubygems.org"

gem "bundler", "1.10.6"
gem "unicorn", "4.8.2"

group :supply do
  gem "backup", "4.1.10"
end

group :bunker do
  gem "capistrano", "3.4.0"
  gem "capistrano-rbenv", "2.0.3"
  gem "capistrano-bundler", "1.1.4"
  gem "capistrano-rails", "1.1.3"
  gem "capistrano-nc", "0.1.4"
end

group :reinforcement do
  gem "actionview", "4.2.1"
  gem "actionmailer", "4.2.1"
  gem "mail", "2.6.3"
  gem "daemons", "1.2.3"
  gem "tmail", "1.2.7.1"
  gem "activerecord", "4.2.1"
  gem "starling", "0.10.1"
end

I have many type of servers and want to install specific gems on specific servers eg. backup gem only on supply server etc.

When I run the following bundle install command

bundle install --clean --without supply bunker --path /tmp/

I am getting the following error.

Bundler could not find compatible versions for gem "mail":
  In Gemfile:
    mail (>= 2.5.4, ~> 2.5) ruby

    backup (= 4.1.10) ruby depends on
      mail (= 2.5.4) ruby

    mail (= 2.6.3) ruby

If without is to exclude gem of certain group then the command should run just fine because it should never try to install mail and backup because they are not in the same group.

Am I missing something or doing anything wrong?

like image 745
bitkot Avatar asked Dec 30 '25 09:12

bitkot


1 Answers

Found that bundler checks for conflict even between group for consistency.

Here's an article checkout the Consistency part.

This means that even though bundler will not install the gems in other group it will still make sure that there is no conflicting dependencies between gems in all the groups.

I had to create multiple Gemfile and Gemfile.lock for each server.

like image 194
bitkot Avatar answered Jan 01 '26 23:01

bitkot