Tom Rossi
Tom Rossi

Reputation: 12066

Specify gems specific for Heroku

Is there a way to specify gems that are only installed when deploying to Heroku? I want to be able to have two production environments, one that is on Heroku and on that is not.

Upvotes: 1

Views: 56

Answers (2)

mipadi
mipadi

Reputation: 410662

You can use groups in your Gemfile, like so:

group :heroku do
  gem 'something_that_should_only_be_installed_on_heroku'
end

Then, locally, install your Gemfiles with:

$ bundle install --without heroku

Upvotes: 0

deefour
deefour

Reputation: 35360

You can set a :heroku environment (or any other string) separate from :production for a heroku application. From the documentation:

heroku config:set RACK_ENV=heroku RAILS_ENV=heroku

Create your config/environments/heroku.rb for this environment, just like any other. Now you can specify a :heroku group in your Gemfile too.

Upvotes: 2

Related Questions