Skip to content

Commit bb80ad9

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

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

Formula/m/metanorma.rb

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

0 commit comments

Comments
 (0)