Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add the gem I'm developing to be loaded automatically by rubygems without build/install?

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:

  • I make a symlink to $GEM_HOME/gems and $GEM_HOME/bin
  • I add the bin directory to $PATH and the lib directory to rubygems to be loaded.

But I bet there is a proper way to do this.

like image 463
Zequez Avatar asked Dec 04 '25 13:12

Zequez


1 Answers

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'
like image 98
Ben Lee Avatar answered Dec 07 '25 05:12

Ben Lee