Skip to content

Commit

Permalink
Add support for Ruby 2.1 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
meineerde authored Jul 16, 2020
1 parent 40bbc5e commit 5a76bd6
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-10.15, windows-2016, windows-2019 ]
# Use various version syntax here for testing
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 ]
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 ]
include:
- { os: ubuntu-18.04, ruby: rubinius }
- { os: windows-2016, ruby: mingw }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:

| Interpreter | Versions |
| ----------- | -------- |
| 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 |
| 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 |
| JRuby | 9.1.17.0, 9.2.9.0 - 9.2.12.0, head |
| TruffleRuby | 19.3.0 - 20.1.0, head |
| Rubinius | 4.14 |
Expand Down
14 changes: 8 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions generate-windows-versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
require 'yaml'
require 'json'

min_version = '2.2.6'
min_requirements = ['~> 2.1.9', '>= 2.2.6'].map { |req| Gem::Requirement.new(req) }

url = 'https://raw.githubusercontent.com/oneclick/rubyinstaller.org-website/master/_data/downloads.yaml'
entries = YAML.load(Net::HTTP.get(URI(url)), symbolize_names: true)

Expand All @@ -19,7 +20,7 @@
}.sort_by { |version, entry|
Gem::Version.new(version)
}.select { |version, entry|
Gem::Version.new(version) >= Gem::Version.new(min_version)
min_requirements.any? { |req| req.satisfied_by?(Gem::Version.new(version)) }
}.map { |version, entry|
[version, entry[:href]]
}.to_h
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine,
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
}

if (rubyVersion.startsWith('2.2')) {
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby 2.2')
if (rubyVersion.match(/^2\.[12]/)) {
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
bundlerVersion = '1'
} else if (rubyVersion.startsWith('2.3')) {
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')
Expand Down
1 change: 1 addition & 0 deletions ruby-builder-versions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export function getVersions(platform) {
const versions = {
"ruby": [
"2.1.9",
"2.2.10",
"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",
"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",
Expand Down
1 change: 1 addition & 0 deletions versions-strings-for-builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

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

p by_minor['2.1']
p by_minor['2.2']
p by_minor['2.3']

Expand Down
1 change: 1 addition & 0 deletions windows-versions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const versions = {
"2.1.9": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.1.9-x64-mingw32.7z",
"2.2.6": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.2.6-x64-mingw32.7z",
"2.3.0": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.0-x64-mingw32.7z",
"2.3.1": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.1-x64-mingw32.7z",
Expand Down
8 changes: 4 additions & 4 deletions windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ const rubyInstallerVersions = require('./windows-versions').versions
// Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0]

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

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

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

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

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

0 comments on commit 5a76bd6

Please sign in to comment.