homebrew-core/Formula/closure-compiler.rb

37 lines
1.1 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/v20220905/closure-compiler-v20220905.jar"
sha256 "fb57fa20b7a830efba6beb8bdf2f793c06dccabd8a5e1d323107f3b147028341"
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 do
sha256 cellar: :any_skip_relocation, all: "f7c49d8547d5af6c0caecb678be725e644911b6f147367889e15e0bc33bf141a"
end
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