Skip to content

Commit

Permalink
Add initial brew bottle implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Nov 24, 2010
1 parent a0c7c0a commit d688fa3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Library/Contributions/examples/brew-bottle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Builds binary brew package
brew_install

destination = HOMEBREW_PREFIX + "Bottles"
if not File.directory?(destination)
Dir.mkdir destination
end

ARGV.each do|formula|
# Get the latest version
version = `brew list --versions #{formula}`.split.last
source = HOMEBREW_CELLAR + formula + version
filename = formula + '-' + version + '.tar.gz'
ohai "Bottling #{formula} #{version}..."
HOMEBREW_CELLAR.cd do
# Use gzip, much faster than bzip2 and hardly any file size difference
# when compressing binaries.
safe_system "tar czf #{destination}/#{filename} #{formula}/#{version}"
end
ohai "Bottled #{filename}"
end

0 comments on commit d688fa3

Please sign in to comment.