Skip to content

Commit 6ff1e3c

Browse files
pan93412rileychh
andcommitted
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>
1 parent 90be115 commit 6ff1e3c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function parseRubyEngineAndVersion(rubyVersion) {
130130
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
131131
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
132132
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
133-
const regexp = /^ruby\s*=\s*['"](.+)['"]$/
133+
const regexp = /^\s*ruby\s*=\s*['"]([^'"]+)['"]\s*(?:#.*)?$/
134134
const rubyLine = toolVersions.split(/\r?\n/).filter(e => regexp.test(e))[0]
135135
rubyVersion = rubyLine.match(regexp)[1]
136136
console.log(`Using ${rubyVersion} as input from file mise.toml`)

0 commit comments

Comments
 (0)