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
43 changes: 43 additions & 0 deletions .github/workflows/document_ruby_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Add Ruby version to changelog && prepare release
run-name: "Add ${{ inputs.is_jruby && 'J' || ''}}Ruby ${{ inputs.ruby_version }} to the CHANGELOG.md and prepare a release"

on:
workflow_dispatch:
inputs:
ruby_version:
description: "The Ruby version to announce"
type: string
required: true
is_jruby:
description: "JRuby release? (as opposed to MRI)"
type: boolean
default: false
required: false

# Disable all GITHUB_TOKEN permissions, since the GitHub App token is used instead.
permissions: {}

jobs:
prepare-release:
uses: heroku/languages-github-actions/.github/workflows/_classic-buildpack-prepare-release.yml@latest
secrets: inherit
with:
custom_update_command: |
set -euo pipefail
DATE_TODAY="$(date --utc --iso-8601)"

sed --in-place "/## \[v${NEW_VERSION}\] - ${DATE_TODAY}/a\\
\\
- ${{ inputs.is_jruby && 'J' || ''}}Ruby ${{inputs.ruby_version}} is now available" CHANGELOG.md

sed --in-place --regexp-extended \
--expression "s/v${EXISTING_VERSION}/v${NEW_VERSION}/" \
lib/language_pack/version.rb

if compgen -G 'changelogs/unreleased/*.md' > /dev/null; then
# The unreleased changelogs directory contains a `.gitkeep` file, so we have to
# copy the markdown files individually instead of renaming the directory.
NEW_CHANGELOG_DIR="changelogs/v${NEW_VERSION}/"
mkdir -p "${NEW_CHANGELOG_DIR}"
mv changelogs/unreleased/*.md "${NEW_CHANGELOG_DIR}"
fi
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
## [Unreleased]


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

## [v293] - 2025-02-15

- Ruby 3.4.2 is now available (https://github.com/heroku/heroku-buildpack-ruby/pull/1548)
Expand Down Expand Up @@ -1636,7 +1641,8 @@ 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/v293...main
[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...main
[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
[v291]: https://github.com/heroku/heroku-buildpack-ruby/compare/v290...v291
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/v294/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/v294/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 @@ -113,7 +113,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 @@ -88,6 +88,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 @@ -27,7 +27,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 @@ -163,7 +163,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 @@ -636,7 +636,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 @@ -1144,7 +1144,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 @@ -1162,7 +1162,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 @@ -1234,7 +1234,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 @@ -1251,7 +1251,7 @@ def load_bundler_cache
end

# fix git gemspec bug from Bundler 1.3.0+ upgrade
if File.exists?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory")
if File.exist?(bundler_cache) && !@metadata.exists?(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
Loading