Commit 30755d8 1 parent 28233a0 commit 30755d8 Copy full SHA for 30755d8
File tree 3 files changed +39
-8
lines changed
3 files changed +39
-8
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,33 @@ jobs:
190
190
if : startsWith(matrix.os, 'windows') && matrix.ruby == 'jruby'
191
191
run : gem install sassc
192
192
193
+ testDotRubyVersion :
194
+ name : " Test .ruby-version"
195
+ runs-on : ubuntu-latest
196
+ steps :
197
+ - uses : actions/checkout@v4
198
+ - run : echo "ruby-3.4.0" > .ruby-version
199
+ - uses : ./
200
+ - run : ruby -v | grep -F "ruby 3.4.0"
201
+
202
+ testToolVersions :
203
+ name : " Test .tool-versions"
204
+ runs-on : ubuntu-latest
205
+ steps :
206
+ - uses : actions/checkout@v4
207
+ - run : echo "nodejs 16.0.0\nruby 3.4.0" > .tool-versions
208
+ - uses : ./
209
+ - run : ruby -v | grep -F "ruby 3.4.0"
210
+
211
+ testMise :
212
+ name : " Test mise.toml"
213
+ runs-on : ubuntu-latest
214
+ steps :
215
+ - uses : actions/checkout@v4
216
+ - run : echo "[tools]\nnode = '18'\nruby = '3.4.0'" > mise.toml
217
+ - uses : ./
218
+ - run : ruby -v | grep -F "ruby 3.4.0"
219
+
193
220
testNoGemfile :
194
221
name : " Test with no Gemfile"
195
222
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -129,13 +129,15 @@ function parseRubyEngineAndVersion(rubyVersion) {
129
129
console . log ( `Using ${ rubyVersion } as input from file .ruby-version` )
130
130
} else if ( rubyVersion === '.tool-versions' ) { // Read from .tool-versions
131
131
const toolVersions = fs . readFileSync ( '.tool-versions' , 'utf8' ) . trim ( )
132
- const rubyLine = toolVersions . split ( / \r ? \n / ) . filter ( e => / ^ r u b y \s / . test ( e ) ) [ 0 ]
133
- rubyVersion = rubyLine . split ( / \s + / ) [ 1 ]
132
+ const regexp = / ^ r u b y \s + ( \S + ) /
133
+ const rubyLine = toolVersions . split ( / \r ? \n / ) . filter ( e => regexp . test ( e ) ) [ 0 ]
134
+ rubyVersion = rubyLine . match ( regexp ) [ 1 ]
134
135
console . log ( `Using ${ rubyVersion } as input from file .tool-versions` )
135
136
} else if ( rubyVersion === 'mise.toml' ) { // Read from mise.toml
136
137
const toolVersions = fs . readFileSync ( 'mise.toml' , 'utf8' ) . trim ( )
137
- const rubyLine = toolVersions . split ( / \r ? \n / ) . filter ( e => / ^ r u b y \s * = \s * / . test ( e ) ) [ 0 ]
138
- rubyVersion = rubyLine . match ( / ^ r u b y \s * = \s * [ ' " ] ( .+ ) [ ' " ] $ / ) [ 1 ]
138
+ const regexp = / ^ r u b y \s * = \s * [ ' " ] ( .+ ) [ ' " ] $ /
139
+ const rubyLine = toolVersions . split ( / \r ? \n / ) . filter ( e => regexp . test ( e ) ) [ 0 ]
140
+ rubyVersion = rubyLine . match ( regexp ) [ 1 ]
139
141
console . log ( `Using ${ rubyVersion } as input from file mise.toml` )
140
142
}
141
143
You can’t perform that action at this time.
0 commit comments