mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbda85882f | ||
|
|
30755d8bf4 | ||
|
|
28233a011b |
@@ -190,6 +190,33 @@ jobs:
|
|||||||
if: startsWith(matrix.os, 'windows') && matrix.ruby == 'jruby'
|
if: startsWith(matrix.os, 'windows') && matrix.ruby == 'jruby'
|
||||||
run: gem install sassc
|
run: gem install sassc
|
||||||
|
|
||||||
|
testDotRubyVersion:
|
||||||
|
name: "Test .ruby-version"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: echo "ruby-3.4.0" > .ruby-version
|
||||||
|
- uses: ./
|
||||||
|
- run: ruby -v | grep -F "ruby 3.4.0"
|
||||||
|
|
||||||
|
testToolVersions:
|
||||||
|
name: "Test .tool-versions"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: echo -e "nodejs 16.0.0\nruby 3.4.0" > .tool-versions
|
||||||
|
- uses: ./
|
||||||
|
- run: ruby -v | grep -F "ruby 3.4.0"
|
||||||
|
|
||||||
|
testMise:
|
||||||
|
name: "Test mise.toml"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: echo -e "[tools]\nnode = '18'\nruby = '3.4.0'" > mise.toml
|
||||||
|
- uses: ./
|
||||||
|
- run: ruby -v | grep -F "ruby 3.4.0"
|
||||||
|
|
||||||
testNoGemfile:
|
testNoGemfile:
|
||||||
name: "Test with no Gemfile"
|
name: "Test with no Gemfile"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
+6
-4
@@ -74932,13 +74932,15 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
|||||||
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
||||||
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
||||||
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
||||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
|
const regexp = /^ruby\s+(\S+)/
|
||||||
rubyVersion = rubyLine.split(/\s/)[1]
|
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 .tool-versions`)
|
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
||||||
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
|
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
|
||||||
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
|
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
|
||||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s*=\s*/.test(e))[0]
|
const regexp = /^ruby\s*=\s*['"](.+)['"]$/
|
||||||
rubyVersion = rubyLine.match(/^ruby\s*=\s*['"](.+)['"]$/)[1]
|
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`)
|
console.log(`Using ${rubyVersion} as input from file mise.toml`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,13 +129,15 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
|||||||
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
||||||
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
||||||
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
||||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
|
const regexp = /^ruby\s+(\S+)/
|
||||||
rubyVersion = rubyLine.split(/\s/)[1]
|
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 .tool-versions`)
|
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
||||||
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
|
} else if (rubyVersion === 'mise.toml') { // Read from mise.toml
|
||||||
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
|
const toolVersions = fs.readFileSync('mise.toml', 'utf8').trim()
|
||||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s*=\s*/.test(e))[0]
|
const regexp = /^ruby\s*=\s*['"](.+)['"]$/
|
||||||
rubyVersion = rubyLine.match(/^ruby\s*=\s*['"](.+)['"]$/)[1]
|
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`)
|
console.log(`Using ${rubyVersion} as input from file mise.toml`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user