What Bundler & Gemfile left for this course

Free preview 3 min to read

A deferral, quoted

The closing lesson of "Bundler & Gemfile", "Putting it together: from Gemfile to running app", says what that course chose not to teach:

Publishing a gem, resolving a real version conflict between two gems that can't agree, and Bundler's more advanced commands like bundle update weren't this course's job. This course's job was the everyday path, declaring a dependency, understanding what got locked, and knowing when bundle exec matters, ground solid enough to build on later.

Two of those three deferred topics are this course's job. Publishing a gem stays out of scope here too, since it's a different skill from versioning.

What that course already covered, briefly

One paragraph of recap, not a re-teach. ~>, the pessimistic constraint, lets the last given version segment rise and locks everything to its left. That course showed it with this app's gem "rails", "~> 8.1.3" resolving to 8.1.3.1, and gem "pg", "~> 1.1" resolving all the way to 1.6.3. >= sets a floor with no ceiling: gem "puma", ">= 5.0" resolved to 7.2.0 then and resolves to 8.0.2 now. Gemfile.lock is the resolved snapshot, and bundle install is what produces and trusts it. This course assumes all of that.

Bundler's version, in this app

$ tail -3 Gemfile.lock
BUNDLED WITH
   2.6.8

That's from this project's Gemfile.lock. The commands in this course ran with that Bundler, 2.6.8.

What this course covers

Lesson 2 covers the semver spec itself, MAJOR.MINOR.PATCH, and this app's gems that follow it and, in one case, deliberately don't. Lesson 3 checks ~>'s exact boundary against Ruby's own Gem::Requirement class, and shows compound constraints already in this app's Gemfile.lock. Lesson 4 shows that most of this app's Gemfile pins nothing at all. Lesson 5 covers bundle update, the command the last course skipped, using Bundler's documentation and this app's bundle outdated output. Lesson 6 builds and resolves a version conflict between two gems in a disposable scratch project, never in this app's own. Lesson 7 puts it together, with a small plain-Ruby challenge that models the rule from lesson 3.

How the examples were checked

The version numbers, constraints and bundle outdated output in lessons 1 to 5 come from this app's Gemfile, Gemfile.lock and commands run against it when this course was revised. Versions move, so your own run will show different numbers. The conflict in lesson 6 was reproduced in a separate scratch project.

Lesson 1 of 7 · free

Keep going with lesson 2

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.

A free account also gives you the quizzes, your progress and notes, and the discussion.

Type to start searching...