mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 06:34:19 +02:00
Improve the mise.toml parser to conform to the TOML specification
Fixed #867 ("mise.toml parser fails when ruby line contains end-of-line comments") Co-authored-by: Riley Ho <riley@rileychh.dev>
This commit is contained in:
committed by
Benoit Daloze
co-authored by
Riley Ho
parent
90be1154f9
commit
8d27f39a5e
+1
-1
@@ -92559,7 +92559,7 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
||||
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
||||
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
|
||||
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
|
||||
const regexp = /^ruby\s*=\s*['"](.+)['"]$/
|
||||
const regexp = /^\s*ruby\s*=\s*['"]([^'"]+)['"]\s*(?:#.*)?$/
|
||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => regexp.test(e))[0]
|
||||
rubyVersion = rubyLine.match(regexp)[1]
|
||||
console.log(`Using ${rubyVersion} as input from file mise.toml`)
|
||||
|
||||
@@ -130,7 +130,7 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
||||
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
||||
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
|
||||
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
|
||||
const regexp = /^ruby\s*=\s*['"](.+)['"]$/
|
||||
const regexp = /^\s*ruby\s*=\s*['"]([^'"]+)['"]\s*(?:#.*)?$/
|
||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => regexp.test(e))[0]
|
||||
rubyVersion = rubyLine.match(regexp)[1]
|
||||
console.log(`Using ${rubyVersion} as input from file mise.toml`)
|
||||
|
||||
Reference in New Issue
Block a user