Compare commits

...
1 Commits
Author SHA1 Message Date
Yi-Jyun PanandRiley Ho 8d27f39a5e 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>
2026-01-30 15:50:30 +01:00
2 changed files with 2 additions and 2 deletions
Generated Vendored
+1 -1
View File
@@ -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`)
+1 -1
View File
@@ -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`)