Bundler: semantic versioning
This course covers semantic versioning as Bundler applies it, using a Rails app's Gemfile and Gemfile.lock. It explains what MAJOR, MINOR and PATCH each promise, and why Rails adds a fourth segment for security releases. It checks the boundaries of the ~> constraint with Ruby's Gem::Requirement class and reads compound constraints from the lockfile. It also looks at Gemfile lines with no constraint and at how bundle update behaves with and without a gem name. Finally, it reproduces a version conflict between two gems in a scratch project.
What you'll learn
- ✓What MAJOR, MINOR and PATCH mean in the semver spec, and how pre-release versions rank
- ✓Where the ~> constraint sets its ceiling with two segments and with three
- ✓How compound constraints such as >= 1.6, < 2 work in a gemspec or Gemfile
- ✓How Bundler treats Gemfile lines with no version string
- ✓The difference between bundle update --all, bundle update GEM_NAME and options like --conservative
- ✓How to read a Bundler resolver failure and fix the conflicting constraint
What Bundler & Gemfile left for this course
The closing lesson of "Bundler & Gemfile", "Putting it together: from Gemfile to running app", says what that course chose not to teach:
Read the full lesson free →Curriculum
7 lessonsWhat Bundler & Gemfile left for this course
Sets the scope: semver, ~> boundaries, unconstrained gems, bundle update and a version conflict, using Bundler 2.6.8.
MAJOR.MINOR.PATCH: the rule
Explains what MAJOR, MINOR and PATCH promise, why Rails is at 8.1.3.1, and how pre-releases rank.
What ~> locks, checked by running it
Runs Gem::Requirement to show the two-segment and three-segment ~> ceilings, plus compound constraints from Gemfile.lock.
Most of this Gemfile pins nothing at all
Shows that 25 of 40 Gemfile lines carry no constraint, and that bundle outdated lists them as >= 0.
bundle update: the command the last course skipped
Compares bundle update --all with updating one gem, covers --conservative, and sorts outdated gems by bump size.
A conflict between two gems, reproduced safely
Reproduces a lexxy and rails conflict in a scratch project, reads the resolver output and fixes the constraint.
Putting it together: reading a version bump before you trust it
Connects the lessons to reading version bumps before applying them, and introduces a plain-Ruby challenge modeling the ~> rule.