HappyDeveloper
HappyDeveloper

Reputation: 12805

Rails bundler: how to undo bundle package?

How do I undo bundle package?

I deleted everything in vendor/cache but it is reinstalled there when I run bundle install.

Upvotes: 14

Views: 10988

Answers (8)

nikolayp
nikolayp

Reputation: 17919

You can check your config with (under your project directory):

bundle config

it outputs something like:

Set for the current user (/Users/user/.bundle/config): "--with-cppflags=-I/usr/local/opt/openssl/include"

In the config file you can check your config setting.

If there's no anything strange like:

BUNDLE_PATH: vendor/cache

You can easily remove vendor/cache directory and run bundle install again

In other way just remove the config variable from the file and repeat ^^

P.S. If you met gems storing under your project. It's probably previous developers worked with private repos and to avoid problems with deploy and private repositories, they solved to store the gems under project directory. So just make sure you will not break your deploy after removing the gems dir.

Upvotes: 1

user664833
user664833

Reputation: 19505

.bundle/config is telling bundler to put things in vendor/cache. Either remove the following two lines from .bundle/config or remove .bundle/config itself.

---
BUNDLE_PATH: vendor/cache
BUNDLE_DISABLE_SHARED_GEMS: '1'

Then run the following command to remove vendor/cache:

rm -rf vendor/cache

The next time you run bundle install you will not have this problem.

Upvotes: 4

Bongs
Bongs

Reputation: 5592

Pretty late to answer, but this was happening with me too. You probably have hidden directory .bundle in you application root directory. Remove that directory too and then run bundle command.

Upvotes: 3

Taryn East
Taryn East

Reputation: 27747

As per this answer: https://stackoverflow.com/a/9471980/219883

You must delete the hidden .bundle directory, then re-run bundle install - otherwise it will continue to add the vendor/cache directory back every time.

Upvotes: 13

Josnidhin
Josnidhin

Reputation: 12504

Bundler 1.2 has support for :git and :path but it has to be explicitly enabled like this

bundle package --all

Upvotes: 0

spier
spier

Reputation: 2752

This might help as well. For more details see the documentation on bundle install

bundle install --system

Upvotes: 3

nightf0x
nightf0x

Reputation: 2039

But if you just to remove a particular gem, then remove/comment the name of the gem from your project/Gemfile and then run bundle.

To prevent gem files from being added to the vendor/cache directory delete the vendor/cache directory from your project root.

The next time you will run bundle install gems won't create a vendor/cache folder.

Later on in your project if you need the vendor/cache folder all you'll have to do is to create the folder vendor/cache again.

Upvotes: 8

HappyDeveloper
HappyDeveloper

Reputation: 12805

$ rm vendor/cache -r
$ bundle install

Upvotes: 3

Related Questions