homebrew-core/Formula/closure-compiler.rb
2016-04-26 14:37:08 -04:00

37 lines
1.2 KiB
Ruby

class ClosureCompiler < Formula
desc "JavaScript optimizing compiler"
homepage "https://github.com/google/closure-compiler"
url "https://github.com/google/closure-compiler/archive/maven-release-v20160315.tar.gz"
sha256 "6d7916540707dff74722503ac32ef1c6ac8e8553ddce782a0c4b688e819d0ca4"
head "https://github.com/google/closure-compiler.git"
bottle do
cellar :any_skip_relocation
sha256 "70bf10b5959bb354c9418ea4331f609cb7dd2358af66c308e249cacb53868d4f" => :el_capitan
sha256 "b8f3eeff7682828bb4c1c428aa91ead7f778334f1069856d433332bac4a83c0c" => :yosemite
sha256 "23e7ec7c81ba1e787137c0b2b94e02b6410f99dc7b460cf26a6111ae4e173f00" => :mavericks
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