Reputation: 33
I'd like to use the local version of a gem without installing it. I have the released version of the gem installed though. I'm not using bundler either.
For example, I have a gem foo
installed. I've cloned its source, modified the source and built the gem (but not installed). How do I include this new local version into my ruby file?
Upvotes: 1
Views: 237
Reputation: 5773
You can use the -I
option in ruby.
-I directory
Used to tell Ruby where to load the library scripts. Directory path will be added to the load-path variable ($:).
ruby -I /path/to/your_gem/lib <your_file.rb>
Upvotes: 1
Reputation: 8212
Most gems have a file (usually loading a module) that loads all the associated objects. It should be at the root of the lib folder. The module usually has the name of the gem.
Either download the gem source code, or unpack the gem and then use a require statement pointing at the location of that file. For example for a foo gem it might look something like
require 'path/to/foo/gem/lib/foo'
The objects defined in the gem, should then be available to the current environment.
Upvotes: 0