开发者

How do I change the ~/.bundler directory location?

My home directory is a mounted NFS share and the local root doesn't have permissions to enter my user directory and it causes some errors when bundler removes the cached folders. (See sample out开发者_开发技巧put of 'bundle install' below).

I'd like to move the ~/.bundler directory to local disk, if possible. I've been able to move my gems and rvm folders, but I can't for the life of me figure out where to change the bundler directory.

Anyone know how to do this?

$ bundle install
Checking out files: 100% (140/140), done.
Checking out files: 100% (9/9), done.
Fetching source index for http://rubygems.org/
Enter your password to install the bundled RubyGems to your system: 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/rake-0.8.7.gem': Permission denied
Using rake (0.8.7) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/abstract-1.0.0.gem': Permission denied
Using abstract (1.0.0) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/activesupport-3.0.7.gem': Permission denied
Using activesupport (3.0.7) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/builder-2.1.2.gem': Permission denied
Using builder (2.1.2) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/i18n-0.5.0.gem': Permission denied
Using i18n (0.5.0) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/activemodel-3.0.7.gem': Permission denied
Using activemodel (3.0.7) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/erubis-2.6.6.gem': Permission denied
Using erubis (2.6.6) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/rack-1.2.2.gem': Permission denied
Using rack (1.2.2) 
mv: cannot remove `/auto/home2/borgnk/.bundler/tmp/9517/cache/rack-mount-0.6.14.gem': Permission denied
...


You can always customize how bundle installs by passing an argument to the installer:

bundle install --path /some/path

This is useful for the case you highlight, or in cases where a shared directory will be used by different platforms or Ruby versions.

Update:

It should be possible to re-position the ~/.bundler directory by setting your $HOME environment variable to be something that will work, which in effect alters what ~ interprets as. Bundler appears to use the method Gem.user_home method to determine where to put this file, so if you can fake that out you are set.

This could be as simple as:

HOME=/some/home bundle install --path /some/path


It looks like it's fairly hard-coded if you look a the bundler.rb file. I'd say your best bet would be to fork Bundler and make the change yourself. Or you could always submit a feature request.


May be you can create a symbolic link for .bundler and point it to a folder to which bunlder can write. Or else you will have to folk bundler like aNoble suggested.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜