如何防止bundler生成binstubs?

时间:2012-07-26 04:57:41

标签: bundler zsh

我在plugins=(git bundler)中使用oh-my-zsh.zshrc。所以,我不需要捆绑器来生成binstub。但捆绑者无论如何都会这样做。

➜ 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##*/}" "$@"

我的~/.bundle/config中也没有任何内容。

请帮我把kabosh放在不受欢迎的binstubs上!

3 个答案:

答案 0 :(得分:67)

Bundler基于每个应用程序生成binstub。如果您在过去的某个时刻运行bundle install --binstubs,Bundler会记住这一点并在您再次运行安装时生成binstub。要禁用它们,您可以运行bundle install --no-binstubs,也可以运行rm -rf .bundle/config。无论哪种方式,这将禁用binstub生成。

答案 1 :(得分:24)

选项--no-binstubs执行删除bundler 1.5.3中的记忆选项!

而是使用bundle config --delete bin,或编辑.bundle/config并从文件中删除BUNDLE_BIN行,然后从本地binstubs目录中删除不需要的文件。

示例:

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

答案 2 :(得分:1)

如果您在更改$HOME/users/.bundle/config文件后仍然收到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的行或将包bin更改为false BUNDLE_BIN: 'false'

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

如果再次运行bundle config,则应该看不到bin配置,或者您应该看到它设置为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应用程序都可以拥有自己的自定义.bundle / config

如果您更新了.bundle/configbundle

所有bundle install,则不应在bin目录中创建新文件

发现别的东西,有时它认为false是一个目录,所以最好只删除BUNDLE_BIN可能更简单的行。