What is the best way to handle gem bug fixes?

I have a gem (available on RubyGems) that relies on another gem. This dependent gem has a bug that I fixed recently. Unfortunately, this dependent stone is pretty much dead; he has not seen the update for many years, and the owner no longer works on GitHub, not to mention committing to this gem, so I do not expect my patch to be accepted - of course, not soon.

In light of this, what is the best way to handle a fixed version of this dependent gem? Do I expand it and upload a new stone (with a new name) into RubyGems and depend on it? Will I somehow pack my fixed version with my own gem?

+6
source share
1 answer

First of all, check out the LICENSE creepy pearls (and your code license too - make sure everything stays compatible).

Then - as you said - you have several options:

  • Include a fixed stone in your project and tell the supplier / gemfile to use the gem from this place.
  • Fork, fix and tell the package / gemfile to use the git repository.
  • Fork, fix, and re-release (this is an upstream option covering Open Source and its community).
  • A monkey-fix at runtime can also be a solution (slightly dependent on your code and code tolerance). Basically: don't do this at home! Leave it alone, at work!).

I would go with a fork, fix and re-release solution, but you may need to clear (in README) that this stone needs a new maintainer.

It depends on what you mean by "best" (... how best ...). The easiest one will probably be for the monkey patch, secondly, to include the gem in your repository and tell the provider / Gemfile to pick it from there. Also, no weird gem update will break your code. But then, if someday there will be corrections (by people like you :)), you will miss them.

+2
source

All Articles