30 lines
833 B
Ruby
Raw Permalink Normal View History

# typed: strict
2022-11-20 10:49:53 -08:00
# frozen_string_literal: true
2024-09-18 15:33:49 -07:00
module OS
module Linux
module Cleanup
extend T::Helpers
2024-09-05 19:56:32 -07:00
2024-09-18 15:33:49 -07:00
requires_ancestor { Homebrew::Cleanup }
2022-11-20 10:49:53 -08:00
2024-09-18 15:33:49 -07:00
sig { returns(T::Boolean) }
def use_system_ruby?
return false if Homebrew::EnvConfig.force_vendor_ruby?
2022-11-20 10:49:53 -08:00
2024-09-18 15:33:49 -07:00
rubies = [which("ruby"), which("ruby", ORIGINAL_PATHS)].compact
system_ruby = Pathname.new("/usr/bin/ruby")
rubies << system_ruby if system_ruby.exist?
2022-11-20 10:49:53 -08:00
2024-09-18 15:33:49 -07:00
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",
check_ruby_version, RUBY_VERSION
2024-09-13 12:22:52 -07:00
end
2022-11-20 10:49:53 -08:00
end
end
end
end
2024-09-05 19:56:32 -07:00
2024-09-18 15:33:49 -07:00
Homebrew::Cleanup.prepend(OS::Linux::Cleanup)