homebrew-core/Formula/closure-compiler.rb
2018-01-05 05:21:44 -08:00

28 lines
846 B
Ruby

class ClosureCompiler < Formula
desc "JavaScript optimizing compiler"
homepage "https://github.com/google/closure-compiler"
url "https://search.maven.org/remotecontent?filepath=com/google/javascript/closure-compiler/v20180101/closure-compiler-v20180101.jar"
sha256 "f2534ea1bfe9694eb0ca1597bd70b269d43f3b7487d66e27659b564bd95936b4"
bottle :unneeded
depends_on :java => "1.7+"
def install
libexec.install Dir["*"]
bin.write_jar_script libexec.children.first, "closure-compiler"
end
test do
(testpath/"test.js").write <<~EOS
(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