47 lines
1.3 KiB
Ruby
47 lines
1.3 KiB
Ruby
class Asciidoctorj < Formula
|
|
desc "Java wrapper and bindings for Asciidoctor"
|
|
homepage "https://github.com/asciidoctor/asciidoctorj"
|
|
url "https://dl.bintray.com/asciidoctor/maven/org/asciidoctor/asciidoctorj/2.4.2/asciidoctorj-2.4.2-bin.zip"
|
|
sha256 "3b5cb8d3a31aa88b3152f4a6983d4f56b3f3fda913328ffa4e3d451aba5697ea"
|
|
license "Apache-2.0"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
rm_rf Dir["bin/*.bat"] # Remove Windows files.
|
|
libexec.install Dir["*"]
|
|
(bin/"asciidoctorj").write_env_script libexec/"bin/asciidoctorj", JAVA_HOME: Formula["openjdk"].opt_prefix
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.adoc").write <<~EOS
|
|
= AsciiDoc is Writing Zen
|
|
Random J. Author <rjauthor@example.com>
|
|
:icons: font
|
|
|
|
Hello, World!
|
|
|
|
== Syntax Highlighting
|
|
|
|
Python source.
|
|
|
|
[source, python]
|
|
----
|
|
import something
|
|
----
|
|
|
|
List
|
|
|
|
- one
|
|
- two
|
|
- three
|
|
EOS
|
|
system bin/"asciidoctorj", "-b", "html5", "-o", "test.html", "test.adoc"
|
|
assert_match "<h1>AsciiDoc is Writing Zen</h1>", File.read("test.html")
|
|
system bin/"asciidoctorj", "-r", "asciidoctor-pdf", "-b", "pdf", "-o", "test.pdf", "test.adoc"
|
|
assert_match "/Title (AsciiDoc is Writing Zen)", File.read("test.pdf", mode: "rb")
|
|
end
|
|
end
|