aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDominyk Tiller2016-08-30 21:01:45 +0100
committerGitHub2016-08-30 21:01:45 +0100
commit1b6908f41e874040d29e7c698b7dd83b037bc61d (patch)
tree1f2a2b32a385f197c5436bdf869c629f953a52cb /Library
parent8bf787c94d77cc55955949076cc0d77e9b13c76d (diff)
parent4072628a80568ec7d945548c14a67593427b997c (diff)
downloadbrew-1b6908f41e874040d29e7c698b7dd83b037bc61d.tar.bz2
Merge pull request #832 from DomT4/bintr@y
bottles: translate foo@1.2 to fooAT1.2
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formulary.rb2
-rw-r--r--Library/Homebrew/test/test_utils.rb9
-rw-r--r--Library/Homebrew/utils/bottles.rb5
3 files changed, 14 insertions, 2 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 162385e60..261a54fef 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -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
diff --git a/Library/Homebrew/test/test_utils.rb b/Library/Homebrew/test/test_utils.rb
index 9b55965b5..9fd6f65ef 100644
--- a/Library/Homebrew/test/test_utils.rb
+++ b/Library/Homebrew/test/test_utils.rb
@@ -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
diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb
index d1798ecc9..927963bc1 100644
--- a/Library/Homebrew/utils/bottles.rb
+++ b/Library/Homebrew/utils/bottles.rb
@@ -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)