2012-07-26 43 views
22

我在.zshrc中使用oh-my-zshplugins=(git bundler)。所以,我不需要捆綁器來生成binstubs。但捆綁商無論如何都會這樣做。如何防止bundler生成binstubs?

 
➜ bundle 
Using rake (0.9.2.2) 
... 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. 
 
✗ ls bin 
erubis  haml   nokogiri  rails  rake2thor rdoc   resque-web sass   scss   thor   tt 
guard  html2haml rackup  rake   rdiscount resque  ri   sass-convert thin   tilt 

誰叫binstubs獲取生成 - 我沒有通過一個選項,詢問他們。至少,我不認爲我是:

 
➜ which bundle 
/Users/david/.rbenv/shims/bundle 
➜ cat /Users/david/.rbenv/shims/bundle 
 
#!/usr/bin/env bash 
set -e 
export RBENV_ROOT="/Users/david/.rbenv" 
exec rbenv exec "${0##*/}" "[email protected]"

我沒有在我的~/.bundle/config東西要麼。

請幫我把kabosh放在不受歡迎的binstubs上!

回答

53

Bundler根據每個應用程序生成binstub。如果您在過去的某個時間點運行bundle install --binstubs,Bundler會記住並在您再次運行安裝時生成binstub。要禁用它們,您可以運行bundle install --no-binstubs或運行rm -rf .bundle/config。無論哪種方式,這將禁用binstub生成。

+10

我相信而不是刪除'。bundle/config'作爲一個整體,編輯它並刪除'BUNDLE_BIN'這行就足夠了。 – 2013-03-23 09:05:18

+8

'--no-binstubs'選項對我無效。我不得不手動編輯'.bundle/config'。 – 2013-09-01 11:24:37

+2

我不得不'rm -rf .bundle/config'。不過,你應該首先檢查它的內容。對我來說,它只有'BUNDLE_BIN:bin'這一行,這似乎是罪魁禍首。 – 2014-06-20 19:43:10

18

選項--no-binstubs確實不是刪除捆綁器1.5.3中記住的選項!

改爲使用bundle config --delete bin或編輯.bundle/config並從文件中刪除BUNDLE_BIN行,然後從本地binstubs目錄中刪除不需要的文件。

例如:改變你的$HOME/users/.bundle/config文件後

ianh$ cat .bundle/config 
--- 
BUNDLE_CACHE_ALL: "true" 
BUNDLE_BIN: bin 

ianh$ bundle install --no-binstubs 
Using rake (10.1.1) 
... etc etc ... 
Using bundler (1.5.3) 
Updating files in vendor/cache 
Your bundle is complete! 
Use `bundle show [gemname]` to see where a bundled gem is installed. 

ianh$ cat .bundle/config 
--- 
BUNDLE_CACHE_ALL: "true" 
BUNDLE_BIN: bin 

# see ... it didn't remove the option. 

ianh$->(15) bundle config --delete bin 

ianh$ cat .bundle/config 
--- 
BUNDLE_CACHE_ALL: "true" 

ianh$ bundle -v 
Bundler version 1.5.3 
1

如果你仍然得到binstubs它更可能你有另一個配置一些地方。爲了找出其中執行後續的命令

$ bundle config 
Settings are listed in order of priority. The top value will be used. 
gem.coc 
Set for the current user (/Users/username/.bundle/config): "true" 

gem.mit 
Set for the current user (/Users/username/.bundle/config): "true" 

gem.test 
Set for the current user (/Users/username/.bundle/config): "rspec" 

build.libv8 
Set for the current user (/Users/username/.bundle/config): "--without-system-v8" 

disable_multisource 
Set for the current user (/Users/username/.bundle/config): "true" 

bin 
Set for your local app (/Users/username/apps/ruby/rails_application/.bundle/config): "bin" 
Set for the current user (/Users/username/.bundle/config): "false" 

你在找什麼是bin信息。該信息爲您提供了其中包含配置信息的文件的路徑。你可以爲了解決這個問題要做的就是進入配置文件,並刪除,上面寫着BUNDLE_BIN: bin該行或更改包箱假BUNDLE_BIN: 'false'

vi /Users/username/apps/ruby/rails_application/.bundle/config 

如果運行bundle config又應該看不到垃圾桶的配置還是應該看到它被設置爲false。在這個例子中,我將我的設置設置爲false,以便得到這個新結果。

bin 
Set for your local app (/Users/username/apps/ruby/gscs_ci/.bundle/config): "false" 
Set for the current user (/Users/username/.bundle/config): "false" 

然而事情需要注意的是響應捆綁可以有自己的定製.bundle /配置每個Ruby應用程序

如果你更新所有的bin目錄你不應該創建新的文件.bundle/config當你ruby bundlebundle install

發現了別的東西有時它認爲false是一個目錄,所以可能會更好,只是刪除BUNDLE_BIN可能更簡單的行。