Say I have a gem living happily at:
/MyPath/MyGem.gem
And I want to use the local and unique gem rather than a gem version from Github, or wherever it fetches it from.
How do I specify I want to use gem "mygem"
from /MyPath/MyGem.gem
Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.
You can download gems from https://rubygems.org/gems/ or build you local gem via bundle and rack. eg: bundle gem yourGemName. rake install.
The Gemfile is wherever you want it to be - usually in the main directory of your project and the name of the file is Gemfile . It's convenient to have one because it allows you to use Bundler to manage which gems and which versions of each your project needs to run.
Try, in your Gemfile
:
gem "mygem", :path => "/MyPath/MyGem.gem"
Note that it's probably best to use a relative link in there, like:
gem "mygem", :path => "vendor/MyPath/MyGem.gem"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With