Add custom bottle URL support.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Mike McQuaid 2013-02-09 19:05:53 -08:00
parent 443bf9f287
commit 22aec1d0d9
3 changed files with 13 additions and 4 deletions

View File

@ -70,6 +70,11 @@ def bottle_regex
Pathname::BOTTLE_EXTNAME_RX
end
def bottle_base_url
"https://downloads.sf.net/project/machomebrew/Bottles/"
def bottle_root_url f
root_url = f.bottle.root_url
root_url ||= 'https://downloads.sf.net/project/machomebrew/Bottles'
end
def bottle_url f
"#{bottle_root_url(f)}/#{bottle_filename(f)}"
end

View File

@ -39,7 +39,7 @@ class Formula
# Ensure the bottle URL is set. If it does not have a checksum,
# then a bottle is not available for the current platform.
if @bottle and not (@bottle.checksum.nil? or @bottle.checksum.empty?)
@bottle.url ||= bottle_base_url + bottle_filename(self)
@bottle.url ||= bottle_url(self)
if @bottle.cat_without_underscores
@bottle.url.gsub!(MacOS.cat.to_s, MacOS.cat_without_underscores.to_s)
end

View File

@ -79,7 +79,7 @@ end
class Bottle < SoftwareSpec
attr_writer :url
attr_reader :revision
attr_reader :revision, :root_url
# TODO: Can be removed when all bottles migrated to underscored cat symbols.
attr_reader :cat_without_underscores
@ -113,6 +113,10 @@ class Bottle < SoftwareSpec
}
end
def root_url val=nil
val.nil? ? @root_url : @root_url = val
end
def revision val=nil
val.nil? ? @revision : @revision = val
end