Skip to content

Commit 5c8dfc3

Browse files
committed
metanorma 1.12.8 (new formula)
1 parent 5f7d594 commit 5c8dfc3

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

Formula/m/metanorma.rb

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
class Metanorma < Formula
2+
desc "Toolchain for publishing metanorma documentation"
3+
homepage "https://www.metanorma.com"
4+
5+
url "https://rubygems.org/downloads/metanorma-cli-1.12.8.gem"
6+
sha256 "b746637b00a051ca409ccf98fc82c12c443d27183c3d4bdd3535ad47eb015573"
7+
8+
license "0BSD"
9+
10+
depends_on "pkgconf" => :build
11+
depends_on "gflags"
12+
depends_on "graphviz"
13+
depends_on "openjdk"
14+
depends_on "plantuml"
15+
depends_on "readline"
16+
depends_on "[email protected]"
17+
depends_on "sqlite"
18+
depends_on "xml2rfc"
19+
20+
uses_from_macos "zlib"
21+
22+
on_linux do
23+
depends_on "libxslt"
24+
depends_on "zlib"
25+
end
26+
27+
def install
28+
ENV["GEM_HOME"] = libexec
29+
ENV["GEM_PATH"] = libexec
30+
31+
# Install sqlite3 with brew's libsqlite3
32+
system "gem", "install", "sqlite3", "-v", "1.7.3", "--no-document",
33+
"--platform=ruby",
34+
"--",
35+
"--enable-system-libraries",
36+
"--with-sqlite3-include=#{Formula["sqlite"].opt_include}",
37+
"--with-sqlite3-lib=#{Formula["sqlite"].opt_lib}"
38+
39+
# Install pngcheck with brew's zlib (libz.so.1)
40+
ENV.append "CFLAGS", "-I$(brew --prefix zlib)/include"
41+
ENV.append "LDFLAGS", "-L$(brew --prefix zlib)/lib -Wl,-rpath,$(brew --prefix zlib)/lib"
42+
ENV.append "PKG_CONFIG_PATH", "$(brew --prefix zlib)/lib/pkgconfig"
43+
system "gem", "install", "pngcheck", "--no-document", "--platform=ruby"
44+
45+
# Install metanorma
46+
system "gem", "install", cached_download, "--no-document"
47+
48+
bin.install Dir["#{libexec}/bin/metanorma"]
49+
bin.env_script_all_files(
50+
libexec/"bin",
51+
PATH: [libexec/"bin", "$PATH"].join(":"),
52+
GEM_HOME: ENV["GEM_HOME"],
53+
JAVA_HOME: Language::Java.java_home("1.8+"),
54+
)
55+
end
56+
57+
def caveats
58+
<<~EOS
59+
inkscape >= 1.0 is required to generate Word output using SVG images.
60+
Install it by running `brew cask install inkscape` or
61+
directly download from https://inkscape.org/release/inkscape-1.0/
62+
EOS
63+
end
64+
65+
test do
66+
test_doc = <<~ADOC
67+
= Document title
68+
Author
69+
:docfile: test.adoc
70+
:nodoc:
71+
:novalid:
72+
:no-isobib:
73+
ADOC
74+
75+
(testpath / "test-iso.adoc").write(test_doc)
76+
system bin / "metanorma", "--type", "iso", testpath / "test-iso.adoc",
77+
"--agree-to-terms"
78+
assert_path_exists testpath / "test-iso.xml"
79+
assert_path_exists testpath / "test-iso.html"
80+
81+
(testpath / "test-csa.adoc").write(test_doc)
82+
system bin / "metanorma", "--type", "csa", testpath / "test-csa.adoc",
83+
"--agree-to-terms"
84+
assert_path_exists testpath / "test-csa.pdf"
85+
assert_path_exists testpath / "test-csa.html"
86+
end
87+
end

0 commit comments

Comments
 (0)