homebrew-core/Formula/cfr-decompiler.rb
2015-08-08 21:44:02 -07:00

33 lines
860 B
Ruby

class CfrDecompiler < Formula
desc "Yet Another Java Decompiler."
homepage "http://www.benf.org/other/cfr/"
url "http://www.benf.org/other/cfr/cfr_0_102.jar"
sha256 "b8bf5b3071b7754fb0117f321b600f0d7f548cd6fe25319dd993d4d9845d4578"
depends_on :java => "1.6+"
def install
jar_version = version.to_s.tr(".", "_")
libexec.install "cfr_#{jar_version}.jar"
bin.write_jar_script libexec/"cfr_#{jar_version}.jar", "cfr-decompiler"
end
test do
fixture = <<-EOS.undent
import java.io.PrintStream;
class T {
T() {
}
public static void main(String[] arrstring) {
System.out.println("Hello brew!");
}
}
EOS
(testpath/"T.java").write fixture
system "javac", "T.java"
output = pipe_output("#{bin}/cfr-decompiler T.class")
assert_match fixture, output
end
end