Skip to content

Commit f548324

Browse files
committed
Add support for ruby-head
1 parent 0331c8b commit f548324

File tree

8 files changed

+44
-24
lines changed

8 files changed

+44
-24
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
os: [ ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest ]
1616
# Use various version syntaxes here for testing
17-
ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby, truffleruby-head, rubinius ]
17+
ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, ruby-head, jruby, truffleruby, truffleruby-head, rubinius ]
1818
exclude:
1919
- os: windows-latest
2020
ruby: truffleruby

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
1111

1212
| Interpreter | Versions |
1313
| ----------- | -------- |
14-
| Ruby | 2.3.0 - 2.3.8, 2.4.0 - 2.4.9, 2.5.0 - 2.5.7, 2.6.0 - 2.6.5, 2.7.0 |
14+
| Ruby | 2.3.0 - 2.3.8, 2.4.0 - 2.4.9, 2.5.0 - 2.5.7, 2.6.0 - 2.6.5, 2.7.0, head |
1515
| JRuby | 9.2.9.0 |
1616
| TruffleRuby | 19.3.0, 19.3.1, head |
1717
| Rubinius | 4.13 |

dist/index.js

Lines changed: 20 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generate-ruby-installer-versions.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@
2323
[version, entry[:href]]
2424
}.to_h
2525

26+
versions['head'] = 'https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z'
27+
2628
js = "export const versions = #{JSON.pretty_generate(versions)}\n"
2729
File.write 'windows-versions.js', js

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
5151

5252
if (!engineVersions.includes(version)) {
5353
const latestToFirstVersion = engineVersions.slice().reverse()
54-
const found = latestToFirstVersion.find(v => v.startsWith(version))
54+
const found = latestToFirstVersion.find(v => v !== 'head' && v.startsWith(version))
5555
if (found) {
5656
version = found
5757
} else {

ruby-install-builder-versions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ export function getVersions(platform) {
55
"2.4.0", "2.4.1", "2.4.2", "2.4.3", "2.4.4", "2.4.5", "2.4.6", "2.4.7", "2.4.9",
66
"2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.5.4", "2.5.5", "2.5.6", "2.5.7",
77
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5",
8-
"2.7.0"
8+
"2.7.0",
9+
"head"
910
],
1011
"jruby": [
1112
"9.2.9.0"
1213
],
1314
"truffleruby": [
14-
"head", "19.3.0", "19.3.1"
15+
"19.3.0", "19.3.1",
16+
"head"
1517
]
1618
}
1719

ruby-install-builder.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ const axios = require('axios')
99
const builderReleaseTag = 'builds-newer-openssl'
1010
const releasesURL = 'https://github.com/eregon/ruby-install-builder/releases'
1111

12-
const truffleRubyHeadReleaseURL = 'https://github.com/eregon/truffleruby-dev-builder/releases/download'
13-
const truffleRubyHeadMetadataURL = 'https://raw.githubusercontent.com/eregon/truffleruby-dev-builder/metadata/latest_build.tag'
14-
1512
export function getAvailableVersions(platform, engine) {
1613
return rubyBuilderVersions.getVersions(platform)[engine]
1714
}
@@ -41,11 +38,20 @@ async function downloadAndExtract(platform, ruby) {
4138
}
4239

4340
async function getDownloadURL(platform, ruby) {
44-
if (ruby === 'truffleruby-head') {
45-
const response = await axios.get(truffleRubyHeadMetadataURL)
46-
const tag = response.data.trim()
47-
return `${truffleRubyHeadReleaseURL}/${tag}/${ruby}-${platform}.tar.gz`
41+
if (ruby.endsWith('-head')) {
42+
return getLatestHeadBuildURL(platform, ruby)
4843
} else {
4944
return `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
5045
}
5146
}
47+
48+
async function getLatestHeadBuildURL(platform, ruby) {
49+
const engine = ruby.split('-')[0]
50+
const repository = `eregon/${engine}-dev-builder`
51+
const metadataURL = `https://raw.githubusercontent.com/${repository}/metadata/latest_build.tag`
52+
const releasesURL = `https://github.com/${repository}/releases/download`
53+
54+
const response = await axios.get(metadataURL)
55+
const tag = response.data.trim()
56+
return `${releasesURL}/${tag}/${ruby}-${platform}.tar.gz`
57+
}

windows-versions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ export const versions = {
2222
"2.6.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x64.7z",
2323
"2.6.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-2.6.4-1-x64.7z",
2424
"2.6.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.7z",
25-
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z"
25+
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z",
26+
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z"
2627
}

0 commit comments

Comments
 (0)