Merge pull request #11731 from gromgit/extract/fix_load

extract: ignore syntax errors during load
This commit is contained in:
Mike McQuaid 2021-07-20 11:15:10 +01:00 committed by GitHub
commit acc5d68654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -226,6 +226,6 @@ module Homebrew
contents = Utils::Git.last_revision_of_file(repo, file, before_commit: rev)
contents.gsub!("@url=", "url ")
contents.gsub!("require 'brewkit'", "require 'formula'")
with_monkey_patch { Formulary.from_contents(name, file, contents) }
with_monkey_patch { Formulary.from_contents(name, file, contents, ignore_errors: true) }
end
end

View File

@ -14,9 +14,17 @@ describe "brew extract" do
core_tap = CoreTap.new
core_tap.path.cd do
system "git", "init"
formula_file = setup_test_formula "testball"
# Start with deprecated bottle syntax
setup_test_formula "testball", bottle_block: <<~EOS
bottle do
cellar :any
end
EOS
system "git", "add", "--all"
system "git", "commit", "-m", "testball 0.1"
# Replace with a valid formula for the next version
formula_file = setup_test_formula "testball"
contents = File.read(formula_file)
contents.gsub!("testball-0.1", "testball-0.2")
File.write(formula_file, contents)