homebrew-core/Formula/closure-compiler.rb
2017-04-26 01:16:16 -07:00

28 lines
853 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/v20170423/closure-compiler-v20170423.jar"
sha256 "3b61782f4a88e85fcf98a61b05c764a48ed8eb1177bebf713c22e09ada4c96e0"
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.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