aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/software_spec.rb
diff options
context:
space:
mode:
authorXu Cheng2015-07-03 21:34:22 +0800
committerXu Cheng2015-07-06 18:04:59 +0800
commit024c2d508b2af9246d68861663331fba80b50a06 (patch)
tree32697fd01671493abcf8dd25535e075fb4c2f0ff /Library/Homebrew/software_spec.rb
parentb78cbb731421847cb4d172934f8a56a9749d69e6 (diff)
downloadbrew-024c2d508b2af9246d68861663331fba80b50a06.tar.bz2
auto resolve bottle root_url based on tap
Diffstat (limited to 'Library/Homebrew/software_spec.rb')
-rw-r--r--Library/Homebrew/software_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb
index 060568664..9ace95e21 100644
--- a/Library/Homebrew/software_spec.rb
+++ b/Library/Homebrew/software_spec.rb
@@ -47,6 +47,7 @@ class SoftwareSpec
def owner= owner
@name = owner.name
@full_name = owner.full_name
+ @bottle_specification.tap = owner.tap
@owner = owner
@resource.owner = self
resources.each_value do |r|
@@ -259,19 +260,26 @@ class BottleSpecification
DEFAULT_PREFIX = "/usr/local".freeze
DEFAULT_CELLAR = "/usr/local/Cellar".freeze
DEFAULT_DOMAIN = "https://homebrew.bintray.com".freeze
- DEFAULT_ROOT_URL = "#{DEFAULT_DOMAIN}/bottles".freeze
- attr_rw :root_url, :prefix, :cellar, :revision
+ attr_rw :prefix, :cellar, :revision
+ attr_accessor :tap
attr_reader :checksum, :collector
def initialize
@revision = 0
@prefix = DEFAULT_PREFIX
@cellar = DEFAULT_CELLAR
- @root_url = DEFAULT_ROOT_URL
@collector = BottleCollector.new
end
+ def root_url(var=nil)
+ if var.nil?
+ @root_url ||= "#{DEFAULT_DOMAIN}/#{Bintray.repository(tap)}"
+ else
+ @root_url = var
+ end
+ end
+
def compatible_cellar?
cellar == :any || cellar == HOMEBREW_CELLAR.to_s
end