aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2011-07-29 11:41:51 +0100
committerMax Howell2011-07-29 11:59:27 +0100
commit98d16613a8b6e85d1a33fff1839e13f7bab2f103 (patch)
tree0597e4a636c3d02c72bcf795a9c247354db40326 /Library
parentb4d84b106fea246de5ae38b4a77f4ef980b3a936 (diff)
downloadhomebrew-98d16613a8b6e85d1a33fff1839e13f7bab2f103.tar.bz2
Commands should not have side-effects
Don't install when bottling. Homebrew should bottle whatever is installed. If nothing is installed, error out.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-bottle.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/Library/Contributions/examples/brew-bottle.rb b/Library/Contributions/examples/brew-bottle.rb
index 4d6083f27..05ee56d4c 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