Skip to content

Commit

Permalink
Merge pull request #17312 from Homebrew/portable-ruby-3.3.1
Browse files Browse the repository at this point in the history
Portable Ruby 3.3.1
  • Loading branch information
MikeMcQuaid authored May 17, 2024
2 parents 97030b7 + 727cf5e commit 23939d6
Show file tree
Hide file tree
Showing 212 changed files with 50 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# Ignore Ruby gems for versions other than we explicitly vendor.
# Keep this in sync with the list in standalone/init.rb.
**/vendor/bundle/ruby/*/
!**/vendor/bundle/ruby/3.1.0/
!**/vendor/bundle/ruby/3.3.0/

# Ignore Bundler binary files
**/vendor/bundle/ruby/*/gems/**/*.bundle
Expand Down
3 changes: 2 additions & 1 deletion Library/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Performance/MethodObjectAsBlock:

RSpec:
Include:
- 'Homebrew/test/**/*'
- "Homebrew/test/**/*"

# Intentionally disabled as it doesn't fit with our code style.
RSpec/AnyInstance:
Expand Down Expand Up @@ -284,6 +284,7 @@ Sorbet/TrueSigil:
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"
- "Homebrew/test/**/*.rb"
- "Homebrew/extend/pathname/rmtree.rb"

# Require &&/|| instead of and/or
Style/AndOr:
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Style/Documentation:
- extend/ENV/super.rb
- extend/kernel.rb
- extend/pathname.rb
- extend/pathname/rmtree.rb
- formula.rb
- formula_assertions.rb
- formula_free_port.rb
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ source "https://rubygems.org"
# The default case (no envs), should always be a restrictive bound on the lowest supported minor version.
# This is the branch that Dependabot will use.
if ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", "").empty?
ruby "~> 3.1.0"
ruby "~> 3.3.0"
else
ruby ">= 3.1.0"
ruby ">= 3.3.0"
end

# disallowed gems (should not be used)
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ DEPENDENCIES
yard-sorbet

RUBY VERSION
ruby 3.1.4p223
ruby 3.3.1

BUNDLED WITH
2.4.18
2.5.9
14 changes: 7 additions & 7 deletions Library/Homebrew/cmd/vendor-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ set_ruby_variables() {
# use a x86_64 Portable Ruby.
[[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]]
then
ruby_FILENAME="portable-ruby-3.1.4.el_capitan.bottle.tar.gz"
ruby_SHA="02180ca8b8295422ae84921bcf034b7ee8ce5575488bd5e6a37a192e53cd5d34"
ruby_FILENAME="portable-ruby-3.3.1.el_capitan.bottle.tar.gz"
ruby_SHA="34312337c0add491f876b04e8b273a258453d6b633226130ef3105373a97c950"
elif [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" ]]
then
ruby_FILENAME="portable-ruby-3.1.4.arm64_big_sur.bottle.tar.gz"
ruby_SHA="d783cbeb6e6ef0d71c0b442317b54554370decd6fac66bf2d4938c07a63f67be"
ruby_FILENAME="portable-ruby-3.3.1.arm64_big_sur.bottle.tar.gz"
ruby_SHA="86ff822590529e8e9093cdc1702a1d3321678c85347d30f82db4f993db8f9eb1"
fi
elif [[ -n "${HOMEBREW_LINUX}" ]]
then
case "${VENDOR_PROCESSOR}" in
x86_64)
ruby_FILENAME="portable-ruby-3.1.4.x86_64_linux.bottle.tar.gz"
ruby_SHA="f7be167f7ac4f296b9f4c5874ceeea4aafd9999c3c7f2b0378cae7dd273e2322"
ruby_FILENAME="portable-ruby-3.3.1.x86_64_linux.bottle.tar.gz"
ruby_SHA="f49956aa43522c8e86127f7f5d377af2651fe35da975f5993eb2d038865c118c"
;;
*) ;;
esac
Expand All @@ -59,7 +59,7 @@ set_ruby_variables() {
fi
ruby_URLs+=(
"https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.1.4/${ruby_FILENAME}"
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.3.1/${ruby_FILENAME}"
)
ruby_URL="${ruby_URLs[0]}"
fi
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -584,3 +584,5 @@ def uninstall_info
puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
end
end

require "extend/pathname/rmtree"
15 changes: 15 additions & 0 deletions Library/Homebrew/extend/pathname/rmtree.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# typed: false
# frozen_string_literal: true

class Pathname
# Like regular `rmtree`, except it never ignores errors.
#
# This was the default behaviour in Ruby 3.1 and earlier.
#
# @api public
def rmtree(noop: nil, verbose: nil, secure: nil)
# odeprecated "rmtree", "FileUtils#rm_r"
FileUtils.rm_r(@path, noop:, verbose:, secure:)
nil
end
end
6 changes: 3 additions & 3 deletions Library/Homebrew/standalone/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

# This list should match .gitignore
vendored_versions = ["3.1"].freeze
vendored_versions = ["3.3"].freeze
vendored_versions.include?("#{ruby_major}.#{ruby_minor}")
end.freeze

Expand All @@ -43,8 +43,8 @@
ruby_version = RbConfig::CONFIG["ruby_version"]
ruby_path = "#{RbConfig::CONFIG["rubylibprefix"]}/gems/#{ruby_version}"

$LOAD_PATH.unshift "#{ruby_path}/extensions/#{Gem::Platform.local}/#{ruby_version}-static/debug-1.6.3"
$LOAD_PATH.unshift "#{ruby_path}/gems/debug-1.6.3/lib"
$LOAD_PATH.unshift "#{ruby_path}/extensions/#{Gem::Platform.local}/#{ruby_version}-static/debug-1.9.1"
$LOAD_PATH.unshift "#{ruby_path}/gems/debug-1.9.1/lib"
end

unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@

before do
allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths)
.and_wrap_original do |method, *args|
method.call(*args).tap do |trashed, _|
.and_wrap_original do |method, *args, **kwargs|
method.call(*args, **kwargs).tap do |trashed, _|
FileUtils.rm_r trashed
end
end
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/utils/gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
module Homebrew
# Keep in sync with the `Gemfile.lock`'s BUNDLED WITH.
# After updating this, run `brew vendor-gems --update=--bundler`.
HOMEBREW_BUNDLER_VERSION = "2.4.18"
HOMEBREW_BUNDLER_VERSION = "2.5.9"

# Bump this whenever a committed vendored gem is later added to or exclusion removed from gitignore.
# This will trigger it to reinstall properly if `brew install-bundler-gems` needs it.
VENDOR_VERSION = 6
VENDOR_VERSION = 7
private_constant :VENDOR_VERSION

RUBY_BUNDLE_VENDOR_DIRECTORY = (HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").freeze
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/utils/ruby.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# When bumping, run `brew vendor-gems --update=--ruby`
# When bumping to a new major/minor version, also update the bounds in the Gemfile
export HOMEBREW_REQUIRED_RUBY_VERSION=3.1
export HOMEBREW_REQUIRED_RUBY_VERSION=3.3

# Disable Ruby options we don't need.
export HOMEBREW_RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt"
Expand Down
11 changes: 9 additions & 2 deletions Library/Homebrew/vendor/bundle/bundler/setup.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
require 'rbconfig'
module Kernel
remove_method(:gem) if private_method_defined?(:gem)

def gem(*)
end

private :gem
end
unless defined?(Gem)
module Gem
def self.ruby_api_version
Expand All @@ -17,8 +25,7 @@ def self.extension_api_version
if Gem.respond_to?(:discover_gems_on_require=)
Gem.discover_gems_on_require = false
else
kernel = (class << ::Kernel; self; end)
[kernel, ::Kernel].each do |k|
[::Kernel.singleton_class, ::Kernel].each do |k|
if k.private_method_defined?(:gem_original_require)
private_require = k.private_method_defined?(:require)
k.send(:remove_method, :require)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/vendor/portable-ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.3.1

0 comments on commit 23939d6

Please sign in to comment.