From 1576e0a53769ef4c4395605b6b8903f6c3f8f612 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 29 Jul 2011 11:41:51 +0100 Subject: [PATCH] Commands should not have side-effects Don't install when bottling. Homebrew should bottle whatever is installed. If nothing is installed, error out. --- Library/Contributions/examples/brew-bottle.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Library/Contributions/examples/brew-bottle.rb b/Library/Contributions/examples/brew-bottle.rb index 4d6083f277..05ee56d4c7 100755 --- a/Library/Contributions/examples/brew-bottle.rb +++ b/Library/Contributions/examples/brew-bottle.rb @@ -1,18 +1,20 @@ # Builds binary brew package require 'cmd/install' -Homebrew.install_formulae ARGV.formulae - destination = HOMEBREW_PREFIX + "Bottles" -if not File.directory?(destination) - Dir.mkdir destination -end +Dir.mkdir destination unless File.directory? destination ARGV.each do|formula| # Get the latest version version = `brew list --versions #{formula}`.split.last + + if version.nil? + onoe "Formula not installed: #{formula}" + next + end + source = HOMEBREW_CELLAR + formula + version - filename = formula + '-' + version + '-bottle.tar.gz' + filename = "#{formula}-#{version}-bottle.tar.gz" ohai "Bottling #{formula} #{version}..." HOMEBREW_CELLAR.cd do # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2