Skip to content

Commit d5c6b47

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

File tree

1 file changed

+380
-0
lines changed

1 file changed

+380
-0
lines changed

Formula/m/metanorma.rb

Lines changed: 380 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,380 @@
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+
resource "vendor-gems" do
24+
url "https://github.com/metanorma/metanorma-cli/releases/download/v1.12.8/vendored-gems.tar.gz"
25+
sha256 "697b48ee98f9baceac914033f8ed48551a64ea96ce1ca7ee6fd46b618745a8bd"
26+
end
27+
28+
def install
29+
ENV["GEM_HOME"] = libexec
30+
ENV["GEM_PATH"] = libexec
31+
32+
# Unpack the vendored gems (includes Gemfile, Gemfile.lock, vendor/cache/*.gem)
33+
resource("vendor-gems").stage do
34+
cp_r ".", buildpath
35+
end
36+
37+
gems = [
38+
"mini_portile2-2.8.9",
39+
"link_header-0.0.8",
40+
"bigdecimal-3.2.2",
41+
"bcp47_spec-0.2.1",
42+
"parslet-2.0.0",
43+
"connection_pool-2.4.1",
44+
"io-console-0.8.0",
45+
"rdf-3.3.2",
46+
"matrix-0.4.2",
47+
"pubid-core-1.12.11",
48+
"net-http-persistent-4.0.6",
49+
"reline-0.6.1",
50+
"rexml-3.4.1",
51+
"unicode-types-1.10.0",
52+
"sxp-2.0.0",
53+
"scanf-1.0.0",
54+
"htmlentities-4.3.4",
55+
"base64-0.3.0",
56+
"rack-3.1.16",
57+
"multi_json-1.15.0",
58+
"json-canonicalization-1.0.0",
59+
"tilt-2.6.0",
60+
"thor-1.3.2",
61+
"temple-0.10.3",
62+
"racc-1.8.1",
63+
"pubid-iso-0.7.8",
64+
"pubid-iec-0.3.2",
65+
"stringio-3.1.7",
66+
"date-3.4.1",
67+
"sparql-client-3.3.0",
68+
"readline-0.0.4",
69+
"rdf-xsd-3.3.0",
70+
"rdf-aggregate-repo-3.3.0",
71+
"logger-1.6.6",
72+
"ebnf-2.6.0",
73+
"builder-3.3.0",
74+
"json-ld-3.3.2",
75+
"public_suffix-6.0.2",
76+
"rdf-vocab-3.3.2",
77+
"haml-6.3.0",
78+
"concurrent-ruby-1.3.5",
79+
"latex-decode-0.4.0",
80+
"rubyzip-2.3.2",
81+
"nokogiri-1.18.8",
82+
"lightly-0.4.0",
83+
"pubid-cen-0.2.4",
84+
"moxml-0.1.4",
85+
"mime-types-data-3.2025.0603",
86+
"domain_name-0.6.20240107",
87+
"ruby2_keywords-0.0.5",
88+
"faraday-net_http-3.0.2",
89+
"psych-5.2.6",
90+
"sparql-3.3.2",
91+
"json-ld-preloaded-3.3.1",
92+
"rdf-turtle-3.3.1",
93+
"addressable-2.8.7",
94+
"rdf-rdfa-3.3.0",
95+
"hamster-3.0.0",
96+
"relaton-logger-0.2.2",
97+
"iso639-1.3.3",
98+
"bibtex-ruby-6.1.0",
99+
"pubid-nist-0.4.2",
100+
"pubid-jis-0.3.2",
101+
"pubid-itu-0.1.3",
102+
"pubid-ieee-0.2.2",
103+
"pubid-etsi-0.1.0",
104+
"pubid-ccsds-0.1.6",
105+
"pubid-bsi-0.3.4",
106+
"lutaml-model-0.7.3",
107+
"webrobots-0.1.2",
108+
"webrick-1.9.1",
109+
"rubyntlm-0.6.5",
110+
"nkf-0.2.0",
111+
"net-http-digest_auth-1.4.1",
112+
"mime-types-3.7.0",
113+
"http-cookie-1.0.8",
114+
"fiber-storage-1.0.1",
115+
"uri-1.0.3",
116+
"tzinfo-2.0.6",
117+
"securerandom-0.4.1",
118+
"minitest-5.25.5",
119+
"i18n-1.14.7",
120+
"drb-2.2.3",
121+
"benchmark-0.4.1",
122+
"faraday-2.7.12",
123+
"timeout-0.4.3",
124+
"cldr-plurals-runtime-rb-1.1.0",
125+
"camertron-eprun-1.1.1",
126+
"uuidtools-3.0.0",
127+
"sterile-1.0.26",
128+
"csv-3.3.5",
129+
"asciidoctor-2.0.23",
130+
"strscan-3.1.5",
131+
"yaml-ld-0.0.3",
132+
"shex-0.8.1",
133+
"shacl-0.4.2",
134+
"rdf-trix-3.3.0",
135+
"rdf-trig-3.3.0",
136+
"rdf-tabular-3.3.0",
137+
"rdf-reasoner-0.9.0",
138+
"rdf-rdfxml-3.3.0",
139+
"rdf-ordered-repo-3.3.0",
140+
"rdf-normalize-0.7.0",
141+
"rdf-n3-3.3.1",
142+
"rdf-microdata-3.3.0",
143+
"rdf-json-3.3.0",
144+
"rdf-isomorphic-3.3.0",
145+
"rdf-hamster-repo-3.3.0",
146+
"ld-patch-3.3.1",
147+
"relaton-bib-1.20.7",
148+
"isoics-0.1.13",
149+
"relaton-index-0.2.16",
150+
"pubid-0.1.2",
151+
"loc_mods-0.2.7",
152+
"ieee-idams-0.2.14",
153+
"mechanize-2.14.0",
154+
"graphql-2.5.9",
155+
"activesupport-8.0.2",
156+
"faraday-net_http_persistent-2.3.0",
157+
"time-0.4.1",
158+
"net-protocol-0.2.2",
159+
"twitter_cldr-6.14.0",
160+
"metanorma-utils-1.11.3",
161+
"liquid-5.8.6",
162+
"ffi-1.17.2",
163+
"unitsdb-1.0.0",
164+
"mml-2.0.3",
165+
"rake-13.3.0",
166+
"linkeddata-3.3.3",
167+
"relaton-iso-bib-1.20.0",
168+
"gb-agencies-0.0.7",
169+
"cnccs-0.1.6",
170+
"relaton-nist-1.20.0",
171+
"relaton-ietf-1.20.0",
172+
"relaton-ieee-1.20.1",
173+
"relaton-bipm-1.20.4",
174+
"graphql-client-0.26.0",
175+
"algolia-2.3.4",
176+
"net-ftp-0.1.4",
177+
"unicode-display_width-2.6.0",
178+
"tzinfo-data-1.2025.2",
179+
"isodoc-i18n-1.3.2",
180+
"marcel-1.0.4",
181+
"image_size-3.4.0",
182+
"emf2svg-1.4.3",
183+
"unitsml-0.4.7",
184+
"ox-2.14.23",
185+
"css_parser-1.21.1",
186+
"ffi-compiler2-2.3.0",
187+
"ffi-libarchive-1.1.14",
188+
"hollaback-0.1.1",
189+
"relaton-xsf-1.20.0",
190+
"relaton-w3c-1.20.0",
191+
"relaton-un-1.20.1",
192+
"relaton-plateau-1.20.0",
193+
"relaton-omg-1.20.0",
194+
"relaton-ogc-1.20.1",
195+
"relaton-oasis-1.20.0",
196+
"relaton-jis-1.20.0",
197+
"relaton-itu-1.20.2",
198+
"relaton-iso-1.20.0",
199+
"relaton-isbn-1.20.1",
200+
"relaton-iho-1.20.1",
201+
"relaton-iec-1.20.0",
202+
"relaton-iana-1.20.0",
203+
"relaton-gb-1.20.1",
204+
"relaton-etsi-1.20.0",
205+
"relaton-ecma-1.20.0",
206+
"relaton-doi-1.20.0",
207+
"relaton-cie-1.20.0",
208+
"relaton-cen-1.20.1",
209+
"relaton-ccsds-1.20.2",
210+
"relaton-calconnect-1.20.0",
211+
"relaton-bsi-1.20.0",
212+
"relaton-3gpp-1.20.0",
213+
"zeitwerk-2.7.3",
214+
"terminal-table-3.0.2",
215+
"ruby-progressbar-1.13.0",
216+
"benchmark-ips-2.14.0",
217+
"relaton-render-0.9.1",
218+
"vectory-0.8.0",
219+
"thread_safe-0.3.6",
220+
"plurimath-0.9.6",
221+
"plane1converter-0.0.1",
222+
"sys-proctable-1.3.0",
223+
"reverse_markdown-2.1.1",
224+
"premailer-1.27.0",
225+
"nokogiri-styles-0.1.2",
226+
"descriptive_statistics-2.5.1",
227+
"cliver-0.3.2",
228+
"yaml-0.4.0",
229+
"rchardet-1.9.0",
230+
"seven-zip-1.4.2",
231+
"ruby-ole-1.2.13.1",
232+
"libmspack-0.11.0",
233+
"ffi-libarchive-binary-0.4.1",
234+
"arr-pm-0.0.12",
235+
"thor-hollaback-0.2.1",
236+
"relaton-1.20.1",
237+
"xmi-0.3.18",
238+
"ruby-graphviz-1.2.5",
239+
"lutaml-xsd-1.0.4",
240+
"lutaml-path-0.1.0",
241+
"hashie-4.1.0",
242+
"expressir-2.1.22",
243+
"rouge-4.5.2",
244+
"roman-numerals-0.3.0",
245+
"mn2pdf-2.25",
246+
"mn-requirements-0.5.2",
247+
"html2doc-1.9.2",
248+
"word-to-markdown-1.1.9",
249+
"oscal-0.1.1",
250+
"ttfunk-1.8.0",
251+
"sys-uname-1.3.1",
252+
"socksify-1.7.1",
253+
"plist-3.7.2",
254+
"json-2.12.2",
255+
"git-1.19.1",
256+
"fuzzy_match-2.1.0",
257+
"extract_ttc-0.3.6",
258+
"excavate-0.3.7",
259+
"down-5.4.2",
260+
"optout-0.0.2",
261+
"relaton-cli-1.20.2",
262+
"ogc-gml-1.0.4",
263+
"lutaml-0.9.33",
264+
"isodoc-3.1.10",
265+
"coradoc-1.1.7",
266+
"glossarist-2.3.6",
267+
"fontist-1.21.2",
268+
"sqlite3-1.7.3",
269+
"sequel-5.93.0",
270+
"creek-2.6.3",
271+
"ruby-jing-0.0.3",
272+
"relaton-iev-1.2.1",
273+
"pngcheck-0.3.1",
274+
"metanorma-plugin-lutaml-0.7.32",
275+
"metanorma-plugin-glossarist-0.2.4",
276+
"metanorma-2.1.10",
277+
"iev-0.3.6",
278+
"crass-1.0.6",
279+
"tokenizer-0.3.0",
280+
"mnconvert-1.68.0",
281+
"metanorma-standoc-3.0.9",
282+
"metanorma-iso-3.0.8",
283+
"japanese_calendar-0.4.2",
284+
"metanorma-jis-0.5.7",
285+
"iso-639-0.3.8",
286+
"metanorma-generic-3.0.3",
287+
"metanorma-ietf-data-0.2.0",
288+
"metanorma-plateau-1.0.7",
289+
"metanorma-ogc-2.7.7",
290+
"metanorma-itu-2.6.7",
291+
"metanorma-iho-1.1.7",
292+
"metanorma-ietf-3.5.6",
293+
"metanorma-ieee-1.4.7",
294+
"metanorma-iec-2.6.7",
295+
"metanorma-csa-2.6.7",
296+
"metanorma-cc-2.6.7",
297+
"metanorma-bipm-2.6.8",
298+
]
299+
300+
arch = if OS.mac?
301+
Hardware::CPU.arm? ? "arm64-darwin" : "x86_64-darwin"
302+
else
303+
Hardware::CPU.arm? ? "aarch64-linux" : "x86_64-linux"
304+
end
305+
306+
for gem in gems
307+
# Prefer arch-specific gem
308+
files = Dir["vendor/cache/#{gem}-#{arch}.gem"]
309+
files = Dir["vendor/cache/#{gem}.gem"] if files.empty? || gem.start_with?("pngcheck-")
310+
gem_file = files.first
311+
312+
args = [
313+
"gem", "install", "--local", gem_file,
314+
"--install-dir", libexec, "--no-document",
315+
"--ignore-dependencies"
316+
]
317+
318+
if gem.start_with?("sqlite3-")
319+
# Link sqlite3 with brew's libsqlite3
320+
args += [
321+
"--",
322+
"--enable-system-libraries",
323+
"--with-sqlite3-include=#{Formula["sqlite"].opt_include}",
324+
"--with-sqlite3-lib=#{Formula["sqlite"].opt_lib}",
325+
]
326+
elsif gem.start_with?("pngcheck-") && OS.linux?
327+
# Link pngcheck with brew's zlib (libz.so.1)
328+
ENV.append "CFLAGS", "-I$(brew --prefix zlib)/include"
329+
ENV.append "LDFLAGS", "-L$(brew --prefix zlib)/lib -Wl,-rpath,$(brew --prefix zlib)/lib"
330+
ENV.append "PKG_CONFIG_PATH", "$(brew --prefix zlib)/lib/pkgconfig"
331+
args += ["--platform=ruby"]
332+
end
333+
334+
system(*args)
335+
end
336+
337+
# Install metanorma
338+
system "gem", "install", "--local", cached_download, "--install-dir", libexec,
339+
"--no-document", "--ignore-dependencies"
340+
341+
bin.install Dir["#{libexec}/bin/metanorma"]
342+
bin.env_script_all_files(
343+
libexec/"bin",
344+
PATH: [libexec/"bin", "$PATH"].join(":"),
345+
GEM_HOME: ENV["GEM_HOME"],
346+
JAVA_HOME: Language::Java.overridable_java_home_env[:JAVA_HOME],
347+
)
348+
end
349+
350+
def caveats
351+
<<~EOS
352+
inkscape >= 1.0 is required to generate Word output using SVG images.
353+
Install it by running `brew cask install inkscape` or
354+
directly download from https://inkscape.org/release/inkscape-1.0/
355+
EOS
356+
end
357+
358+
test do
359+
test_doc = <<~ADOC
360+
= Document title
361+
Author
362+
:docfile: test.adoc
363+
:nodoc:
364+
:novalid:
365+
:no-isobib:
366+
ADOC
367+
368+
(testpath / "test-iso.adoc").write(test_doc)
369+
system bin / "metanorma", "--type", "iso", testpath / "test-iso.adoc",
370+
"--agree-to-terms"
371+
assert_path_exists testpath / "test-iso.xml"
372+
assert_path_exists testpath / "test-iso.html"
373+
374+
(testpath / "test-csa.adoc").write(test_doc)
375+
system bin / "metanorma", "--type", "csa", testpath / "test-csa.adoc",
376+
"--agree-to-terms"
377+
assert_path_exists testpath / "test-csa.pdf"
378+
assert_path_exists testpath / "test-csa.html"
379+
end
380+
end

0 commit comments

Comments
 (0)