mbigras
mbigras

Reputation: 8055

Twiddle wakka for semantic versioning

From thoughtbot:

~> 1.1 means that when you bundle install, you’ll get the highest-released gem version of thin between the range >= 1.1 and < 2.0

~> 3.0.3 means that when you bundle install, you’ll get the highest-released gem version of rails between the range >= 3.0.3 and < 3.1

From semver 2.0:

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

So then will ~>0.1.0 take you from 1.0.0 > x >= 0.1.0?

Also, is the v1.0.0 what people are referring to when they say they are working to "get the one point oh version" out the door? Even when there are two 0s after the 1.

Upvotes: 1

Views: 403

Answers (1)

Jonathan Allard
Jonathan Allard

Reputation: 19259

Basically with the twiddle-waka (~>), only the last digit can change.

~> 0.1.0 will not take you to anything beyond 0.1.x, hence not 1.0.0, not even 0.2.0.

In my opinion, to specify a version following semver intents, one would specify a minor twiddle-waka, eg. ~> 0.2. Thus you get functionality upgrades (to 0.3(.x), 0.4(.x), 0.x.y, even 0.10.99!), but not backwards-breaking changes (to 1.0 or 1.0.x).

And if you want to be able to have MAJOR change, so to go from 1.0 to 2.0 and 9.0 on the same spec, then I guess you don't really have a version specification! ;o)

That being said, some gems that are more fundamental/central to your project will probably benefit from being followed more closely, with a patch-level ~>, eg. ~> 4.2.17. (That's a strategy I employ for instance with Rails in a Rails project.) Basically, anything that would make the upgrade/step-up non-trivial.

(and yes, mentioning "one point oh" includes 1.0.0, 1.0.1 and so on)

Upvotes: 1

Related Questions