aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/htmlcompressor.rb
blob: f5691dd8e6d2b9b1fdc68ba871e7e4e8d7150fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'formula'

class Htmlcompressor < Formula
  url 'http://htmlcompressor.googlecode.com/files/htmlcompressor-1.5.2.jar'
  homepage 'http://code.google.com/p/htmlcompressor/'
  md5 '91575c89c83d0563dcf2aad409e4748f'

  def options
    [
      ['--yuicompressor', "Use YUICompressor for JS/CSS compression."],
    ]
  end

  depends_on "yuicompressor" if ARGV.include? '--yuicompressor'

  def install
    libexec.install "htmlcompressor-#{version}.jar"
    (bin+'htmlcompressor').write <<-EOS.undent
      #!/bin/sh
      java -jar "#{libexec}/htmlcompressor-#{version}.jar" $@
    EOS
    if ARGV.include? '--yuicompressor'
      yui = Formula.factory('yuicompressor')
      yui_jar = "yuicompressor-#{yui.version}.jar"
      ln_s "#{yui.libexec}/#{yui_jar}", "#{libexec}/#{yui_jar}"
    end
  end
end