A gem that provides an executable to populate asdf's .tool-versions
file.
Changelog following https://keepachangelog.com
$ gem install asdf-discover
Run asdf-discover
in a project directory.
Lanuage | File |
---|---|
Go | go.mod |
Ruby | .ruby-version |
Ruby | .rvmrc |
node.js | .nvmrc |
node.js | .node-version |
-
If a version comes from multiple sources, list them all (currently displays the first found)
-
Select a version from
asdf list tool
for versions specified with a requirement, e.g. "~> 1.10" -
There seems to be 2 ways to find a version:
- The contents of a file (e.g. .ruby-version)
- A line in a file (e.g. go.mod)
Consider a DSL for adding more:
class GoMod include Asdf::Searcher scan_file "go.mod", for: /go ([0-9.]+)$/ end class DotRubyVersion include Asdf::Searcher file_contents ".ruby-version" end
After checking out the repo, run bundle install
.
Then, run rake spec
to run the tests.
You can run the binary locally with: ruby -Ilib ./exe/asdf-discover path/to/directory
Bug reports and pull requests are welcome on GitHub at https://github.com/jmks/asdf-discover.
The gem is available as open source under the terms of the MIT License.