如何防止bundler生成binstubs?

Dav*_* J. 33 zsh bundler

我用的哦,我的-zsh中有plugins=(git bundler)我.zshrc.所以,我不需要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##*/}" "$@"

我也没有任何东西~/.bundle/config.

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

ind*_*ect 75

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

  • `--no-binstubs`选项对我不起作用.我不得不手动编辑`.bundle/config`. (16认同)
  • 我相信不是删除`.bundle/config`作为一个整体,编辑它并删除`BUNDLE_BIN`行就足够了. (14认同)
  • 我不得不`rm -rf .bundle/config`.不过,你应该先检查一下它的内容.对我来说它只有`BUNDLE_BIN:bin`行,这似乎是罪魁祸首. (4认同)

ihe*_*gie 25

该选项--no-binstubs并不能去除想起选项打捆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
Run Code Online (Sandbox Code Playgroud)

  • 这是 Bundler 更高版本的更准确答案。 (3认同)

bra*_*-it 5

如果您在更改$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"
Run Code Online (Sandbox Code Playgroud)

您正在寻找的是bin信息。此信息为您提供包含配置信息的文件的路径。为了解决这个问题,你可以做的是进入配置文件并删除表示BUNDLE_BIN: bin该内容的行,或者将捆绑包更改为 falseBUNDLE_BIN: 'false'

vi /Users/username/apps/ruby/rails_application/.bundle/config
Run Code Online (Sandbox Code Playgroud)

如果您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"
Run Code Online (Sandbox Code Playgroud)

但需要注意的是,每个响应捆绑包的 ruby​​ 应用程序都可以有自己的自定义 .bundle/config

如果你更新了所有的,.bundle/config那么当你使用 rubybundle​​ 或bundle install

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