Bundle install selected group into custom path

2019-09-04 01:33发布

问题:

As a follow up to Bundle deployment only for selected gems, using the solution of blacklisting using --without option, for example:

group :runtime do
  gem 'rails'
  ...
end
group :runtime_unpackaged do
  gem 'less2sass'
end

The runtime_unpackaged can be installed using the command:

bundle --path vendor/bundle --without runtime

The runtime group is installed through debian packages as the application itself is packaged as a .deb package.

But then all other gems at group runtime won't be handled anymore by the application as this command will create a file .bundle/config that filters them out.

In other words, I want to load the application using gems from the system - debian jessie packages - (group runtime) and also gems installed locally at vendor/bundle (group runtime_unpackaged).

回答1:

If you want to run Bundler and have it load both groups, you should just be able to run bundle install and leave out the --without flag. You can also set specific groups to get run with bundle install in your application.rb file using Bundler.require(:group1, :group2, etc..). Check out Bundler.io's section on groups