开发者

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

开发者 https://www.devze.com 2023-03-12 01:22 出处:网络
I know they both put the gems in your app in different locat开发者_高级运维ions but it seems as if bundle install --deployment does a more thorough job. Can I just add the vendor/bundle directory it c

I know they both put the gems in your app in different locat开发者_高级运维ions 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?


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消