-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[#5610] Infer TargetRubyVersion from bundler lock files #5632
[#5610] Infer TargetRubyVersion from bundler lock files #5632
Conversation
config/default.yml
Outdated
# Else if .ruby-version exists and it contains an MRI version it is used. | ||
# Otherwise we fallback to the oldest officially supported Ruby version (2.1). | ||
# If a value is specified for TargetRubyVersion then it is used. Acceptable | ||
# values are specificed as a float (i.e. 2.5); the patch version of Ruby |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace patch
with teeny
. Because the Ruby versioning format is major.minor.teeny
.
https://www.ruby-lang.org/en/news/2013/12/21/ruby-version-policy-changes-with-2-1-0/
ruby-extensions (~> 1.9.0) | ||
|
||
RUBY VERSION | ||
ruby 2.0.0p0 (rbx 3.42) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example's description is "uses the default Ruby when jruby", but the lockfile has rbx 3.42
. Should it be "jruby"?
Sorry for the late review🙇 It looks good to me! 🎉 However, I have few comments. Can you confirm the comments, and rebase on the current master? |
No problem! Thanks for taking a look. Good catches in the comments; I made the adjustments and rebased. |
Follow up of rubocop@7949f49. This PR fixes the following build error in Travis CI. https://travis-ci.org/bbatsov/rubocop/jobs/354133118 It also removes unnecessary blank line inserted by rubocop#5632. It's just a nitpick.
Follow up of 7949f49. This PR fixes the following build error in Travis CI. https://travis-ci.org/bbatsov/rubocop/jobs/354133118 It also removes unnecessary blank line inserted by #5632. It's just a nitpick.
Closes #5610.
Change the config init process slightly, for setting TargetRubyVersion, to consider the gems.locked or Gemfile.lock when trying to determine the best value. If the user adds
ruby ...
to the Gemfile, bundler will lock Ruby to a specific version and we can use that information to dynamically pick the best value for TargetRubyVersion. The .ruby-version file is still considered first before looking at lock file.If TargetRubyVersion is set in the config file, it still takes precedence and is always used. If Ruby is not in gems.locked or Gemfile.lock, and the user hasn't specified a version in the config, the default version is still used as the fallback.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.