views:

432

answers:

1

Recently I started using a gem called blackbook. The gem has a few issues that I would like to fix. I cloned the git repo and installed the gem locally, hoping I could mess with the source code. When I edit the source code nothing happens, so now I am thinking that I must rebuild the gem every time I make a change.

My question is this: Should I be able to edit the source code of the gem and see results immediately, or should I use the source code as a plugin to my rails app, and then rebuild the gem only when I have made significant progress?

Thank you,

Tony

+1  A: 

You can mess with the source code of the installed gem to change the behavior of what you have installed. But unless you are playing path games this won't affect the gem itself even if you rebuild.

What I generally do is this:

  • Set up a development area where I can make changes & test them (e.g. run unit tests, spec, etc.)
  • Do most of my work there
  • When I've got something I like, rebuild the gem and try a test install
  • If that works to my satisfaction, push it.

Also, if you are using git hub they should automatically rebuild the gem for you every time you push a commit with an updated gemspec (e.g., you've changed the version number).

MarkusQ
My problem is that I am having trouble setting up the dev area. I have the git repo cloned in its own dir. Now I need to have a file where I run tests on the plugin code. If I try to put require 'blackbook' at the top of the test file, I get an error because the gem is not installed.
Tony
If the file is only used locally for testing, put a more detailed path in the require. E.g. "require '../lib/blackbook'" or whatever. Also, consider using one of the testing frameworks, which can make your life a lot easier.
MarkusQ
i think my question was just too general to get the specific response that i want. you definitely gave some great hints so i am going to close this question...but i just wanted to know which testing framework do you use?
Tony