I know they both put the gems in your app in different locations but it seems as if bundle install --deployment does a more thorough job. Can I just add the vendor/bundle directory it creates to version control and be done?
The most common question I've heard about Bundler is about the difference between bundle install and bundle update . In a nutshell: bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler.
bundle install is a command we use to install the dependencies specified in your Gemfile.
A bundle deploy is the option that allows you to deploy an archive that will be extracted immediately upon deployment. If you'd like to deploy artifacts from an archive, you can do so via your UI or by using REST API or the JFrog CLI (on this link, see –explode).
Bundler makes sure that Ruby applications always use the exact gems and versions that you need while keeping a consistent environment and gem dependencies satisfied. This is done by ensuring that the gems you need are present in the development, staging, and production stages.
I use bundle install --path vendor/bundle
in development mode.
bundle install --deployment
will lock yor Gemfile.lock and will not update it when you change your Gemfile, so never use deployment option on development environment.
bundle install --no-deployment
will disable bundle deployment mode.
You can read that post about bundle usage in right way.
Have a look at the description of the two on Bundler's site.
Running bundle install --deployment
is to be run in the production environment, but will grab the gems from rubygems when run. Read more here under the 'Deploying Your Application' heading for the purpose of the --deployment
flag.
bundle package
is similar to the old rake rails:gems:freeze
command from Rails 2.3. It grabs the gems and packages them in vendor/cache. From the bundler site here:
You can use this to avoid a dependency on rubygems.org at deploy time, or if you have private gems that are not in a public repository
I explained the reasoning behind the --deployment mode flag at pretty great length in a talk I gave at RailsConf 2011. This blog post contains my notes for that talk, and (I hope) covers all of the reasoning behind the way --deployment works: http://andre.arko.net/2011/06/11/deploying-with-bundler-notes/
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