extract: check if DependencyCollector::Compat is defined before monkey-patch
This commit is contained in:
parent
ad0f9d603f
commit
b1120dd404
@ -44,12 +44,14 @@ def with_monkey_patch
|
||||
define_method(:parse_symbol_spec) { |*| }
|
||||
end
|
||||
|
||||
if defined?(DependencyCollector::Compat)
|
||||
DependencyCollector::Compat.class_eval do
|
||||
if method_defined?(:parse_string_spec)
|
||||
alias_method :old_parse_string_spec, :parse_string_spec
|
||||
end
|
||||
define_method(:parse_string_spec) { |*| }
|
||||
end
|
||||
end
|
||||
|
||||
yield
|
||||
ensure
|
||||
@ -81,12 +83,14 @@ ensure
|
||||
end
|
||||
end
|
||||
|
||||
if defined?(DependencyCollector::Compat)
|
||||
DependencyCollector::Compat.class_eval do
|
||||
if method_defined?(:old_parse_string_spec)
|
||||
alias_method :parse_string_spec, :old_parse_string_spec
|
||||
undef :old_parse_string_spec
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Homebrew
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user