如何使用 RVM 或其他方式添加本地自定义 gem?

发布于 2025-01-06 00:41:21 字数 203 浏览 0 评论 0原文

我必须添加一个下载到本地计算机上的自定义 gem。如何将其与 Rails 一起安装?我还安装了 RVM。我尝试将其粘贴到 gems 文件夹中,但它没有安装。

我相信要安装一个 gem,您需要运行 setup.rb 文件,但这个 gem 似乎没有这个文件。有关如何安装此宝石的任何指示吗?

这非常重要,因为我认为这个 gem 具有依赖性并且正在阻止我的项目运行。

I have to add a custom gem which is downloaded onto my local machine. How do I get it installed with Rails? I also have RVM installed. I tried pasting it into the gems folder but it doesn't get installed.

I believe to install a gem you need to run the setup.rb file but this gem doesn't seem to have that present. Any pointers to how to get this gem installed?

It's very important because I think this gem has dependencies and is stopping my project from running.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傲世九天 2025-01-13 00:41:21

除了 @shingara 之外,您仍然可以将其添加到 Gemfile 中,但这取决于项目团队中的每个人都将 gem 放在同一位置。然后你可以这样做:

gem 'my_gem', '0.1.2.3', :path => '~/my_projects/my_gem_folder/'

当你捆绑时,它会从那里拉取并安装。

如果您正在自己做某事,您可以这样做,而不必担心撤下该项目的其他人不会在同一位置拥有该宝石。

编辑 除了您对 @shingara 的答案的评论之外,这还适用于不直接指向 .gem 文件,而是指向您的 gem 所在的文件夹。

Another option, in addition to @shingara's, is you can still add it to your Gemfile, but it will depend on everyone in your project team having the gem in the same location. Then you can do:

gem 'my_gem', '0.1.2.3', :path => '~/my_projects/my_gem_folder/'

And when you bundle, it'll pull and install from there.

If you're working on something by yourself, you can do this without worry that someone else who pulls down that project won't have that gem in the same location.

EDIT In addition to your comment for @shingara's answer, this works for not pointing straight to a .gem file, but to a folder that your gem resides in.

懒猫 2025-01-13 00:41:21

你可以通过这个路径安装gem

gem install path/my_gem.gem

You can install a gem by this path

gem install path/my_gem.gem
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文