Skip to content

Commit

Permalink
Merge pull request #70 from Scalingo/deps/upstream_v272
Browse files Browse the repository at this point in the history
Sync with upstream v272
  • Loading branch information
Frzk authored Jun 19, 2024
2 parents cbdcd6e + 384eff1 commit dda90af
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 494 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: Run ShellCheck bin top level
run: |
shellcheck bin/support/bash_functions.sh bin/support/download_ruby -x &&
shellcheck bin/build bin/compile bin/detect bin/release bin/test bin/test-compile -x
shellcheck bin/compile bin/detect bin/release bin/test bin/test-compile -x
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
## [Unreleased]


## [v272] - 2024-06-13

- Remove experimental CNB support. For official CNB support use [heroku/buildpacks-ruby](https://github.com/heroku/buildpacks-ruby) instead. (https://github.com/heroku/heroku-buildpack-ruby/pull/1464)
- Default Ruby version is now 3.1.6 (https://github.com/heroku/heroku-buildpack-ruby/pull/1466)
- Ruby 3.3.3 is now available

## [v271] - 2024-06-03

- Ruby 3.4.0-preview1 is now available
- Ruby 3.1.6 and 3.3.2 are now available
- JRuby 9.4.7.0, 9.4.6.0, and 9.3.14.0 are now available

## [v271] - 2024-05-24

- Fix issue with sprockets reference being nil when
propshaft gem is used instead (https://github.com/heroku/heroku-buildpack-ruby/pull/1452)

Expand Down Expand Up @@ -1535,7 +1538,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/v271...main
[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v272...main
[v272]: https://github.com/heroku/heroku-buildpack-ruby/compare/v271...v272
[v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271
[v271]: https://github.com/heroku/heroku-buildpack-ruby/compare/v270...v271
[v270]: https://github.com/heroku/heroku-buildpack-ruby/compare/v269...v270
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ DEPENDENCIES
toml-rb

RUBY VERSION
ruby 3.1.4p223
ruby 3.1.6p260

BUNDLED WITH
2.5.8
2.5.11
29 changes: 0 additions & 29 deletions bin/build

This file was deleted.

12 changes: 2 additions & 10 deletions bin/detect
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
#!/bin/sh

if [ -z "$CNB_STACK_ID" ]; then
# v2 API
APP_DIR=$1
else
_PLATFORM_DIR=$1
_PLAN=$2
# v3 API
APP_DIR=$(pwd)
fi
APP_DIR=$1

if [ -f "$APP_DIR/Gemfile" ]; then
echo "Ruby"
exit 0
else
exit 100
exit 1
fi
31 changes: 0 additions & 31 deletions bin/support/ruby_build

This file was deleted.

27 changes: 4 additions & 23 deletions buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
api = "0.2"

[buildpack]
id = "heroku/ruby"
version = "0.1.4"
name = "Ruby"
homepage = "https://github.com/heroku/heroku-buildpack-ruby"
ruby_version = "3.1.4"
ruby_version = "3.1.6"

[publish]

Expand All @@ -19,30 +14,16 @@ files = [
"app.json",
"hatchet.json",
"hatchet.lock",
"package.toml",
]

[[publish.Vendor]]
url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.4.tgz"
url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-20/ruby-3.1.6.tgz"
dir = "vendor/ruby/heroku-20"

[[publish.Vendor]]
url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.4.tgz"
url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.1.6.tgz"
dir = "vendor/ruby/heroku-22"

[[publish.Vendor]]
url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.4.tgz"
url = "https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-24/amd64/ruby-3.1.6.tgz"
dir = "vendor/ruby/amd64/heroku-24"

[[stacks]]
id = "heroku-20"

[[stacks]]
id = "heroku-22"

[metadata]

[metadata.release]

[metadata.release.docker]
repository = "public.ecr.aws/heroku-buildpacks/heroku-ruby-buildpack"
3 changes: 3 additions & 0 deletions changelogs/v272/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.1.6

The [default Ruby version for new Ruby applications is 3.1.6](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.
107 changes: 20 additions & 87 deletions lib/language_pack/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require "language_pack/shell_helpers"
require "language_pack/cache"
require "language_pack/helpers/bundler_cache"
require "language_pack/helpers/layer"
require "language_pack/metadata"
require "language_pack/fetcher"

Expand All @@ -29,15 +28,14 @@ class LanguagePack::Base
# changes directory to the build_path
# @param [String] the path of the build dir
# @param [String] the path of the cache dir this is nil during detect and release
def initialize(build_path, cache_path = nil, layer_dir=nil)
def initialize(build_path, cache_path = nil)
@build_path = build_path
@stack = ENV.fetch("STACK")
@cache = LanguagePack::Cache.new(cache_path)
@metadata = LanguagePack::Metadata.new(@cache)
@bundler_cache = LanguagePack::BundlerCache.new(@cache, @stack)
@id = Digest::SHA1.hexdigest("#{Time.now.to_f}-#{rand(1000000)}")[0..10]
@fetchers = {:buildpack => LanguagePack::Fetcher.new(VENDOR_URL) }
@layer_dir = layer_dir
@arch = get_arch

Dir.chdir build_path
Expand Down Expand Up @@ -104,24 +102,6 @@ def compile
mcount "success"
end

def build
write_release_toml
Kernel.puts ""
warnings.each do |warning|
Kernel.puts "\e[1m\e[33m###### WARNING:\e[0m"# Bold yellow
Kernel.puts ""
puts warning
Kernel.puts ""
Kernel.puts ""
end
if deprecations.any?
topic "DEPRECATIONS:"
puts @deprecations.join("\n")
end
Kernel.puts ""
mcount "success"
end

def build_release
release = {}
release["addons"] = default_addons
Expand All @@ -131,29 +111,6 @@ def build_release
release
end

def write_release_toml
release = build_release

layer = LanguagePack::Helpers::Layer.new(@layer_dir, "env", launch: true)
FileUtils.mkdir_p("#{layer.path}/env.launch")
release["config_vars"].each do |key, value|
File.open("#{layer.path}/env.launch/#{key.upcase}.override", 'w') do |f|
f.write(value)
end
end

release_toml = release["default_process_types"].map do |type, command|
<<PROCESSES
[[processes]]
type = "#{type}"
command = "#{command}"
PROCESSES
end
File.open("#{@layer_dir}/launch.toml", 'a') do |f|
f.write(release_toml.join("\n"))
end
end

def write_release_yaml
release = build_release
FileUtils.mkdir("tmp") unless File.exists?("tmp")
Expand All @@ -164,11 +121,6 @@ def write_release_yaml
warn_webserver
end

# write out the release. Pick v2a or v3 release format
def write_release
@layer_dir ? write_release_toml : write_release_yaml
end

def warn_webserver
return if File.exist?("Procfile")
msg = "No Procfile detected, using the default web server (webrick)\n"
Expand Down Expand Up @@ -209,7 +161,7 @@ def setup_language_pack_environment
end

def add_to_profiled(string, filename: "ruby.sh", mode: "a")
profiled_path = @layer_dir ? "#{@layer_dir}/ruby/profile.d/" : "#{build_path}/.profile.d/"
profiled_path = "#{build_path}/.profile.d/"

FileUtils.mkdir_p profiled_path
File.open("#{profiled_path}/#{filename}", mode) do |file|
Expand All @@ -234,51 +186,32 @@ def add_to_export(string)

# option can be :path, :default, :override
# https://github.com/buildpacks/spec/blob/366ac1aa0be59d11010cc21aa06c16d81d8d43e7/buildpack.md#environment-variable-modification-rules
def export(key, val, layer: nil, option: nil)
if layer
# don't replace if the key is already set
return if ENV[key] && option == :default

filename =
if option.nil? || option == :path
key
elsif option == :default
"#{key}.override"
else
"#{key}.#{option}"
end

FileUtils.mkdir_p("#{layer.path}/env.build")
File.open("#{layer.path}/env.build/#{filename}", "w") do |f|
f.write(val)
end
else
string =
if option == :default
%{export #{key}="${#{key}:-#{val}}"}
elsif option == :path
%{export #{key}="#{val}:$#{key}"}
else
%{export #{key}="#{val.gsub('"','\"')}"}
end

export = File.join(ROOT_DIR, "export")
File.open(export, "a") do |file|
file.puts string
def export(key, val, option: nil)
string =
if option == :default
%{export #{key}="${#{key}:-#{val}}"}
elsif option == :path
%{export #{key}="#{val}:$#{key}"}
else
%{export #{key}="#{val.gsub('"','\"')}"}
end

export = File.join(ROOT_DIR, "export")
File.open(export, "a") do |file|
file.puts string
end
end

def set_export_default(key, val, layer = nil)
export key, val, layer: layer, option: :default
def set_export_default(key, val)
export key, val, option: :default
end

def set_export_override(key, val, layer = nil)
export key, val, layer: layer, option: :override
def set_export_override(key, val)
export key, val, option: :override
end

def set_export_path(key, val, layer = nil)
export key, val, layer: layer, option: :path
def set_export_path(key, val)
export key, val, option: :path
end

def log_internal(*args)
Expand Down
Loading

0 comments on commit dda90af

Please sign in to comment.