35 lines
1.0 KiB
Ruby
35 lines
1.0 KiB
Ruby
class ClosureCompiler < Formula
|
|
desc "JavaScript optimizing compiler"
|
|
homepage "https://developers.google.com/closure/compiler"
|
|
url "https://search.maven.org/remotecontent?filepath=com/google/javascript/closure-compiler/v20210202/closure-compiler-v20210202.jar"
|
|
sha256 "1f1a8d2348857d70f5092618db3f2141d53621b10ee665c82b3a7925edeef14b"
|
|
license "Apache-2.0"
|
|
|
|
livecheck do
|
|
url "https://search.maven.org/remotecontent?filepath=com/google/javascript/closure-compiler/"
|
|
regex(/href=.*?v?(\d{8})/i)
|
|
end
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
libexec.install Dir["*"]
|
|
bin.write_jar_script libexec/"closure-compiler-v#{version}.jar", "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
|