简体   繁体   中英

How do I add a local custom gem with RVM or otherwise?

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.

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.

您可以通过此路径安装gem

gem install path/my_gem.gem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM