GEM_PATH
15 Apr 2014I’m writing this as more of a note to myself than to you. In Ruby GEM_PATH
environment variable is where rubygems will look for installed gems. Hidden in in the docs is:
RubyGems’ default local repository can be overridden with the GEM_PATH and GEM_HOME environment variables. GEM_HOME sets the default repository to install into. GEM_PATH allows multiple local repositories to be searched for gems.
On Heroku we can see it used by calling env
:
$ env
# ...
GEM_PATH=/app/vendor/bundle/ruby/2.1.1:vendor/bundle/ruby/1.9.1
The second part is for legacy reasons. In the case of codetriage, the first part is where our gems are stored.
This is what the directory structure looks like:
$ ls /app/vendor/bundle/ruby/2.1.1
bin build_info bundler doc extensions gems specifications
You don’t actually point GEM_PATH
at the < directory >/gems
path but rather the top level dir where bin/
, doc/
, and gems/
all live. It might be stupid to write down, but it’s been confusing to me more than a few times.
Hopes this helps future me.