aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Contributions/examples/brew-bottle.rb
blob: ccfc0bd3cad5ba7579dccff351992fb0deefbf81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 + '-bottle.tar.gz'
  ohai "Bottling #{formula} #{version}..."
  HOMEBREW_CELLAR.cd do
    # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
    # or an uncompressed tarball (and more bandwidth friendly).
    safe_system 'tar', 'czf', "#{destination}/#{filename}", "#{formula}/#{version}"
  end
  ohai "Bottled #{filename}"
end