Merge pull request #832 from DomT4/bintr@y

bottles: translate foo@1.2 to fooAT1.2
This commit is contained in:
Dominyk Tiller 2016-08-30 21:01:45 +01:00 committed by GitHub
commit 1b6908f41e
3 changed files with 14 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class Formulary
class_name = name.capitalize
class_name.gsub!(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase }
class_name.tr!("+", "x")
class_name.gsub!(/\b@\b/, "AT")
class_name.sub!(/(.)@(\d)/, "\\1AT\\2")
class_name
end

View File

@ -244,4 +244,13 @@ class UtilTests < Homebrew::TestCase
assert_match "homebrew/homebrew-core", e.message
assert_match "homebrew/core", e.message
end
def test_bottles_bintray
assert_equal "openssl:1.1", Utils::Bottles::Bintray.package("openssl@1.1")
assert_equal "gtkx", Utils::Bottles::Bintray.package("gtk+")
assert_equal "llvm", Utils::Bottles::Bintray.package("llvm")
tap = Tap.new("homebrew", "bintray-test")
assert_equal "bottles-bintray-test", Utils::Bottles::Bintray.repository(tap)
end
end

View File

@ -56,7 +56,10 @@ module Utils
class Bintray
def self.package(formula_name)
formula_name.to_s.tr("+", "x")
package_name = formula_name.to_s.dup
package_name.tr!("+", "x")
package_name.sub!(/(.)@(\d)/, "\\1:\\2") # Handle foo@1.2 style formulae.
package_name
end
def self.repository(tap = nil)