Skip to content

Commit 4f26209

Browse files
alex-scSMillerDev
andcommitted
metanorma 1.12.8 (new formula)
Co-Authored-By: Sean Molenaar <[email protected]>
1 parent 5f7d594 commit 4f26209

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

Formula/m/metanorma.rb

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

0 commit comments

Comments
 (0)