-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Augments the TargetRuby class with a ToolVersionsFile class, giving asdf [1] users the option to specify the target Ruby syntax through its default config file .tool-versions [2]. The file detection and content matching logic is the same whether .tool-versions or .ruby-version is in use. The only differences between the two cases are the file name and pattern used to extract the version number. So, have ToolVersionsFile subclass RubyVersionFile, and modify find_version to get file name and pattern from available instance methods. Since the author is in the process of replacing rbenv with asdf in their dev environment, it felt sensible to stipulate that ToolVersionsFile would be more authoritative than RubyVersionFile (but still less than RuboCopConfig). In the absence of a .tool-versions file, or when it doesn't happen to specify a ruby version, revert to the original logic and allow both rbenv and asdf (in asdf-ruby legacy mode) to be used. [1] asdf is a plugin-based runtime installer/manager - think RVM or rbenv, but not limited to Ruby: github.com/asdf-vm/asdf Ruby support for asdf is provided by the asdf-ruby plugin: github.com/asdf-vm/asdf-ruby [2] Each line in .tool-versions identifies the runtimes and the version needed. For example, here's the contents of the .tool-versions in the author's home dir in their personal laptop: ``` nodejs 14.9.0 ruby 3.0.0 yarn 1.22.5 ```
- Loading branch information
Showing
4 changed files
with
88 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#9319](https://github.com/rubocop-hq/rubocop/pull/9319): Support asdf's .tool-versions file. ([@noon-ng][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters