The things described in the formal documentation are a bit complicated.
Does it merely add the following line to .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
)
Then when the application runs, it will look for the gems in this path specified in .bundle/config
, and that's it?
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
:
BUNDLE_FROZEN: "1"
BUNDLE_PATH: vendor/bundle
When you make a change to the Gemfile(5) and then run bundle install , Bundler will update only the gems that you modified. In other words, if a gem that you did not modify worked before you called bundle install , it will continue to use the exact same versions of all dependencies as it used before the update.
In Rails, bundler provides a constant environment for Ruby projects by tracking and installing suitable gems that are needed. It manages an application's dependencies through its entire life, across many machines, systematically and repeatably. To use bundler, you need to install it.
bundle update is a command provided by the Bundler gem which will update all your gem dependencies to their latest versions. Providing you have a Gemfile. lock pre-existing, running bundle install will only install the versions specified in the Gemfile.
The executables bundle & bundler have the same functionality and therefore can be used interchangeably. You can see in the bundler/exe directory that the bundler executable just loads the bundle executable. It seems to me that the bundle command is more commonly used than the bundler command.
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:
"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."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With