Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between bundle install --deployment and bundle pack

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?

like image 601
concept47 Avatar asked Jun 10 '11 00:06

concept47


People also ask

What is the difference between bundle install and bundle update?

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.

What is bundle installation?

bundle install is a command we use to install the dependencies specified in your Gemfile.

How do you deploy bundles?

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).

What is bundle install in rails?

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.


3 Answers

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.

like image 183
Gonzih Avatar answered Sep 19 '22 16:09

Gonzih


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

like image 27
Matthew Lehner Avatar answered Sep 17 '22 16:09

Matthew Lehner


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/

like image 21
indirect Avatar answered Sep 18 '22 16:09

indirect