指定 Gemfile 的路径

Specify path to Gemfile

如何告诉捆绑程序不在当前目录中搜索 Gemfile 而在其他地方搜索?

我想做

bundle install --some-option path/to/Gemfile

而不是

cd path/to & bundle install

您可以使用 --gemfile 选项:

--gemfile= The location of the Gemfile(5) which Bundler should use. This defaults to a Gemfile(5) in the current working directory. In general, Bundler will assume that the location of the Gemfile(5) is also the project's root and will try to find Gemfile.lock and vendor/cache relative to this location.

来源:Bundler manual