Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default Ruby version to 3.3.7 #1534

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fe63cf0
Update default Ruby version to 3.3.6
schneems Jan 6, 2025
b4d55dd
Update to non-deprecated method
schneems Jan 6, 2025
e933c21
Ruby 3.3.7 is now the default
schneems Jan 21, 2025
9848194
Update test apps
schneems Jan 21, 2025
08644d0
s/exists?/exist?/
schneems Jan 27, 2025
43f05b6
Update tests
schneems Jan 27, 2025
e2b20cb
Bundler default version now 2.3.x
schneems Jan 30, 2025
5fbea8e
Update older rails versions in tests
schneems Feb 3, 2025
20d4ca9
Update example to default bundler version
schneems Feb 4, 2025
34e6111
Update fixtures
schneems Feb 4, 2025
353e721
Update fixtures
schneems Feb 4, 2025
fd1aa1e
Remove unused test
schneems Feb 4, 2025
9356404
Remove test
schneems Feb 4, 2025
f4277ef
Fix an error
schneems Feb 4, 2025
3991810
Fix spec
schneems Feb 4, 2025
d415d2a
Remove bundler 1.x spec
schneems Feb 4, 2025
8da458e
Fix fetcher spec and test all bundler versions
schneems Feb 4, 2025
b62eabf
Update fixture
schneems Feb 4, 2025
db82651
CI apps that use the database need one
schneems Feb 4, 2025
33d8915
Fix test
schneems Feb 4, 2025
12ae330
Fix tests
schneems Feb 4, 2025
7ea0f5d
Change command so it works on bsdtar (hopefully gnutar tar too, but w…
schneems Feb 4, 2025
880e371
Update tests
schneems Feb 4, 2025
7731279
Update fixtures
schneems Feb 4, 2025
806c0a2
Fix missing repo
schneems Feb 4, 2025
3768f0d
Update tests
schneems Feb 4, 2025
50bc5e7
Update test
schneems Feb 4, 2025
4ac3a64
Update fixture
schneems Feb 4, 2025
73bb366
Fix test
schneems Feb 4, 2025
7559f9f
Fix test
schneems Feb 4, 2025
2938919
Update fixture
schneems Feb 5, 2025
13f90f5
Update fixtures
schneems Feb 5, 2025
22867c6
Remove-un-needed version write
schneems Feb 5, 2025
431bcc8
Allow heredoc to use interpolation
schneems Feb 5, 2025
bf0aded
Update fixtures
schneems Feb 5, 2025
109bd62
Fix ruby version
schneems Feb 5, 2025
c05a1b5
Update test
schneems Feb 5, 2025
435d36e
Update fixture
schneems Feb 5, 2025
765ff8c
Update fixtures
schneems Feb 5, 2025
f009de0
Adjust test addon
schneems Feb 6, 2025
2a0eb3d
Fix Rails 7 sql/schema test
schneems Feb 10, 2025
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- 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)

## [v288] - 2025-01-06

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.1', '< 3.3'
ruby "3.3.7"

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.1.6p260
ruby 3.3.7p260

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.1.6"
ruby_version = "3.3.7"

[publish.Ignore]
files = [
Expand Down
13 changes: 13 additions & 0 deletions changelogs/unreleased/bundler_default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Ruby applications with no specified bundler versions now receive Bundler 2.x

Previously applications with no `BUNDLED WITH` in their `Gemfile.lock` would receive bundler `1.x`. They will now receive the new [default bundler version](https://devcenter.heroku.com/articles/ruby-support-reference#default-bundler-version) `2.3.x`.

It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git:

```
$ bundle update --ruby
$ git add Gemfile.lock
$ git commit -m "Update Gemfile.lock"
```

Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change.
3 changes: 3 additions & 0 deletions changelogs/unreleased/default_ruby.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Default Ruby version for new apps is now 3.3.7

The [default Ruby version for new Ruby applications is 3.3.7](https://devcenter.heroku.com/articles/ruby-support#default-ruby-version-for-new-apps). You’ll only get the default if the application does not specify a ruby version.
32 changes: 8 additions & 24 deletions hatchet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,31 @@
"sharpstone/asset_precompile_pass",
"sharpstone/asset_precompile_not_found",
"sharpstone/no_rakefile",
"sharpstone/bad_rakefile",
"sharpstone/default_with_rakefile"
"sharpstone/bad_rakefile"
],
"bundler": [
"sharpstone/problem_gemfile_version",
"sharpstone/git_gemspec",
"sharpstone/no_lockfile",
"sharpstone/sqlite3_gemfile",
"sharpstone/nokogiri_160"
"sharpstone/sqlite3_gemfile"
],
"ruby": [
"sharpstone/ruby_version_does_not_exist",
"sharpstone/ruby_193_jruby_17161_jdk7",
"sharpstone/ruby_25",
"sharpstone/jruby-minimal",
"sharpstone/empty-procfile",
"sharpstone/bad_ruby_version",
"sharpstone/activerecord41_scaffold",
"sharpstone/libpq_connection_error"
],
"jruby": [
"sharpstone/jruby_naether"
"sharpstone/bad_ruby_version"
],
"rack": [
"sharpstone/default_ruby",
"sharpstone/mri_187_nokogiri",
"sharpstone/mri_192"
"sharpstone/default_ruby"
],
"rails_versions": [
"sharpstone/rails_lts_23_default_ruby",
"sharpstone/rails3_default_ruby",
"sharpstone/rails4_windows_mri193",
"sharpstone/rails42_default_ruby",
"sharpstone/active_storage_non_local",
"sharpstone/active_storage_local",
"sharpstone/sprockets_asset_compile_true",
"sharpstone/rails61",
"sharpstone/rails-jsbundling"
"sharpstone/rails-jsbundling",
"sharpstone/rails_8_ruby_schema",
"sharpstone/rails_8_sql_schema"
],
"heroku": [
"heroku/ruby-getting-started"
Expand All @@ -50,10 +37,7 @@
"sharpstone/minimal_webpacker"
],
"ci": [
"sharpstone/rails5_ruby_schema_format",
"sharpstone/heroku-ci-json-example",
"sharpstone/rails5_sql_schema_format",
"sharpstone/ruby_no_rails_test",
"sharpstone/activerecord_rake_tasks_does_not_exist"
"sharpstone/ruby_no_rails_test"
]
}
52 changes: 12 additions & 40 deletions hatchet.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,34 @@
- 7755e19caf122e1373bce73ffe9b333e9411d732
- - "./repos/bundler/no_lockfile"
- 1947ce9a9c276d5df1c323b2ad78d1d85c7ab4c0
- - "./repos/bundler/nokogiri_160"
- d9a761776be43e1c685f98ef13c6ef1ee0292267
- - "./repos/bundler/problem_gemfile_version"
- abc25a7b582a720b99148a1c8753d0d7452254bb
- - "./repos/bundler/sqlite3_gemfile"
- 116db685f54dae18f703b3beb90e64fdbddb048d
- - "./repos/ci/activerecord_rake_tasks_does_not_exist"
- a6b711be6921cf7a0aa4e31269c37965799ea110
- - "./repos/ci/heroku-ci-json-example"
- 4e5410a7381f486ba3df7739e02e52f32fdd4dda
- - "./repos/ci/rails5_ruby_schema_format"
- 8b8a3a7850bdba29bdefc70c0f80f35a9e6c96ae
- - "./repos/ci/rails5_sql_schema_format"
- ee81b300a1019b47bbcaec0a512932df7dc23bc0
- 728cc99c8e80290cc07441d61a8bcd4596e696fb
- - "./repos/ci/ruby_no_rails_test"
- 3916137106d59b008b67d738abe6a1438f8fbde6
- c5925ab061f65433ec5dcbc890975f580e74c5ce
- - "./repos/heroku/ruby-getting-started"
- main
- - "./repos/jruby/jruby_naether"
- 4a11f8af5a3cca21f3659394e5bbac3cca9b6a2c
- - "./repos/node/minimal_webpacker"
- 9152fec98df59a0bf8a5478ed428841ee135acbb
- d659577a612b12ddb44ce34e28124c025ecb22f3
- - "./repos/rack/default_ruby"
- master
- - "./repos/rack/mri_187_nokogiri"
- 3fcce9c85bf560dba285cc385ae9845729195826
- - "./repos/rack/mri_192"
- ef6b5ccf8aa2a8f5e3745934e3580dc0bd2d6d4b
- - "./repos/rails_versions/active_storage_local"
- 18853ba7dda61745995740b4ca6f5f90bbd8afba
- - "./repos/rails_versions/active_storage_non_local"
- 86dddf0127043abba1cb2890590a1d38f111edbd
- - "./repos/rails_versions/rails-jsbundling"
- c58178e061d9846386ca34ea31c99f6e6bb8dbf7
- 50e9fdf7c3a37623c676989ddebac4ee5349734b
- - "./repos/rails_versions/rails3_default_ruby"
- a6b44db674c0d3538633989295e2cfd5e8e1ba0d
- 984b6d02353519251c2d1e885bf8914a2584f26a
- - "./repos/rails_versions/rails42_default_ruby"
- dfa0f0133dafa62064968ea2efb6432f54350138
- fbdaf031823f09d1514ec1d55dcb04ca2f4264ca
- - "./repos/rails_versions/rails4_windows_mri193"
- f4c7b6209835050468bbb87827acf652b8f4d8ce
- - "./repos/rails_versions/rails61"
- e896f51e679eaf2204aa4fab6d038103fc622aed
- 47828a3e8c79b7869ca0d9a3afa4be065fa46e96
- - "./repos/rails_versions/rails_8_ruby_schema"
- a993a3f00c8e09f733bc3b783f7e37148d0af1d4
- - "./repos/rails_versions/rails_8_sql_schema"
- d5089812196931e858a97119de1640a86825a272
- - "./repos/rails_versions/rails_lts_23_default_ruby"
- 7178b2f97d3b2b3170b390d997dcb212dd52cd30
- - "./repos/rails_versions/sprockets_asset_compile_true"
- 6f3aa208046a5c79e84fc272f52f5ebb7b775755
- f3597fd6f0887763eb65ec2f83a5e9a5155d5625
- - "./repos/rake/asset_precompile_fail"
- 16f7834331d6bb3fc5c284130b14eb1ff74d99d5
- - "./repos/rake/asset_precompile_not_found"
Expand All @@ -57,23 +39,13 @@
- ce976c727d9f477957c499f39f4cf9603c378103
- - "./repos/rake/bad_rakefile"
- 3cb9c7bf6494c59bd25fa74c2aa4531119e12a46
- - "./repos/rake/default_with_rakefile"
- c6e0c4db8dcccb47e11d496e17adbc2dafc80dd8
- - "./repos/rake/no_rakefile"
- d2ec2084b825218418dac54bd6276ac896b31cdd
- - "./repos/ruby/activerecord41_scaffold"
- 6e4662c44b49e2c3c9429f00e7e7f4708142b03f
- - "./repos/ruby/bad_ruby_version"
- 7bf3470265a87ea6361640aa4bfce6ce3b743520
- - "./repos/ruby/empty-procfile"
- 7cae0aae424c2028b81b5d37ee24d42db8e545b9
- - "./repos/ruby/jruby-minimal"
- f79860bc2866449fe065484f1542aaadd3f7cfd2
- - "./repos/ruby/libpq_connection_error"
- c211c245f09d8335a520cd7a0b5360897d4988eb
- - "./repos/ruby/ruby_193_jruby_17161_jdk7"
- c1b632f8a96cf9b902f5cdcd7a190d46544a8144
- - "./repos/ruby/ruby_25"
- 0cb3df80d55b61e9417f2ac00adb06e15ae37982
- - "./repos/ruby/ruby_version_does_not_exist"
- 9b6ad8e3b4fa7850393a5f232bb40ff3cd414d8b
2 changes: 1 addition & 1 deletion lib/language_pack/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def build_release

def write_release_yaml
release = build_release
FileUtils.mkdir("tmp") unless File.exists?("tmp")
FileUtils.mkdir("tmp") unless File.exist?("tmp")
File.open("tmp/heroku-buildpack-release-step.yml", 'w') do |f|
f.write(release.to_yaml)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ def cache_copy(from,to)
def exists?(path)
return unless @cache_base

File.exists?(@cache_base + path)
File.exist?(@cache_base + path)
end
end
2 changes: 1 addition & 1 deletion lib/language_pack/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def fetch(path)

def fetch_untar(path, files_to_extract = nil, strip_components: 0)
curl = curl_command("#{@host_url.join(path)} -s -o")
tar_cmd = ["tar zxf - #{files_to_extract}", "--strip #{strip_components}"]
tar_cmd = ["tar", "--strip-components=#{strip_components}", "-xzf", "- #{files_to_extract}"]
run! "#{curl} - | #{tar_cmd.join(" ")}",
error_class: FetchError,
max_attempts: 3
Expand Down
10 changes: 7 additions & 3 deletions lib/language_pack/helpers/bundler_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class LanguagePack::Helpers::BundlerWrapper
BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22"
BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23"
BLESSED_BUNDLER_VERSIONS["2.6"] = "2.6.2"

DEFAULT_VERSION = BLESSED_BUNDLER_VERSIONS["2.3"]

# Convert arbitrary `<Major>.<Minor>.x` versions
BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key|
if Gem::Version.new(key).segments.first == 1
hash["1"]
Expand All @@ -65,7 +69,7 @@ def self.detect_bundler_version(contents: )
minor = version_match[:minor]
BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"]
else
BLESSED_BUNDLER_VERSIONS["1"]
DEFAULT_VERSION
end
end

Expand All @@ -91,7 +95,7 @@ def initialize(version_hash, major_minor)
msg << "\n"
msg << "```\n"
msg << "BUNDLED WITH\n"
msg << " #{version_hash["1"]}\n"
msg << " #{DEFAULT_VERSION}\n"
msg << "```\n"
super msg
end
Expand Down Expand Up @@ -239,7 +243,7 @@ def bundler_version_escape_valve!

private
def fetch_bundler
return true if Dir.exists?(bundler_path)
return true if Dir.exist?(bundler_path)

topic("Installing bundler #{@version}")
bundler_version_escape_valve!
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def read(key)

def exists?(key)
full_key = "#{FOLDER}/#{key}"
File.exists?(full_key) && !Dir.exists?(full_key)
File.exist?(full_key) && !Dir.exist?(full_key)
end
alias_method :include?, :exists?

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

class LanguagePack::NoLockfile < LanguagePack::Ruby
def self.use?
!File.exists?("Gemfile.lock")
!File.exist?("Gemfile.lock")
end

def name
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/rails3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def install_plugins
# runs the tasks for the Rails 3.1 asset pipeline
def run_assets_precompile_rake_task
log("assets_precompile") do
if File.exists?("public/assets/manifest.yml")
if File.exist?("public/assets/manifest.yml")
puts "Detected manifest.yml, assuming assets were compiled locally"
return true
end
Expand Down
10 changes: 5 additions & 5 deletions lib/language_pack/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def uninstall_binary(path)
# users should be using `bundle pack` instead.
# https://github.com/heroku/heroku-buildpack-ruby/issues/21
def remove_vendor_bundle
if File.exists?("vendor/bundle")
if File.exist?("vendor/bundle")
warn(<<-WARNING)
Removing `vendor/bundle`.
Checking in `vendor/bundle` is not supported. Please remove this directory
Expand Down Expand Up @@ -1130,7 +1130,7 @@ def valid_bundler_cache?(path, metadata)
end

# fix bug from v37 deploy
if File.exists?("#{path}/vendor/ruby_version")
if File.exist?("#{path}/vendor/ruby_version")
puts "Broken cache detected. Purging build cache."
cache.clear("vendor")
FileUtils.rm_rf("#{path}/vendor/ruby_version")
Expand All @@ -1148,7 +1148,7 @@ def valid_bundler_cache?(path, metadata)
end

# fix git gemspec bug from Bundler 1.3.0+ upgrade
if File.exists?(bundler_cache) && !metadata.include?(:bundler_version) && !run("find #{path}/vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory")
if File.exist?(bundler_cache) && !metadata.include?(:bundler_version) && !run("find #{path}/vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory")
return [false, "Old bundler cache detected. Clearing bundler cache."]
end

Expand Down Expand Up @@ -1220,7 +1220,7 @@ def load_bundler_cache
end

# fix bug from v37 deploy
if File.exists?("vendor/ruby_version")
if File.exist?("vendor/ruby_version")
puts "Broken cache detected. Purging build cache."
cache.clear("vendor")
FileUtils.rm_rf("vendor/ruby_version")
Expand All @@ -1237,7 +1237,7 @@ def load_bundler_cache
end

# fix git gemspec bug from Bundler 1.3.0+ upgrade
if File.exists?(bundler_cache) && [email protected]?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory")
if File.exist?(bundler_cache) && [email protected]?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory")
puts "Old bundler cache detected. Clearing bundler cache."
purge_bundler_cache
end
Expand Down
4 changes: 2 additions & 2 deletions lib/language_pack/ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def initialize(output = "")
end
end

BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze
DEFAULT_VERSION_NUMBER = "3.1.6".freeze
BOOTSTRAP_VERSION_NUMBER = "3.3.7".freeze
DEFAULT_VERSION_NUMBER = "3.3.7".freeze
DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze
LEGACY_VERSION_NUMBER = "1.9.2".freeze
LEGACY_VERSION = "ruby-#{LEGACY_VERSION_NUMBER}".freeze
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/shell_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def puts(message)
end

$stdout.flush
rescue ArgumentError => e
rescue ArgumentError, Encoding::CompatibilityError => e
error_message = e.message
raise e if error_message !~ /invalid byte sequence/

Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/test/rails7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ class LanguagePack::Rails7
# Rails removed the db:schema:load_if_ruby and `db:structure:load_if_sql` tasks
# they've been replaced by `db:schema:load` instead
def db_prepare_test_rake_tasks
["db:schema:load", "db:migrate"].map {|name| rake.task(name) }
["db:schema:load", "db:migrate"].map { |name| rake.task(name) }
end
end
25 changes: 0 additions & 25 deletions spec/hatchet/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,4 @@
end
end
end

it "deploys with version 1.x" do
abi_version = LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER.dup
abi_version[-1] = "0" # turn 2.6.6 into 2.6.0
pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"]

Hatchet::Runner.new("default_ruby").tap do |app|
app.before_deploy do
run!(%Q{printf "\nBUNDLED WITH\n 1.0.1\n" >> Gemfile.lock})
end
app.deploy do
expect(app.output).to match("Installing dependencies using bundler 1.")
expect(app.output).to match("BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1")

# app.run_multi("ls vendor/bundle/ruby/#{abi_version}/gems") do |ls_output|
# expect(ls_output).to match("rake-")
# end

app.run("which -a rake") do |which_rake|
expect(which_rake).to include("/app/vendor/bundle/bin/rake")
expect(which_rake).to include("/app/vendor/bundle/ruby/#{abi_version}/bin/rake")
end
end
end
end
end
Loading