aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-09-13 12:59:13 +0800
committerXu Cheng2015-09-13 12:59:13 +0800
commit2df6ad1beda5f29f6eaf6807ec4a53f59bb20260 (patch)
tree94db107c04220453c89f7a59f8cd42d97c50744b
parent81bd5c40d0719d3d64dc94e163ded2cc2f57b3e6 (diff)
downloadbrew-2df6ad1beda5f29f6eaf6807ec4a53f59bb20260.tar.bz2
Formula#to_hash: add bottle info
Closes Homebrew/homebrew#43848. Signed-off-by: Xu Cheng <xucheng@me.com>
-rw-r--r--Library/Homebrew/formula.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index a3f63f1bd..3a00aae29 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -1120,6 +1120,28 @@ class Formula
{ "option" => opt.flag, "description" => opt.description }
end
+ hsh["bottle"] = {}
+ %w[stable devel].each do |spec_sym|
+ next unless spec = send(spec_sym)
+ next unless (bottle_spec = spec.bottle_specification).checksums.any?
+ bottle_info = {
+ "revision" => bottle_spec.revision,
+ "cellar" => (cellar = bottle_spec.cellar).is_a?(Symbol) ? \
+ cellar.inspect : cellar,
+ "prefix" => bottle_spec.prefix,
+ "root_url" => bottle_spec.root_url,
+ }
+ bottle_info["files"] = {}
+ bottle_spec.collector.keys.each do |os|
+ checksum = bottle_spec.collector[os]
+ bottle_info["files"][os] = {
+ "url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.revision)}",
+ checksum.hash_type.to_s => checksum.hexdigest,
+ }
+ end
+ hsh["bottle"][spec_sym] = bottle_info
+ end
+
if rack.directory?
rack.subdirs.each do |keg_path|
keg = Keg.new keg_path