Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,24 @@
## [Unreleased]


## [v297] - 2025-03-26

- Ruby 3.1.7 and 3.2.8 is now available


## [v296] - 2025-03-21

- Bundler `1.x` usage error is downgraded to a warning. This warning will be moved to an error once `heroku-20` is Sunset (https://github.com/heroku/heroku-buildpack-ruby/pull/1565)

## [v295] - 2025-03-20

- Explicit error message raised with upgrade instructions for applications specifying bundler `1.x` in the Gemfile.lock (https://github.com/heroku/heroku-buildpack-ruby/pull/1561)

## [v294] - 2025-03-19

- Default Ruby version is now 3.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1534)
- Default bundler version (when no version present in the `Gemfile.lock`) is now bundler `2.3.x` which is currently `2.3.25` (https://github.com/heroku/heroku-buildpack-ruby/pull/1534)
- Bundler 1.x will no longer work with the Ruby buildpack (https://github.com/heroku/heroku-buildpack-ruby/pull/1534)

## [v293] - 2025-02-15

Expand Down Expand Up @@ -1641,7 +1655,10 @@ Bugfixes:
* Change gem detection to use lockfile parser
* use `$RACK_ENV` when thin is detected for rack apps

[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...main
[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...main
[v297]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...v297
[v296]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...v296
[v295]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...v295
[v294]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...v294
[v293]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...v293
[v292]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...v292
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.3.7"
ruby "3.1.6"

group :development, :test do
gem "toml-rb"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ DEPENDENCIES
toml-rb

RUBY VERSION
ruby 3.3.7p260
ruby 3.1.6p260

BUNDLED WITH
2.5.11
2 changes: 1 addition & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[buildpack]
name = "Ruby"
ruby_version = "3.3.7"
ruby_version = "3.1.6"

[publish.Ignore]
files = [
Expand Down
5 changes: 3 additions & 2 deletions lib/language_pack/helpers/bundler_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class LanguagePack::Helpers::BundlerWrapper
include LanguagePack::ShellHelpers

BLESSED_BUNDLER_VERSIONS = {}
BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3"
# Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4
BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3"
BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25"
BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22"
BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23"
Expand Down Expand Up @@ -67,7 +67,8 @@ def self.detect_bundler_version(contents: )
if version_match
major = version_match[:major]
minor = version_match[:minor]
BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"]
version = BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"]
version
else
DEFAULT_VERSION
end
Expand Down
25 changes: 25 additions & 0 deletions lib/language_pack/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def compile
Dir.chdir(build_path)
remove_vendor_bundle
warn_bundler_upgrade
warn_bundler_1x
warn_bad_binstubs
install_ruby(slug_vendor_ruby)
setup_language_pack_environment(
Expand Down Expand Up @@ -109,6 +110,30 @@ def compile
raise e
end

def warn_bundler_1x
bundler_versions = LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS
if bundler.version == bundler_versions["1"]
warn(<<~EOF, inline: true)
Deprecating bundler 1.17.3

Your application requested bundler `1.x` in the `Gemfile.lock`
which resolved to `1.17.3`. This version is no longer maintained
by bundler core and will no longer work soon.

Please upgrade to bundler `2.3.x` or higher:

```
$ gem install bundler -v #{bundler_versions["2.3"]}
$ bundle update --bundler
$ git add Gemfile.lock
$ git commit -m "Updated bundler version"
```

https://doc.scalingo.com/languages/ruby/start#bundler-version
EOF
end
end

def cleanup
end

Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(output = "")
end
end

BOOTSTRAP_VERSION_NUMBER = "3.3.7".freeze
BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze
DEFAULT_VERSION_NUMBER = "3.3.7".freeze
DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze
LEGACY_VERSION_NUMBER = "1.9.2".freeze
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 = "v294"
BUILDPACK_VERSION = "v297"
end
end
22 changes: 22 additions & 0 deletions spec/hatchet/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,26 @@
end
end
end

it "deploys with version 1.x" do
pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"]

Hatchet::Runner.new("default_ruby").tap do |app|
app.before_deploy do
set_bundler_version(version: "1.17.3")
Pathname("Gemfile.lock").write(<<~EOF, mode: "a")

RUBY VERSION
ruby 3.1.6
EOF
end
app.deploy do
expect(app.output).to match("Deprecating bundler 1.17.3")

app.run("which -a rake") do |which_rake|
expect(which_rake).to include("/app/vendor/bundle/bin/rake")
end
end
end
end
end
10 changes: 0 additions & 10 deletions spec/helpers/bundler_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@
expect(bundler.supports_multiple_platforms?).to be_truthy
end
end

it "reports false on bundler prior to 2.2" do
Dir.mktmpdir do |dir|
gemfile = Pathname(dir).join("Gemfile")
lockfile = Pathname(dir).join("Gemfile.lock").tap {|p| p.write("BUNDLED WITH\n 1.15.2") }

bundler = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: gemfile)
expect(bundler.supports_multiple_platforms?).to be_falsey
end
end
end

describe "BundlerWrapper mutates rubyopt" do
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER))

bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)
default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER)
# bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)
# default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER)

expect(bootstrap_version).to be >= default_version
# expect(bootstrap_version).to be >= default_version
end
end
2 changes: 1 addition & 1 deletion spec/helpers/shell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def sh.print(string); string.strip; end
def sh.mcount(*args); @error_caught = true; end

bad_lines = File.read("spec/fixtures/invalid_encoding.log")
expect { sh.puts(bad_lines) }.to raise_error(Encoding::CompatibilityError)
expect { sh.puts(bad_lines) }.to raise_error(ArgumentError)

error_caught = sh.instance_variable_get(:"@error_caught")
expect(error_caught).to eq(true)
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def set_bundler_version(version: )
version = "BUNDLED WITH\n #{version}"
end
gemfile_lock.gsub!(/^BUNDLED WITH$(\r?\n) (?<major>\d+)\.(?<minor>\d+)\.\d+/m, version)
gemfile_lock << "\n#{version}" unless gemfile_lock.match?(/^BUNDLED WITH/)

Pathname("Gemfile.lock").write(gemfile_lock)
end

Expand Down