[Rubygems-developers] Working on a fork of a ruby gem - installing gems in a special way
vladimir at geekq.net
Mon May 25 07:23:19 EDT 2009
Hi Eric, hi all,
I have a question not about developing, but about using rubygems.
Sorry if it is kind of offtopic. But this question can be only
answered by real rubygems gurus.
USECASE: working on an own fork of a ruby gem
Imagine, you are using a particular gem within your application and
found some bug or missing feature and wish to improve the gem.
The source code of a gem is hosted at github. So it is easy to clone
the source code. What next?
I've tried following approaches. All of them are either cumbersome or
error prone or both:
## Repeatedly reinstall
1. uninstall the current gem version `sudo gem uninstall foo`
2. switch to my version `cd myversion_of_foo`
3. edit the source code (apply the changes)
4. create a gem from my sources `rake gem`
5. install my version of the gem `sudo gem install pkg/foo-1.0.0.gem`
6. try out in connection with my (bigger) project
7. repeat all the steps for each change
OK, one should work on a feature in a test-driven way and in
isolation, which should reduce the amount of install/uninstall
iterations, but still ...
## symbolic links
1. install the gem
2. goto to the system wide folder for installed gems
3. remove or backup the lib folder `rm -rf lib`
4. create a symbolic link to your implementation's lib folder
Editing the source code of the gem will have an immediate effect
on the using application.
## load path
explicitly change the load path in the client application
`$:.unshift 'myversion_of_foo/lib'` or put a require statement with
explicit full path.
Now imagine there is a chain of libraries with dependencies
ClientApp -> A -> B -> C -> D and you are going to improve the
library B. Changing require statements leads to a real mess.
# Perfect solution
Is there a better/perfect way?
How the tools of rubygems support this or could support this in the future?
Thanks and Best Regards,
Vladimir Dobriakov AKA geekQ
More information about the Rubygems-developers