Gemfile use local path in development and Gemfury source in production

634 Views Asked by At

I am developing both an app and a gem for it. The gem will be available from Gemfury when the app will be in production. But while developing, I would like to use the local path of the gem, so that I can modify both the gem and the app and see changes faster. How can I do this?

I know there is bundle config local.GEM GEM_PATH, but this only works for git sources, not for Gemfury.

I can set an env var and conditionally specify gems in the Gemfile, but I hope there is a better approach to this.

1

There are 1 best solutions below

4
On
if ENV['RAILS_ENV'] == 'development' 
  gem 'your_gem', path: '/path/to/gem'
else
  gem 'your_gem'
end

Then, locally, run

RAILS_ENV=development bundle install

It's a hack, for sure, but then again, so is all of this :)