# Using "custom" ruby gems

**URL:** https://meta.discourse.org/t/using-custom-ruby-gems/225274
**Category:** Development
**Created:** [April 26, 2022, 1:22am UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274 "2022-04-26T01:22:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![FerrariFlunker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ferrariflunker/32/258011_2.png) [@FerrariFlunker](https://meta.discourse.org/u/FerrariFlunker)
#### Post date: [April 26, 2022, 1:22am UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274/1 "2022-04-26T01:22:38Z")

</div>

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](https://rubygems.org/gems/discordrb/) 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 · GitHub](https://github.com/shardlab/discordrb), 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.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [April 26, 2022, 6:03am UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274/2 "2022-04-26T06:03:23Z")

</div>

Have you seen?: [Discord Bot Construction Kit 🤖](https://meta.discourse.org/t/discord-bot-construction-kit/122530)

> [@FerrariFlunker](#):
>
> For whatever reason, the most up to date version on [discordrb | RubyGems.org | your community gem host](https://rubygems.org/gems/discordrb/) is 3.4.0, which is about two years old and buggy.

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.

> [@FerrariFlunker](#):
>
> Luckily, there’s an up to date version of the plugin that exists here

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: [https://stackoverflow.com/questions/2823492/install-gem-from-github-branch](https://stackoverflow.com/questions/2823492/install-gem-from-github-branch)

---

<div class="post-metadata">

### Author: ![FerrariFlunker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ferrariflunker/32/258011_2.png) [@FerrariFlunker](https://meta.discourse.org/u/FerrariFlunker)
#### Post date: [April 26, 2022, 4:16pm UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274/3 "2022-04-26T16:16:39Z")

</div>

> [@merefield](#):
>
> Have you seen?: [Discord Bot Construction Kit :robot:](https://meta.discourse.org/t/discord-bot-construction-kit/122530)

I have! I’m pretty sure [our plugin](https://github.com/aloha-pk/discourse-discord-sync) 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.

> [@merefield](#):
>
> You can reference a GitHub repo if you really have to: [rubygems - Install Gem from Github Branch? - Stack Overflow](https://stackoverflow.com/questions/2823492/install-gem-from-github-branch)

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:)

![image](https://global.discourse-cdn.com/meta/optimized/4X/3/5/3/3535d1088b3c35496ef6225a9274ca6304e9d48d_2_690x26.png)

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/lib/plugin\_gem.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/lib/plugin_gem.rb) tries to find the .gemspec file for plugin gems. Would you be able to give me the steps for a workaround?

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [April 27, 2022, 11:41am UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274/4 "2022-04-27T11:41:14Z")

</div>

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.

> **[discourse-calendar/vendor/holidays at main · discourse/discourse-calendar](https://github.com/discourse/discourse-calendar/tree/main/vendor/holidays)**
>
> main/vendor/holidays

Here’s how its included.

> <https://github.com/discourse/discourse-calendar/blob/cb4f35f952db7888ab72d4ca7503bc0b3b20a6b1/plugin.rb#L10>

---

<div class="post-metadata">

### Author: ![FerrariFlunker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ferrariflunker/32/258011_2.png) [@FerrariFlunker](https://meta.discourse.org/u/FerrariFlunker)
#### Post date: [April 28, 2022, 4:09am UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274/5 "2022-04-28T04:09:03Z")

</div>

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:

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [April 28, 2022, 5:15am UTC](https://meta.discourse.org/t/using-custom-ruby-gems/225274/6 "2022-04-28T05:15:17Z")

</div>

You can also publish the gem via github packages. [Publishing a Ruby gem to the GitHub Package Registry | michaelheap.com](https://michaelheap.com/rubygem-github-package-registry/)
