Combining a fragmented gem inside a gem

I'm trying to create a gem for a project that has a dependency on an unnamed external gem :)

During development, I found a small error in an external project, and I added a single-line fix that resolves it. I sent the transfer request to github, but I have not had a response from the maintainer for some time.

I want to make my project accessible as a gem, but it will not work without this fix. What can I do? What would be the best way to fix this.

One of the options that I was thinking about was to create the pearl of a forked project and publish it under a tortuous name and depend on it. But I do not like the idea of ​​polluting the servers with such a stupid stone.

So, I was wondering if it is possible to associate an external stone with my application and install it together with my gem. What will be the cleanest and easiest way to do this?

+4
source share
3 answers

Have you considered overriding a function using native code? A few weeks ago I had a similar problem with some software, and I just overridden this function.

Since this was only one line you found, it seems like this would be the easiest solution, but I'm a little new to Ruby, so there may be a problem with this plan that I did not consider.

+2
source

You can publish it under a different name, and once the fellow supporter accepted your fix, you can delete your version.

+1
source

It is pretty simple, actually. In your Gemfile add a dependency like:

gem "nokogiri", :git => "git://github.com/tenderlove/nokogiri.git" 

To do this, you will also need to use a bunch to manage your gem, you can get more information about it here .

Another option is to add the code that you changed to the supplier’s directory in your gem and distribute it using your code, so you can simply add the main directory of this other gem to your download path and you can request it without any either problems.

To add something to the boot path you just do:

 $LOAD_PATH.unshift( File.join(File.dirname(__FILE__), '..', 'vendor', 'some_gem', 'lib') ) 

And you can directly request files in some_gem .

0
source

All Articles