0

My bundle file doesn't appear to be pulling down a gem from a private repository properly.

Inside of my Gemfile, I have:

group :internal do
  gem 'private', git: 'ssh://git@internalserver.org:<port>/gems/private.git'
end

This runs, and verbose logging produces:

Updating ssh://git@internalserver.org:<port>/gems/private.git
Cloning into '/Users/<username>/.rvm/gems/ruby-2.0.0-p247/bundler/gems/private-ddec73caf50f'...
done.

When I navigate to /Users/<username>/.rvm/gems/ruby-2.0.0-p247/bundler/gems/, I see the correct repository cloned properly, with a gemspec with the correct name.

When bundler is finished running, gem list does not show the private gem. It produces an error when I attempt to require it.

I tried deleting the Gemfile.lock file in the repository and rerunning, and that did not work. All of the public gems in the Gemfile install correctly.

Relevant version numbers / software:

  • Bundler version 1.3.5
  • rvm 1.23.14
  • ruby 2.0.0p247
  • Atlassan Stash
Oeste
  • 1,041
  • 2
  • 7
  • 13

1 Answers1

2

Git gems are a Bundler-specific extension to Rubygems. The gem command does not know about these, so they're not listed by gem list. You can run bundle show to see the list of gems that are recognised by Bundler, which will include git gems.

To require the gem, you'll need to be sure that the load path is set up correctly by Bundler. There are three ways to do this:

  1. Call require 'bundler/setup' in your app. This is typical for Rails apps. More on Bundler.setup
  2. Call bundle exec <command> to run the command. This is more common when running commands from a gem, such as rake or rspec. More on bundle exec
  3. Create binstubs for commands that you run frequently.

See http://bundler.io/v1.5/git.html for more information on git gems.

Tim Moore
  • 8,958
  • 2
  • 23
  • 34