Bird
0
0

Which Bundler command should you run to update the lock file accordingly?

hard📝 Application Q8 of 15
Ruby - Gems and Bundler
You have updated the version constraints of gems in your Gemfile and want to ensure all machines use the exact same gem versions. Which Bundler command should you run to update the lock file accordingly?
Abundle update --lock
Bbundle install
Cbundle lock --update
Dbundle install --deployment
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of the lock file

    The Gemfile.lock records exact gem versions to ensure consistency across environments.
  2. Step 2: Identify the correct command to update the lock file

    Running bundle install after modifying the Gemfile updates the Gemfile.lock with resolved versions.
  3. Step 3: Evaluate other options

    bundle update updates gems to latest allowed versions but may change more than intended; bundle lock --update is not a valid command; bundle install --deployment installs gems using the lock file but does not update it.
  4. Final Answer:

    bundle install -> Option B
  5. Quick Check:

    Run bundle install to update Gemfile.lock [OK]
Quick Trick: Run bundle install to update Gemfile.lock [OK]
Common Mistakes:
  • Using bundle update unnecessarily
  • Assuming bundle lock --update exists
  • Confusing install with deployment flags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes