aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-02-09 19:05:53 -0800
committerMike McQuaid2013-03-01 17:49:09 +0000
commitd1cd6b2d86c157c390e8e3d1c373deaabbd65301 (patch)
treec878756d0e0824d81fd11dc21e8e6411eef36e1b /Library
parent1e4af27b1de59cab32e89f745d0d10ea29d5b15a (diff)
downloadhomebrew-d1cd6b2d86c157c390e8e3d1c373deaabbd65301.tar.bz2
Add custom bottle URL support.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/bottles.rb9
-rw-r--r--Library/Homebrew/formula.rb2
-rw-r--r--Library/Homebrew/formula_support.rb6
3 files changed, 13 insertions, 4 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index d474a6f65..7962a50e1 100644
--- a/Library/Homebrew/bottles.rb
+++ b/Library/Homebrew/bottles.rb
@@ -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
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index eff006cdc..d1ef58f50 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -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
diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb
index 2f3b10322..c9355d641 100644
--- a/Library/Homebrew/formula_support.rb
+++ b/Library/Homebrew/formula_support.rb
@@ -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