2024-08-09 18:18:09 +01:00
|
|
|
# typed: true # This cannot be `# typed: strict` due to the use of `undef`.
|
2022-11-20 10:49:53 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
class Cleanup
|
|
|
|
undef use_system_ruby?
|
|
|
|
|
|
|
|
def use_system_ruby?
|
2023-11-07 19:27:30 +00:00
|
|
|
return false if Homebrew::EnvConfig.force_vendor_ruby?
|
2022-11-20 10:49:53 -08:00
|
|
|
|
|
|
|
rubies = [which("ruby"), which("ruby", ORIGINAL_PATHS)].compact
|
|
|
|
system_ruby = Pathname.new("/usr/bin/ruby")
|
|
|
|
rubies << system_ruby if system_ruby.exist?
|
|
|
|
|
|
|
|
check_ruby_version = HOMEBREW_LIBRARY_PATH/"utils/ruby_check_version_script.rb"
|
|
|
|
rubies.uniq.any? do |ruby|
|
|
|
|
quiet_system ruby, "--enable-frozen-string-literal", "--disable=gems,did_you_mean,rubyopt",
|
2023-11-07 19:27:30 +00:00
|
|
|
check_ruby_version, RUBY_VERSION
|
2022-11-20 10:49:53 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|