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/v20170910/closure-compiler-v20170910.jar" sha256 "24ac5a57c02cb2c3da2c04f0bed2f5adbba140747963025b79c2c01b1407f14c" 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