Search code examples
rubyrubygemsbundlervendor

Using bundler with "--path vendor", why are gems specified with ":git" not locally vendored?


I'm using bundler and have a Gemfile that looks like this:

source 'http://rubygems.org'
gem 'sinatra', '1.3.1'
gem 'httparty'
# ...etc...
gem 'my_custom_gem', :git => 'git@github.com:me/my_custom_gem.git'

When I run bundle install it fetches the necessary gems, including my custom gem, and installs them in the system gem directory. So far, so good. However, an issue arises when I try to vendor them into a project-local directory. When I run

bundle install --path vendor

It creates the "vendor" directory in my project root and installs all the regular gems there. So I see directories like

vendor/ruby/1.8/gems/sinatra-1.3.1
vendor/ruby/1.8/gems/httparty-0.8.1
...etc...

But it does not vendor the gem specified with a 'git' parameter. I expect to see but do not see anything like

vendor/ruby/1.8/gems/my_custom_gem-1.0.0

It continues to use the system-installed version of this gem. Any explanation for this? Any clean way to get this custom gem vendored as well?


Solution

  • Not supported right now, hopefully coming in Bundler 1.1:

    https://github.com/carlhuda/bundler/issues/67

    For now you'll have to do:

    cd vendor/ruby/1.8/gems/
    git clone git://github.com/foo/foo.git
    

    or similar