Reputation: 3499
I'm developing a gem with Jeweler in a custom directory. I want to be able to require the gem within any app (and also the executables files from $PATH), and without needing to build and install the gem each time I modify it.
I thought about 2 ways:
But I bet there is a proper way to do this.
Upvotes: 3
Views: 116
Reputation: 13
No need to mess around with your Gemfile
require 'bundler/setup'
will put the right gem into your $LOAD_PATH
and allow you to require it on the next line.
#!/usr/bin/env ruby
require 'bundler/setup'
require '<gem-name>'
Upvotes: 0
Reputation: 53319
You can specify a local path in the gem command:
gem 'your-gem', '1.2.3', :path => 'path/to/your-gem'
Update: As @Nick points out in the comments,
This is specific to using bundler. In general, it's just require '/path/to/your-gem.
I'd like to add, however, that if you're using a custom-developed gem, bundle will probably make your life easier if you're not already using it. This is because with bundler, when you're done developing the gem (or at a stable/release point) you can load a gem directly from a github repository like this:
gem 'your-gem', :git => '[email protected]:you/your-gem.git'
Upvotes: 4