Skip to content

Commit b1eb2a4

Browse files
authored
Add support for mise.toml
1 parent 2654679 commit b1eb2a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ function parseRubyEngineAndVersion(rubyVersion) {
117117
rubyVersion = '.ruby-version'
118118
} else if (fs.existsSync('.tool-versions')) {
119119
rubyVersion = '.tool-versions'
120+
} else if (fs.existsSync('mise.toml')) {
121+
rubyVersion = 'mise.toml'
120122
} else {
121123
throw new Error('input ruby-version needs to be specified if no .ruby-version or .tool-versions file exists')
122124
}
@@ -130,6 +132,11 @@ function parseRubyEngineAndVersion(rubyVersion) {
130132
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
131133
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
132134
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
135+
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
136+
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
137+
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s=\s/.test(e))[0]
138+
rubyVersion = rubyLine.match(/^ruby\s=\s"(.+)"$/)[1]
139+
console.log(`Using ${rubyVersion} as input from file mise.toml`)
133140
}
134141

135142
let engine, version

0 commit comments

Comments
 (0)