Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .tool-versions #20

Merged
merged 2 commits into from
Jun 27, 2022
Merged

Add .tool-versions #20

merged 2 commits into from
Jun 27, 2022

Conversation

duncanjbrown
Copy link
Contributor

Because the async gem, which is a (distant) dependency of github_changelog_generator, introduces a Ruby version constraint of >=3.1.1 for the 2.x series, bundling on a machine with Ruby 3.1.1 installed will result in a different Gemfile.lock (ie with async > 2) than bundling on a machine with an earlier Ruby version (which gets async < 2). If you're in the second group and your colleague is in the first, bundle install fails with an unhelpful error:

Your bundle is locked to async (2.0.3) from rubygems repository https://rubygems.org/ or installed locally, but that version can no longer be found in that source. That means the
author of async (2.0.3) has removed it. You'll need to update your bundle to a version other than async (2.0.3) that hasn't been removed in order to install.

In fact the behaviour of bundler here is quite confusing because it says that async (2.0.3) has been removed by the author, which isn't actually true — it's just that the version in the Gemfile.lock can't be reconciled with the local Ruby version. This incorrect error is a bug in bundler! They've fixed it, but haven't released it yet, afaics.

rubygems/rubygems#5525

Note that this only affects dev environments: github_changelog_generator is a development dependency only so the official Ruby version supported by dfe-analytics is still 2.7.

Alternative to pinning a Ruby version for dev is to explicitly depend on async < 2.0 in the gemspec, but that's a bit weird and mysterious considering it's not our direct dependency.

@misaka
Copy link
Contributor

misaka commented Jun 23, 2022

Ya, I was thinking of the same. Would you be ok with using asdf, though? I think it's a better solution and more ... future proof.

@duncanjbrown duncanjbrown changed the title Add .ruby-version Add .tool-versions Jun 23, 2022
@duncanjbrown
Copy link
Contributor Author

Good shout. Amended!

Because the async gem, which is a (distant) dependency of
github_changelog_generator, introduces a Ruby version constraint of
>=3.1.1 for the 2.x series, bundling on a machine with Ruby 3.1.1
installed will result in a different Gemfile.lock than bundling on a
machine with an earlier Ruby version. Note than this is a development
dependency only so the official supported ruby version is still 2.7.

In fact the behaviour of bundler here is quite confusing because it says
that async 2.x.x has been *withdrawn* by the author, which isn't
actually true — it's just that the version in the Gemfile.lock can't be
reconciled with the Ruby version you're running. They've already fixed
it (but haven't released it yet afaics).

rubygems/rubygems#5525

We use asdf everywhere else - use it here too
Adding .ruby-version made rubocop want to enforce 3.1 syntax, which isn't
what we said we'd support in the gemspec (we said 2.3 (!)) - bump that
to 2.7, which is the earliest minor version any of our live services use
Copy link
Contributor

@misaka misaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎸

@duncanjbrown duncanjbrown merged commit ceb214d into main Jun 27, 2022
@duncanjbrown duncanjbrown deleted the ruby-version branch June 27, 2022 10:08
@misaka misaka mentioned this pull request Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants