Andrew H
Andrew H

Reputation: 677

How do I not bundle package :path gems?

In our project, we ran bundle package --all one time, which according to documentation, remembers the "--all" option in subsequent calls. If I want to test a gem on my project by hardcoding it's path into the Gemfile such as: gem 'blocks', :path => "/Users/hunterae/Projects/blocks", anytime I run bundle install, all of the source code for this gem will be copied into my /vendor/cache directory. This means that if I make a change to the gem I am testing, I have to shut down my rails server and run bundle install again, whereas before "bundle package --all" was run, I used to be able to just stop and start my rails server.

My question is how do I get "bundle package" to once again only package gems and not try and cache :path gems? Where is the "--all" option remembered in bundler?

Upvotes: 1

Views: 604

Answers (2)

awenkhh
awenkhh

Reputation: 6131

+1 to the answer form Tim Moore. Following is an addition to it.

You should avoid using :path in your Gemfile if possible and if working with a gem available on github. Since Bundler 1.9 you can use sth. like

bundle config local.name_of_gem /path/to/checked_out/repo

This will add an entry in ~/.bundle/config like

less ~/.bundle/config
---
BUNDLE_LOCAL__NAME_OF_GEM:     
"/path/to/checked_out/repo/name_of_gem"

You can remove the config with the same command and including --delete like

bundle --delete config local.name_of_gem /path/to/checked_out/repo

This will avoid many problems and is easy to maintain.

Upvotes: 0

Tim Moore
Tim Moore

Reputation: 9492

Look in .bundle/config in your project directory for a line that says BUNDLE_CACHE_ALL: true.

Delete that line to make it revert to packaging only standard gems.

In general, remembered options are stored in .bundle/config.

Upvotes: 1

Related Questions