Skip to content

Commit

Permalink
v259 - re-release Ruby 3.3.0-preview2 and add tests (#1390)
Browse files Browse the repository at this point in the history
* Test `bundle platform --ruby` conversion

The Ruby buildpack takes the output for `bundle platform --ruby` and converts that into a S3 url for download. This commit refactors that logic to make testing easier and adds tests for that conversion.

* v259
  • Loading branch information
schneems authored Oct 2, 2023
1 parent 5cfa07f commit 9d5d8c4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

## Main (unreleased)

## v258 (2023/09/26)
## v259 (2023/10/02)

- Ruby 3.3.0-preview2 is now available

## v258 (2023/09/26)

- No changes

## v257 (2023/09/20)

- JRuby 9.3.11.0 is now available
Expand Down
9 changes: 7 additions & 2 deletions lib/language_pack/helpers/bundler_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,15 @@ def ruby_version

# If there's a gem in the Gemfile (i.e. syntax error) emit error
raise GemfileParseError.new(run("bundle check", user_env: true, env: env)) unless $?.success?
if output.match(/No ruby version specified/)

self.class.platform_to_version(output)
end

def self.platform_to_version(bundle_platform_output)
if bundle_platform_output.match(/No ruby version specified/)
""
else
output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-')
bundle_platform_output.strip.sub('(', '').sub(')', '').sub(/(p-?\d+)/, ' \1').split.join('-')
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module LanguagePack
class LanguagePack::Base
BUILDPACK_VERSION = "v258"
BUILDPACK_VERSION = "v259"
end
end
13 changes: 12 additions & 1 deletion spec/helpers/bundler_wrapper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
require 'spec_helper'

describe "BundlerWrapper" do
describe "Bundle platform conversion" do
it "converts `bundle platform --ruby` for prerelease versions" do
actual = LanguagePack::Helpers::BundlerWrapper.platform_to_version("ruby 3.3.0.preview2")
expect(actual).to eq("ruby-3.3.0.preview2")
end

it "converts `bundle platform --ruby` for released versions" do
actual = LanguagePack::Helpers::BundlerWrapper.platform_to_version("ruby 3.1.4")
expect(actual).to eq("ruby-3.1.4")
end
end

describe "BundlerWrapper" do
before(:each) do
if ENV['RUBYOPT']
@original_rubyopt = ENV['RUBYOPT']
Expand Down

0 comments on commit 9d5d8c4

Please sign in to comment.