如何使用 RVM 或其他方式添加本地自定义 gem?
我必须添加一个下载到本地计算机上的自定义 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除了 @shingara 之外,您仍然可以将其添加到 Gemfile 中,但这取决于项目团队中的每个人都将 gem 放在同一位置。然后你可以这样做:
当你捆绑时,它会从那里拉取并安装。
如果您正在自己做某事,您可以这样做,而不必担心撤下该项目的其他人不会在同一位置拥有该宝石。
编辑 除了您对 @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:
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.
你可以通过这个路径安装gem
You can install a gem by this path