Path Reference in Gemfile

Gemfiles (the configuration file for bundler, a dependency manager for ruby) have a nice feature that allows for specifying the location of a dependency:

source "https://rubygems.org"
 # ...
    # bundler will take the specified version from the source repository:
   gem 'rake', '~> 0.9.2'

   # bundler takes this gem from the filesystem:
   gem 'mygem', :path => '/Users/home/.../gems/mygem'
 # ...

When the :path attribute is used, bundler goes to the filesystem and takes the gem from the specified location (without the :path attribute, it goes to the source - in this case https://rubygems.org). If the specified gem doesn’t have a proper .gemspec file, bundler won’t download its dependencies, and if you haven’t downloaded them before, your gem won’t work.

This a nice feature if you want to check how your gem works with your other gems that depend on it before commit.


comments powered by Disqus