alexs333
alexs333

Reputation: 12553

Bundler and hidden gems

I have an interesting error when installing gems directly from github (:git => 'whatever').

Firstly, when I remove all gems and run bundle install command, I get the following:

Installing gem1
Installing gem2
Using gem3 (the one from github)

Then when I want to check what I've got I see the following by using gem list:

gem1 (x.x.x)
gem2 (y.y.y)

No gem3... now, looking closer to the file system, I see the following:

ls -l ~/.rvm/gems/ruby-1.9.3-p125/gems
gem1
gem2

So where is gem 3? Not where I'm expecting it to be:

ls -l ~/.rvm/gems/ruby-1.9.3-p125/bundler/gems
gem3-213213213

So it goes under bundler/gems and is not visible to gem list... and by Capistrano deploy, which gives me following:

git://github.com/author/gem3.git (at master) is not checked out. Please run `bundle install`

I'm more worried about Capistrano unable to deploy... Anyone has any clues?

Upvotes: 2

Views: 304

Answers (1)

John Bachir
John Bachir

Reputation: 22711

Bundler gets its gems from various sources on your system. As long as they are the correct version, it will pull them in.

When deploying, it has more strict/conservative behavior.

From bundle help install, in the section about Deployment Mode, which is used when the --deployment flag is specified:

Gems are installed to vendor/bundle not your default system loca- tion

In development, it's convenient to share the gems used in your application with other applications and other scripts run on the system.

In deployment, isolation is a more important default. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permis- sion to read them.

As a result, bundle install --deployment installs gems to the ven- dor/bundle directory in the application. This may be overridden using the --path option.

Upvotes: 1

Related Questions