Read from .ruby-version if version is unset or set to '.ruby-version'

* Fixes https://github.com/eregon/use-ruby-action/issues/4
This commit is contained in:
Benoit Daloze
2020-01-06 22:00:45 +01:00
parent b339f321d1
commit a61be15bff
6 changed files with 17 additions and 3 deletions
+5
View File
@@ -47,6 +47,11 @@ async function getLatestReleaseTag() {
}
async function getRubyEngineAndVersion(rubyVersion) {
if (rubyVersion === '.ruby-version') { // Read from .ruby-version
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
}
let engine, version
if (rubyVersion.match(/^\d+/)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby'