bundle
made.bundle install
- this "conservatively" will update Gemfile.lock. Only those gems that you change in the gemfile will change. Everything else will remain as it was.bundle update [somegem]
. This command will update only the specified gem and all dependencies necessary for it. The remaining gems will remain intact.bundle update
.bundle exec [command]
. Quote from the documentation: In some cases, launching files without bundle exec
may work if this file is part of the heme that is installed on your system and does not load any dependencies that could conflict with your bandl. However, this method is extremely unreliable and is the source of many problems. Even if everything seems to be working, it’s not a fact that it will work tomorrow or on another server. The next section, Executable Files, is about that.git checkout Gemfile.lock
or similar command for other SCMs.bundle exec
.rake foo
in the console, you run the Bundler sandbox code, because in fact it is not involved and does not start anywhere. The Bundler should be activated at the very beginning of the download and be able to replace the bootloader by slipping the necessary gem versions specified in Gemfile.lock to it. By running executable files directly, you are executing Ruby code before the Bundler could interfere with the dependency connection process. As a result, the code that you are counting on is not connected at all. Once this happens, everything becomes very unpredictable.bundle install --binstubs
bundle exec
, Bundler 1.0 offers a special flag - --binstubs
bin/cucumber
, for example, is equivalent to the bundle exec cucumber
command.rails
teamrails
command. Starting with version 3.0, this command first tries to start script/rails
from the current directory. And script/rails
in turn, first of all launches Bundler #This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
boot.rb
file boot.rb
in turn, is very nontrivial: require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
rails
executable file deliberately does everything possible to ensure that the Bundler sandbox startup logic works at the very beginning and uses Kernel#exec
to overload the current process if any gems still have time to boot.rails
can be run even more bundle exec
without bundle exec
.Source: https://habr.com/ru/post/120259/
All Articles