views:

169

answers:

1

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?

+2  A: 

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.

ScottJ
That reduces the time by only requiring the rails project to restart (it won't load automatically) but it removes source control, as you don't have it in vendor (for the gem that is); so it's useful for some stuff, but not everything. Nevertheless I've used that way for a little while. Thanks ScottJ.
J. Pablo Fernández