Merge pull request #7066 from alebcay/extract-handle-versions

extract: handle versioned formulae names
This commit is contained in:
Mike McQuaid 2020-02-25 19:31:38 +00:00 committed by GitHub
commit cf02ac9d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,6 +180,9 @@ module Homebrew
# The class name has to be renamed to match the new filename,
# e.g. Foo version 1.2.3 becomes FooAT123 and resides in Foo@1.2.3.rb.
class_name = Formulary.class_s(name)
# Remove any existing version suffixes, as a new one will be added later
name.sub!(/\b@(.*)\z\b/i, "")
versioned_name = Formulary.class_s("#{name}@#{version}")
result.gsub!("class #{class_name} < Formula", "class #{versioned_name} < Formula")