Using "custom" ruby gems

Hello! I’ve been struggling with this for a few days, so any help is appreciated!

I’m developing a fork of a plugin that requires the discordrb ruby gem. For whatever reason, the most up to date version on discordrb | RubyGems.org | your community gem host is 3.4.0, which is about two years old and buggy.

Luckily, there’s an up to date version of the plugin that exists here GitHub - shardlab/discordrb: Discord API for Ruby, but hasn’t been able to be published to RubyGems :confused:

How can I go about using the github version of this gem/dependency? I feel like I’ve tried just about everything.

1 Like

Have you seen?: Discord Bot Construction Kit 🤖

It’s still under active development. Speaking to the developers recently the next version will be out “when it’s done”. Amongst other things they are working on Threading support.

These are the same thing. It’s just that the gem document only claims 3.4.0 as latest. The other is the official repo. If you click the Homepage link on your first link it takes you to your second link ;). I have no idea why the gem document does not list 3.4.1.

You can reference a GitHub repo if you really have to: rubygems - Install Gem from Github Branch? - Stack Overflow

1 Like

I have! I’m pretty sure our plugin is a fork of a fork of that. We require some specific logic in our case, so it makes sense to develop our own version.

What would this look like in the discourse setting? I feel like I’ve tried every method of declaring the dependency via github in plugin.rb already (check our commit history :smile:)

Our build fails with every gem syntax I’ve tried that tries to point to the github source. I’m pretty sure it has to do with how discourse/plugin_gem.rb at main · discourse/discourse · GitHub tries to find the .gemspec file for plugin gems. Would you be able to give me the steps for a workaround?

1 Like

Hi @FerrariFlunker
Here’s in an example of of an official plugin which uses a local copy of the holidays gem. I think you can use a similar pattern in your case.

Here’s how its included.

1 Like

A local version of the git repo (note: cannot be a submodule, has to be a true local copy) and the libdir inclusion lines worked perfectly! Thank you so much for your help, it’s incredibly appreciated @fzngagan and @merefield :+1:

Hopefully this topic will help others find this answer, it’s been quite the journey to figure this out :smile:

2 Likes

You can also publish the gem via github packages. Publishing a Ruby Gem to the GitHub Package Registry | michaelheap.com

3 Likes