From 024c2d508b2af9246d68861663331fba80b50a06 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 3 Jul 2015 21:34:22 +0800 Subject: auto resolve bottle root_url based on tap --- Library/Homebrew/software_spec.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/software_spec.rb') 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 -- cgit v1.2.3