extract: ignore syntax errors during load

This commit is contained in:
Adrian Ho 2021-07-17 13:45:59 +08:00 committed by Adrian Ho
parent dbcd764968
commit a14d8924de
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 = Utils::Git.last_revision_of_file(repo, file, before_commit: rev)
contents.gsub!("@url=", "url ") contents.gsub!("@url=", "url ")
contents.gsub!("require 'brewkit'", "require 'formula'") 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
end end

View File

@ -14,9 +14,17 @@ describe "brew extract" do
core_tap = CoreTap.new core_tap = CoreTap.new
core_tap.path.cd do core_tap.path.cd do
system "git", "init" 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", "add", "--all"
system "git", "commit", "-m", "testball 0.1" 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 = File.read(formula_file)
contents.gsub!("testball-0.1", "testball-0.2") contents.gsub!("testball-0.1", "testball-0.2")
File.write(formula_file, contents) File.write(formula_file, contents)