Pregunta

I have this in my Gemfile:

....
..
# Use Capistrano for deployment
group :development do
  gem 'capistrano', '3.0.1'
  gem 'capistrano-rails', '~> 1.1'
end

Now, if I go on my production server and do RAILS_ENV=production bin/bundle install it installs the capistrano gem as well. Which makes no sense to me, why would I need capistrano on a production server? So, in my understanding I do not find any use of group :development block in Gemfile for bundler. Is there anything I am doing wrong? How do I make sure that I do not install gems which are not required on production/staging but on local(development/test)? Please correct me if I am doing anything wrong here?

EDIT

Please note that I know we can use if ENV['RAILS_ENV'] == 'production' for gems which are not required for other environments. What I am looking for is the use of group in Gemfile for bundler.

¿Fue útil?

Solución

If you want to install only gems for production you can use this command:

bundle install --without development test

or for Heroku:

$ heroku config:add BUNDLE_WITHOUT="test development" --app app_name

This excludes the development and test environment. If you defined more groups you can add them at the end of this command.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top