How do I make Rails pick up gems from local source directories?

By : Pablo

I'm creating a few gems by extracting out parts of a Rails project that can be reused (and that I have duplicated in other Rails projects). The problem I have is that testing every change to the gems is now very slow.

Changing a Rails project is very fast as most of the time the change is re-loaded automatically, but changing a gem implies:

  • stop the rails server
  • go to the gem directory
  • run sudo rake install, which is very slow
  • go back to the rails project
  • re-run the rails server, which also is very slow

Is there a way for my Rails project to pick up the code from where I have the gem code, instead of the installed gem, to speed up development?

By : Pablo


You could run rake gems:unpack to unpack the installed gem into the vendor/gems directory, then make your edits there.

If you want to keep your code where it is, you can symlink from vendor/gems to it. It'll give you warning and it'll be nasty, but it'll work.

By : ScottJ

This video can help you solving your question :)
By: admin