Skip to content

Commit 5a76bd6

Browse files
authored
Add support for Ruby 2.1 (#71)
1 parent 40bbc5e commit 5a76bd6

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-10.15, windows-2016, windows-2019 ]
1919
# Use various version syntax here for testing
20-
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, debug, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ]
20+
ruby: [ 2.1, 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, debug, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ]
2121
include:
2222
- { os: ubuntu-18.04, ruby: rubinius }
2323
- { os: windows-2016, ruby: mingw }

README.md

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

1515
| Interpreter | Versions |
1616
| ----------- | -------- |
17-
| Ruby | 2.2, 2.3.0 - 2.3.8, 2.4.0 - 2.4.10, 2.5.0 - 2.5.8, 2.6.0 - 2.6.6, 2.7.1, head, debug, mingw, mswin |
17+
| Ruby | 2.1.9, 2.2, 2.3.0 - 2.3.8, 2.4.0 - 2.4.10, 2.5.0 - 2.5.8, 2.6.0 - 2.6.6, 2.7.1, head, debug, mingw, mswin |
1818
| JRuby | 9.1.17.0, 9.2.9.0 - 9.2.12.0, head |
1919
| TruffleRuby | 19.3.0 - 20.1.0, head |
2020
| Rubinius | 4.14 |

dist/index.js

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

generate-windows-versions.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
require 'yaml'
33
require 'json'
44

5-
min_version = '2.2.6'
5+
min_requirements = ['~> 2.1.9', '>= 2.2.6'].map { |req| Gem::Requirement.new(req) }
6+
67
url = 'https://raw.githubusercontent.com/oneclick/rubyinstaller.org-website/master/_data/downloads.yaml'
78
entries = YAML.load(Net::HTTP.get(URI(url)), symbolize_names: true)
89

@@ -19,7 +20,7 @@
1920
}.sort_by { |version, entry|
2021
Gem::Version.new(version)
2122
}.select { |version, entry|
22-
Gem::Version.new(version) >= Gem::Version.new(min_version)
23+
min_requirements.any? { |req| req.satisfied_by?(Gem::Version.new(version)) }
2324
}.map { |version, entry|
2425
[version, entry[:href]]
2526
}.to_h

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine,
191191
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
192192
}
193193

194-
if (rubyVersion.startsWith('2.2')) {
195-
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby 2.2')
194+
if (rubyVersion.match(/^2\.[12]/)) {
195+
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
196196
bundlerVersion = '1'
197197
} else if (rubyVersion.startsWith('2.3')) {
198198
console.log('Ruby 2.3 has a bug with Bundler 2 (https://github.com/rubygems/rubygems/issues/3570), using Bundler 1 instead on Ruby 2.3')

ruby-builder-versions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export function getVersions(platform) {
22
const versions = {
33
"ruby": [
4+
"2.1.9",
45
"2.2.10",
56
"2.3.0", "2.3.1", "2.3.2", "2.3.3", "2.3.4", "2.3.5", "2.3.6", "2.3.7", "2.3.8",
67
"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", "2.4.10",

versions-strings-for-builder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
by_minor = versions[:ruby].group_by { |v| v[/^\d\.\d/] }
55

6+
p by_minor['2.1']
67
p by_minor['2.2']
78
p by_minor['2.3']
89

windows-versions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const versions = {
2+
"2.1.9": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.1.9-x64-mingw32.7z",
23
"2.2.6": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.2.6-x64-mingw32.7z",
34
"2.3.0": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.0-x64-mingw32.7z",
45
"2.3.1": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.1-x64-mingw32.7z",

windows.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ const rubyInstallerVersions = require('./windows-versions').versions
1313
// Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
1414
const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0]
1515

16-
// needed for 2.2, 2.3, and mswin, cert file used by Git for Windows
16+
// needed for 2.1, 2.2, 2.3, and mswin, cert file used by Git for Windows
1717
const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
1818

1919
// standard MSYS2 location, found by 'devkit.rb'
2020
const msys2 = 'C:\\msys64'
2121
const msys2PathEntries = [`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`]
2222

23-
// location & path for old RubyInstaller DevKit (MSYS), Ruby 2.2 and 2.3
23+
// location & path for old RubyInstaller DevKit (MSYS), Ruby 2.1, 2.2 and 2.3
2424
const msys = `${drive}:\\DevKit64`
2525
const msysPathEntries = [`${msys}\\mingw\\x86_64-w64-mingw32\\bin`,
2626
`${msys}\\mingw\\bin`, `${msys}\\bin`]
@@ -73,7 +73,7 @@ async function symLinkToEmbeddedMSYS2() {
7373
async function setupMingw(version) {
7474
core.exportVariable('MAKE', 'make.exe')
7575

76-
if (version.startsWith('2.2') || version.startsWith('2.3')) {
76+
if (version.match(/^2\.[123]/)) {
7777
core.exportVariable('SSL_CERT_FILE', certFile)
7878
await common.measure('Installing MSYS1', async () =>
7979
installMSYS(version))
@@ -89,7 +89,7 @@ async function setupMingw(version) {
8989
}
9090
}
9191

92-
// Ruby 2.2 and 2.3
92+
// Ruby 2.1, 2.2 and 2.3
9393
async function installMSYS(version) {
9494
const url = 'https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'
9595
const downloadPath = await tc.downloadTool(url)

0 commit comments

Comments
 (0)