Switch back to monkey-patching

Also gsub! some particular formula contents to work around older
formulae ("brewkit" isn't around anymore, and url is expected to
be a method, not an instance variable).
This commit is contained in:
Caleb Xu 2018-08-16 12:52:54 -04:00
parent 95abdf9662
commit 260867627b

View File

@ -15,20 +15,19 @@ require "utils/git"
require "formulary"
require "tap"
module ExtractExtensions
refine BottleSpecification do
class BottleSpecification
def method_missing(m, *_args, &_block)
# no-op
end
end
end
refine Module do
class Module
def method_missing(m, *_args, &_block)
# no-op
end
end
end
refine DependencyCollector do
class DependencyCollector
def parse_symbol_spec(spec, tags)
case spec
when :x11 then X11Requirement.new(spec.to_s, tags)
@ -45,15 +44,17 @@ module ExtractExtensions
end
end
module Compat
def parse_string_spec(spec, tags)
opoo "'depends_on ... => :run' is disabled. There is no replacement." if tags.include?(:run) && ARGV.debug?
super
end
end
prepend Compat
end
module Homebrew
using ExtractExtensions
module_function
def extract
@ -124,6 +125,8 @@ module Homebrew
def formula_at_revision(repo, name, file, rev)
return if rev.empty?
contents = Git.last_revision_of_file(repo, file, before_commit: rev)
contents.gsub!("@url=", "url ")
contents.gsub!("require 'brewkit'", "require 'formula'")
Formulary.from_contents(name, file, contents)
end
end