1

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.

linkyndy
  • 17,038
  • 20
  • 114
  • 194

1 Answers1

2
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 :)

GoGoCarl
  • 2,519
  • 13
  • 16
  • It doesn't work, since in the latest bundler versions you cannot specify a gem more than one time inside a `Gemfile`. – linkyndy Feb 03 '16 at 09:33
  • Ah, you are right! Sorry about that. Ok, perhaps try the above. It's kind of annoying and hack-ish, but it should do the job. – GoGoCarl Feb 04 '16 at 21:07
  • I will note that I have the same issue as you in one of my projects, and I just find it easier to edit the file manually while I am working locally. – GoGoCarl Feb 04 '16 at 21:08
  • I can edit it, but it's both cumbersome and error prone, since you might commit the local path with the Gemfile. – linkyndy Feb 05 '16 at 10:06