Skip to content

Commit

Permalink
Merge pull request #16479 from alichtman/master
Browse files Browse the repository at this point in the history
Fix "OS is not a class" crash on Ubuntu 23.10
  • Loading branch information
Bo98 authored Jan 18, 2024
2 parents 4fdc7e9 + ec0434c commit d84eadf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Library/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ Performance/MethodObjectAsBlock:
Rails:
# Selectively enable what we want.
Enabled: false
# Do not use ActiveSupport in RuboCops.
Exclude:
# This file is loaded before any extra methods are defined.
- "Homebrew/standalone/init.rb"
# Do not use ActiveSupport in RuboCops.
- "Homebrew/rubocops/**/*"

# These relate to ActiveSupport and not other parts of Rails.
Expand Down
8 changes: 7 additions & 1 deletion Library/Homebrew/standalone/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
ENV["HOMEBREW_SKIP_INITIAL_GEM_INSTALL"] = "1"
end

$LOAD_PATH.push HOMEBREW_LIBRARY_PATH.to_s unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
# Insert the path after any existing Homebrew paths (e.g. those inserted by tests and parent processes)
last_homebrew_path_idx = $LOAD_PATH.rindex do |path|
path.start_with?(HOMEBREW_LIBRARY_PATH.to_s) && !path.include?("vendor/portable-ruby")
end || -1
$LOAD_PATH.insert(last_homebrew_path_idx + 1, HOMEBREW_LIBRARY_PATH.to_s)
end
require_relative "../vendor/bundle/bundler/setup"
$LOAD_PATH.unshift "#{HOMEBREW_LIBRARY_PATH}/vendor/bundle/#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/" \
"bundler-#{Homebrew::HOMEBREW_BUNDLER_VERSION}/lib"
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
require "byebug"
require "timeout"

$LOAD_PATH.push(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib"))
$LOAD_PATH.unshift(File.expand_path("#{ENV.fetch("HOMEBREW_LIBRARY")}/Homebrew/test/support/lib"))

require_relative "../global"

Expand Down

0 comments on commit d84eadf

Please sign in to comment.