aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-06-04 20:39:09 +0100
committerMike McQuaid2013-06-08 16:47:11 +0100
commiteb198549032721923bf087d55ea289c9dd8b1c1a (patch)
tree27a91ca14d56e177783d7bebfc0bbf1f7e4b0c6e /Library
parentd59167982f21ef7694fab709633000e0be0fd147 (diff)
downloadhomebrew-eb198549032721923bf087d55ea289c9dd8b1c1a.tar.bz2
brew-bottle: split output and use a bottle object.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/bottle.rb41
1 files changed, 24 insertions, 17 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 8019f6c0e..4f817b82e 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -8,6 +8,24 @@ module Homebrew extend self
quiet_system 'fgrep', '--recursive', '--quiet', '--max-count=1', string, keg
end
+ def bottle_output bottle
+ puts "bottle do"
+ prefix = bottle.prefix.to_s
+ puts " prefix '#{prefix}'" if prefix != '/usr/local'
+ cellar = bottle.cellar.to_s
+ cellar = ":#{bottle.cellar}" if bottle.cellar.is_a? Symbol
+ puts " cellar '#{cellar}'" if bottle.cellar.to_s != '/usr/local/Cellar'
+ puts " revision #{bottle.revision}" if bottle.revision > 0
+ Checksum::TYPES.each do |checksum_type|
+ checksum_cat = bottle.send checksum_type
+ next unless checksum_cat
+ checksum_cat.each do |cat, checksum|
+ puts " #{checksum_type} '#{checksum}' => :#{cat}"
+ end
+ end
+ puts "end"
+ end
+
def bottle_formula f
unless f.installed?
return ofail "Formula not installed: #{f.name}"
@@ -49,25 +67,14 @@ module Homebrew extend self
keg.relocate_install_names tmp_prefix, prefix, tmp_cellar, cellar
end
- prefix = cellar = nil
- if relocatable
- cellar = ':any'
- else
- if HOMEBREW_PREFIX.to_s != '/usr/local'
- prefix = "'#{HOMEBREW_PREFIX}"
- end
- if HOMEBREW_CELLAR.to_s != '/usr/local/Cellar'
- cellar = "'#{HOMEBREW_CELLAR}'"
- end
- end
+ bottle = Bottle.new
+ bottle.prefix HOMEBREW_PREFIX
+ bottle.cellar relocatable ? :any : HOMEBREW_CELLAR
+ bottle.revision bottle_revision
+ bottle.sha1 sha1 => bottle_tag
puts "./#{filename}"
- puts "bottle do"
- puts " prefix #{prefix}" if prefix
- puts " cellar #{cellar}" if cellar
- puts " revision #{bottle_revision}" if bottle_revision > 0
- puts " sha1 '#{sha1}' => :#{bottle_tag}"
- puts "end"
+ bottle_output bottle
end
end