-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace undef with prepended modules
- Loading branch information
Showing
12 changed files
with
87 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
class Cleaner | ||
module CleanerMac | ||
private | ||
|
||
undef executable_path? | ||
|
||
sig { params(path: Pathname).returns(T::Boolean) } | ||
def executable_path?(path) | ||
path.mach_o_executable? || path.text_executable? | ||
end | ||
end | ||
|
||
Cleaner.prepend(CleanerMac) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
class FormulaInstaller | ||
undef fresh_install? | ||
module FormulaInstallerMac | ||
extend T::Helpers | ||
|
||
requires_ancestor { FormulaInstaller } | ||
|
||
sig { params(formula: Formula).returns(T.nilable(T::Boolean)) } | ||
def fresh_install?(formula) | ||
!Homebrew::EnvConfig.developer? && !OS::Mac.version.outdated_release? && | ||
(!installed_as_dependency? || !formula.any_version_installed?) | ||
end | ||
end | ||
|
||
FormulaInstaller.prepend(FormulaInstallerMac) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Readall | ||
class << self | ||
undef valid_casks? | ||
module ReadallMac | ||
extend T::Helpers | ||
|
||
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type) | ||
return true if os_name == :linux | ||
requires_ancestor { Kernel } | ||
|
||
current_macos_version = if os_name.is_a?(Symbol) | ||
MacOSVersion.from_symbol(os_name) | ||
else | ||
MacOS.version | ||
end | ||
sig { params(tap: Tap, os_name: T.nilable(Symbol), arch: T.nilable(Symbol)).returns(T::Boolean) } | ||
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type) | ||
return true if os_name == :linux | ||
|
||
current_macos_version = if os_name.is_a?(Symbol) | ||
MacOSVersion.from_symbol(os_name) | ||
else | ||
MacOS.version | ||
end | ||
|
||
success = T.let(true, T::Boolean) | ||
tap.cask_files.each do |file| | ||
cask = Cask::CaskLoader.load(file) | ||
|
||
# Fine to have missing URLs for unsupported macOS | ||
macos_req = cask.depends_on.macos | ||
next if macos_req&.version && Array(macos_req.version).none? do |macos_version| | ||
current_macos_version.compare(macos_req.comparator, macos_version) | ||
end | ||
|
||
raise "Missing URL" if cask.url.nil? | ||
rescue Interrupt | ||
raise | ||
rescue Exception => e # rubocop:disable Lint/RescueException | ||
os_and_arch = "macOS #{current_macos_version} on #{arch}" | ||
onoe "Invalid cask (#{os_and_arch}): #{file}" | ||
$stderr.puts e | ||
success = false | ||
success = T.let(true, T::Boolean) | ||
tap.cask_files.each do |file| | ||
cask = Cask::CaskLoader.load(file) | ||
|
||
# Fine to have missing URLs for unsupported macOS | ||
macos_req = cask.depends_on.macos | ||
next if macos_req&.version && Array(macos_req.version).none? do |macos_version| | ||
current_macos_version.compare(macos_req.comparator, macos_version) | ||
end | ||
success | ||
|
||
raise "Missing URL" if cask.url.nil? | ||
rescue Interrupt | ||
raise | ||
rescue Exception => e # rubocop:disable Lint/RescueException | ||
os_and_arch = "macOS #{current_macos_version} on #{arch}" | ||
onoe "Invalid cask (#{os_and_arch}): #{file}" | ||
$stderr.puts e | ||
success = false | ||
end | ||
success | ||
end | ||
end | ||
|
||
Readall.singleton_class.prepend(ReadallMac) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters