Bird
0
0

How does bundle exec affect the environment when executing a Ruby command?

easy📝 Conceptual Q1 of 15
Ruby - Gems and Bundler

How does bundle exec affect the environment when executing a Ruby command?

AIt installs missing gems before running the command
BIt runs the command using gems specified in the project's Gemfile.lock
CIt updates all gems to their latest versions before execution
DIt ignores the Gemfile and uses system-wide gems
Step-by-Step Solution
Solution:
  1. Step 1: Understand Bundler's Role

    Bundler manages gem dependencies for Ruby projects by locking gem versions in Gemfile.lock.
  2. Step 2: Effect of bundle exec

    When running a command with bundle exec, it ensures the command uses the exact gem versions specified in Gemfile.lock, isolating from system gems.
  3. Final Answer:

    It runs the command using gems specified in the project's Gemfile.lock -> Option B
  4. Quick Check:

    Does bundle exec isolate gem versions? Yes. [OK]
Quick Trick: Uses Gemfile.lock gems, not system gems [OK]
Common Mistakes:
  • Assuming it installs gems automatically
  • Thinking it updates gems
  • Believing it ignores Gemfile

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes