aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/closure-compiler.rb
blob: a005ddb86a2b94c0757bed265858d8c46b66ab71 (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
29
30
31
32
33
34
35
36
37
38
class ClosureCompiler < Formula
  homepage "https://github.com/google/closure-compiler"
  url "https://github.com/google/closure-compiler/archive/maven-release-v20150126.tar.gz"
  sha256 "cedd1746f2e47bad781aaba9c80e5409906d09af309f05c03832dea05497e375"

  head "https://github.com/google/closure-compiler.git"

  bottle do
    cellar :any
    sha256 "89ffc8e227be05ab6386a6a2f3c60b806f0f98db89e307a35a930dec5f4ed45d" => :yosemite
    sha256 "55b6b55fe539b44963c023a0b0942a19bd33f99fc9b673580eca00660c45f505" => :mavericks
    sha256 "d7eb4c90796cfcad18f844781142c247639ce6be2452b7d1a129aa627bd3ab95" => :mountain_lion
  end

  depends_on :ant => :build
  depends_on :java => "1.7+"

  def install
    system "ant", "clean"
    system "ant"

    libexec.install Dir["*"]
    bin.write_jar_script libexec/"build/compiler.jar", "closure-compiler"
  end

  test do
    (testpath/"test.js").write <<-EOS.undent
      (function(){
        var t = true;
        return t;
      })();
    EOS
    system bin/"closure-compiler",
           "--js", testpath/"test.js",
           "--js_output_file", testpath/"out.js"
    assert_equal (testpath/"out.js").read.chomp, "(function(){return!0})();"
  end
end