Rails 3的Bundler“捆绑安装 - 部署”到底做了什么?

时间:2022-05-23 12:00:57

The things described in the formal documentation are a bit complicated.

正式文档中描述的内容有点复杂。

Does it merely add the following line to .bundle/config

它只是将以下行添加到.bundle / config

BUNDLE_PATH: vendor/bundle

and then perform a bundle install, and that's it? (install will then install all the gems into vendor/bundle)

然后执行捆绑安装,就是这样吗? (然后安装将所有gem安装到vendor / bundle中)

Then when the application runs, it will look for the gems in this path specified in .bundle/config, and that's it?

然后,当应用程序运行时,它将在.bundle / config中指定的此路径中查找gems,那就是它?

Update: if I use Mercurial (similar to Git) to keep track of files in project, then after doing the bundle install --deployment, the only changes are a lot of files added to vendor/bundle, and 2 lines added to .bundle/config:

更新:如果我使用Mercurial(类似于Git)来跟踪项目中的文件,那么在执行bundle install --deployment之后,唯一的更改是添加到vendor / bundle的很多文件,并且添加了两行.bundle /配置:

BUNDLE_FROZEN: "1"
BUNDLE_PATH: vendor/bundle

1 个解决方案

#1


9  

bundle install --deployment does indeed install the gems locally to the vendor/bundle directory in the application. This is reflected by the config change in the path setting which you mentioned (BUNDLE_PATH: vendor/bundle). This approach is known as "freezing" or "vendoring" the gems and it forces the application to use the locally installed gems, rather than the global system gems,which is convenient default for deployment. As mentioned in bundler documentation:

bundle install --deployment确实将gem本地安装到应用程序中的vendor / bundle目录。这通过您提到的路径设置中的配置更改(BUNDLE_PATH:vendor / bundle)反映出来。这种方法被称为“冻结”或“销售”宝石,它强​​制应用程序使用本地安装的宝石,而不是全局系统宝石,这是部署的方便默认值。如捆绑文档中所述:

"In deployment, isolation is a more important default. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them."

“在部署中,隔离是一个更重要的默认设置。此外,部署应用程序的用户可能没有权限将gem安装到系统,或者Web服务器可能没有读取它们的权限。”

#1


9  

bundle install --deployment does indeed install the gems locally to the vendor/bundle directory in the application. This is reflected by the config change in the path setting which you mentioned (BUNDLE_PATH: vendor/bundle). This approach is known as "freezing" or "vendoring" the gems and it forces the application to use the locally installed gems, rather than the global system gems,which is convenient default for deployment. As mentioned in bundler documentation:

bundle install --deployment确实将gem本地安装到应用程序中的vendor / bundle目录。这通过您提到的路径设置中的配置更改(BUNDLE_PATH:vendor / bundle)反映出来。这种方法被称为“冻结”或“销售”宝石,它强​​制应用程序使用本地安装的宝石,而不是全局系统宝石,这是部署的方便默认值。如捆绑文档中所述:

"In deployment, isolation is a more important default. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them."

“在部署中,隔离是一个更重要的默认设置。此外,部署应用程序的用户可能没有权限将gem安装到系统,或者Web服务器可能没有读取它们的权限。”