metanorma-cli 1.3.3 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/dependent_repos.env +3 -0
- data/.github/workflows/macos.yml +38 -0
- data/.github/workflows/ubuntu.yml +72 -0
- data/.github/workflows/windows.yml +40 -0
- data/.gitignore +21 -0
- data/.hound.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +515 -0
- data/docs/installation.adoc +61 -0
- data/docs/navigation.adoc +7 -0
- data/docs/usage.adoc +74 -0
- data/lib/metanorma/cli/command.rb +25 -1
- data/lib/metanorma/cli/setup.rb +9 -30
- data/lib/metanorma/cli/version.rb +1 -1
- data/metanorma-cli.gemspec +24 -19
- data/templates/base/.github/workflows/docker.yml +74 -0
- data/templates/base/.github/workflows/macos.yml +50 -0
- data/templates/base/.github/workflows/ubuntu.yml +55 -0
- data/templates/base/.github/workflows/windows.yml +42 -0
- data/templates/base/.gitlab-ci.yml +34 -4
- data/templates/base/Makefile +111 -59
- data/templates/base/Makefile.win +136 -36
- data/templates/base/metanorma.yml +1 -1
- metadata +49 -83
- data/05-020r26.rxl +0 -75
- data/05-020r26.xml.zip +0 -0
- data/Gemfile.lock +0 -336
- data/a +0 -3
- data/a.json +0 -33
- data/a.rb +0 -13
- data/a.rxl +0 -45
- data/b +0 -85
- data/csd-tofix 2.zip +0 -0
- data/csd-tofix.zip +0 -0
- data/exe/metanorma.old +0 -178
- data/extract/sourcecode/sourcecode-0000.txt +0 -5
- data/files.zip +0 -0
- data/relaton/cache/version +0 -1
- data/rice.rxl +0 -51
- data/sourcecode/0 +0 -5
- data/templates/base/.travis.yml +0 -30
- data/templates/base/appveyor.yml +0 -29
- data/test.rxl +0 -52
- data/tmp/my-custom-csd/Gemfile +0 -4
- data/tmp/my-custom-csd/Makefile +0 -144
- data/tmp/my-custom-csd/Makefile.win +0 -116
- data/tmp/my-custom-csd/appveyor.yml +0 -29
- data/tmp/my-custom-csd/metanorma.yml +0 -4
- data/tmp/my-document/Gemfile +0 -4
- data/tmp/my-document/Makefile +0 -144
- data/tmp/my-document/Makefile.win +0 -116
- data/tmp/my-document/appveyor.yml +0 -29
- data/tmp/my-document/metanorma.yml +0 -4
- data/tmp/my-local-document/Gemfile +0 -4
- data/tmp/my-local-document/Makefile +0 -144
- data/tmp/my-local-document/Makefile.win +0 -116
- data/tmp/my-local-document/appveyor.yml +0 -29
- data/tmp/my-local-document/metanorma.yml +0 -4
data/csd-tofix 2.zip
DELETED
Binary file
|
data/csd-tofix.zip
DELETED
Binary file
|
data/exe/metanorma.old
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "optparse"
|
4
|
-
require "metanorma"
|
5
|
-
require "fileutils"
|
6
|
-
require "nokogiri"
|
7
|
-
|
8
|
-
registry = Metanorma::Registry.instance
|
9
|
-
|
10
|
-
supported_gem_paths = [
|
11
|
-
"asciidoctor-rfc",
|
12
|
-
"metanorma-iso",
|
13
|
-
"metanorma-gb",
|
14
|
-
"metanorma-csd",
|
15
|
-
"metanorma-csand",
|
16
|
-
"metanorma-m3d",
|
17
|
-
"metanorma-rsd",
|
18
|
-
"metanorma-acme",
|
19
|
-
"metanorma-standoc",
|
20
|
-
]
|
21
|
-
|
22
|
-
puts "[metanorma] detecting backends:"
|
23
|
-
supported_gem_paths.each do |backend|
|
24
|
-
begin
|
25
|
-
puts backend
|
26
|
-
require backend
|
27
|
-
rescue LoadError
|
28
|
-
puts "[metanorma] backend #{backend} not present"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
puts
|
32
|
-
|
33
|
-
options = {
|
34
|
-
format: :asciidoc
|
35
|
-
}
|
36
|
-
opt_parser = OptionParser.new do |opts|
|
37
|
-
opts.banner += " <file>"
|
38
|
-
opts.on(
|
39
|
-
'-t',
|
40
|
-
'--type TYPE',
|
41
|
-
"Type of standard to generate: #{registry.supported_backends.join(", ")}"
|
42
|
-
) { |v| options[:type] = v.to_sym }
|
43
|
-
|
44
|
-
opts.on(
|
45
|
-
'-x',
|
46
|
-
'--extensions EXT1,EXT2,... | all',
|
47
|
-
Array,
|
48
|
-
"Type of extension to generate per type: #{registry.output_formats}\n"
|
49
|
-
) { |v| options[:extension_keys] = v.map(&:to_sym) }
|
50
|
-
|
51
|
-
opts.on(
|
52
|
-
'-f',
|
53
|
-
'--format FORMAT',
|
54
|
-
'Format of source file: asciidoc (current default, only format supported)'
|
55
|
-
) { |v| options[:format] = v.to_sym }
|
56
|
-
|
57
|
-
opts.on(
|
58
|
-
'-r',
|
59
|
-
'--require LIBRARY',
|
60
|
-
'Require LIBRARY prior to execution'
|
61
|
-
) { |v|
|
62
|
-
options[:require] ||= []
|
63
|
-
options[:require] << v
|
64
|
-
}
|
65
|
-
|
66
|
-
opts.on(
|
67
|
-
'-v',
|
68
|
-
'--version',
|
69
|
-
"Print version of code (accompanied with -t)",
|
70
|
-
) { options[:version] = true }
|
71
|
-
|
72
|
-
opts.on(
|
73
|
-
'-w',
|
74
|
-
'--wrapper',
|
75
|
-
'Create wrapper folder for HTML output'
|
76
|
-
) { options[:wrapper] = true }
|
77
|
-
|
78
|
-
opts.on(
|
79
|
-
'-d',
|
80
|
-
'--data-uri-image',
|
81
|
-
'Encode HTML output images as data URIs'
|
82
|
-
) { options[:datauriimage] = true }
|
83
|
-
|
84
|
-
opts.on(
|
85
|
-
'-R',
|
86
|
-
'--relaton FILENAME',
|
87
|
-
'Export Relaton XML for document to nominated filename'
|
88
|
-
) { |v| options[:relaton] = v }
|
89
|
-
|
90
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
91
|
-
puts opts
|
92
|
-
exit
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
opt_parser.parse!(ARGV)
|
98
|
-
|
99
|
-
if options[:require]
|
100
|
-
options[:require].each do |r|
|
101
|
-
require r
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
if options[:version]
|
106
|
-
case options[:format]
|
107
|
-
when :asciidoc
|
108
|
-
processor = registry.find_processor(options[:type].to_sym)
|
109
|
-
puts processor.version
|
110
|
-
exit
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
options[:filename] = ARGV.pop
|
115
|
-
|
116
|
-
unless options[:type]
|
117
|
-
puts "[metanorma] Error: Please specify a standard type."
|
118
|
-
puts opt_parser.help
|
119
|
-
exit 0
|
120
|
-
end
|
121
|
-
|
122
|
-
unless registry.supported_backends.include? options[:type]
|
123
|
-
puts "[metanorma] Error: #{options[:type]} is not a supported standard type."
|
124
|
-
exit 0
|
125
|
-
end
|
126
|
-
|
127
|
-
unless options[:format] == :asciidoc
|
128
|
-
puts "[metanorma] Error: Only source file format currently supported is 'asciidoc'."
|
129
|
-
exit 0
|
130
|
-
end
|
131
|
-
|
132
|
-
unless options[:filename]
|
133
|
-
puts "[metanorma] Error: Need to specify a file to process."
|
134
|
-
exit 0
|
135
|
-
end
|
136
|
-
|
137
|
-
options[:extension_keys] = nil if options[:extension_keys] == [:all]
|
138
|
-
|
139
|
-
case options[:format]
|
140
|
-
when :asciidoc
|
141
|
-
processor = registry.find_processor(options[:type].to_sym)
|
142
|
-
options[:extension_keys] ||= processor.output_formats.inject([]) do |memo, (k, _)|
|
143
|
-
memo << k; memo
|
144
|
-
end
|
145
|
-
extensions = options[:extension_keys].inject([]) do |memo, e|
|
146
|
-
if processor.output_formats[e]
|
147
|
-
memo << e
|
148
|
-
else
|
149
|
-
warn "[metanorma] Error: #{e} format is not supported for this standard"
|
150
|
-
end
|
151
|
-
memo
|
152
|
-
end
|
153
|
-
exit 0 if extensions.empty?
|
154
|
-
|
155
|
-
file = File.read(options[:filename], encoding: "utf-8")
|
156
|
-
isodoc = processor.input_to_isodoc(file)
|
157
|
-
if options[:relaton]
|
158
|
-
xml = Nokogiri::XML(isodoc)
|
159
|
-
bibdata = xml.at("//xmlns:bibdata")
|
160
|
-
#docid = bibdata&.at("./xmlns:docidentifier")&.text || options[:filename]
|
161
|
-
#outname = docid.sub(/^\s+/, "").sub(/\s+$/, "").gsub(/\s+/, "-") + ".xml"
|
162
|
-
File.open(options[:relaton], "w:UTF-8") { |f| f.write bibdata.to_xml }
|
163
|
-
end
|
164
|
-
isodoc_options = processor.extract_options(file)
|
165
|
-
isodoc_options[:datauriimage] = true if options[:datauriimage]
|
166
|
-
extensions.each do |ext|
|
167
|
-
file_extension = processor.output_formats[ext]
|
168
|
-
outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
|
169
|
-
processor.output(isodoc, outfilename, ext, isodoc_options)
|
170
|
-
if options[:wrapper] and /html$/.match file_extension
|
171
|
-
outfilename = outfilename.sub(/\.html$/, "")
|
172
|
-
FileUtils.mkdir_p outfilename
|
173
|
-
FileUtils.mv "#{outfilename}.html", outfilename
|
174
|
-
FileUtils.mv "#{outfilename}_images", outfilename
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
data/files.zip
DELETED
Binary file
|
data/relaton/cache/version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.5.0
|
data/rice.rxl
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
<bibdata type="standard">
|
2
|
-
<title language="en" format="text/plain">Rice model</title>
|
3
|
-
<title language="intro-en" format="text/plain">Cereals and pulses</title>
|
4
|
-
<title language="main-en" format="text/plain">Specifications and test methods</title>
|
5
|
-
<title language="part-en" format="text/plain">Rice</title>
|
6
|
-
<title language="intro-fr" format="text/plain">Céréales et légumineuses</title>
|
7
|
-
<title language="main-fr" format="text/plain">Spécification et méthodes d'essai</title>
|
8
|
-
<title language="part-fr" format="text/plain">Riz</title>
|
9
|
-
<docidentifier type="m3d">17301:2016</docidentifier>
|
10
|
-
<docnumber>17301</docnumber>
|
11
|
-
<contributor>
|
12
|
-
<role type="author"/>
|
13
|
-
<organization>
|
14
|
-
<name>Messaging Malware and Mobile Anti-Abuse Working Group</name>
|
15
|
-
<abbreviation>M3AAWG</abbreviation>
|
16
|
-
</organization>
|
17
|
-
</contributor>
|
18
|
-
<contributor>
|
19
|
-
<role type="publisher"/>
|
20
|
-
<organization>
|
21
|
-
<name>Messaging Malware and Mobile Anti-Abuse Working Group</name>
|
22
|
-
<abbreviation>M3AAWG</abbreviation>
|
23
|
-
</organization>
|
24
|
-
</contributor>
|
25
|
-
<edition>2</edition>
|
26
|
-
<version>
|
27
|
-
<revision-date>2016-05-01</revision-date>
|
28
|
-
|
29
|
-
</version>
|
30
|
-
<language>en</language>
|
31
|
-
<script>Latn</script>
|
32
|
-
<status>
|
33
|
-
<stage>30</stage>
|
34
|
-
<substage>92</substage>
|
35
|
-
</status>
|
36
|
-
<copyright>
|
37
|
-
<from>2016</from>
|
38
|
-
<owner>
|
39
|
-
<organization>
|
40
|
-
<name>Messaging Malware and Mobile Anti-Abuse Working Group</name>
|
41
|
-
<abbreviation>M3AAWG</abbreviation>
|
42
|
-
</organization>
|
43
|
-
</owner>
|
44
|
-
</copyright>
|
45
|
-
<ext>
|
46
|
-
<doctype>report</doctype>
|
47
|
-
<editorialgroup>
|
48
|
-
<committee>Food products</committee>
|
49
|
-
</editorialgroup>
|
50
|
-
</ext>
|
51
|
-
</bibdata>
|
data/sourcecode/0
DELETED
data/templates/base/.travis.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: xenial
|
3
|
-
env:
|
4
|
-
global:
|
5
|
-
- COMMIT_AUTHOR_EMAIL="$(yq r metanorma.yml metanorma.deploy.email)"
|
6
|
-
addons:
|
7
|
-
apt:
|
8
|
-
update: true
|
9
|
-
snaps:
|
10
|
-
- jq
|
11
|
-
- yq
|
12
|
-
- name: node
|
13
|
-
confinement: classic # or devmode
|
14
|
-
channel: 10/stable
|
15
|
-
rvm:
|
16
|
-
- 2.6
|
17
|
-
cache: bundler
|
18
|
-
before_install:
|
19
|
-
- gem update --system
|
20
|
-
- gem install bundler
|
21
|
-
- npm install -g puppeteer
|
22
|
-
- sudo bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-linux-setup/master/ubuntu.sh | bash"
|
23
|
-
script:
|
24
|
-
- make clean all publish
|
25
|
-
deploy:
|
26
|
-
skip_cleanup: true
|
27
|
-
provider: script
|
28
|
-
script: bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/deploy-to-gh-pages.sh | bash"
|
29
|
-
on:
|
30
|
-
branch: master
|
data/templates/base/appveyor.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
version: '{build}'
|
2
|
-
|
3
|
-
environment:
|
4
|
-
matrix:
|
5
|
-
- RUBY_VERSION: 25
|
6
|
-
- RUBY_VERSION: 24
|
7
|
-
- RUBY_VERSION: _trunk
|
8
|
-
|
9
|
-
matrix:
|
10
|
-
allow_failures:
|
11
|
-
- RUBY_VERSION: _trunk
|
12
|
-
|
13
|
-
install:
|
14
|
-
- ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
|
15
|
-
- refreshenv
|
16
|
-
|
17
|
-
build_script:
|
18
|
-
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
19
|
-
- bundle update
|
20
|
-
- bundle install
|
21
|
-
|
22
|
-
before_test:
|
23
|
-
- ruby -v
|
24
|
-
- gem -v
|
25
|
-
- bundle -v
|
26
|
-
|
27
|
-
test_script:
|
28
|
-
- plantuml -testdot
|
29
|
-
- make -f Makefile.win clean all publish SHELL=cmd
|
data/test.rxl
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
<bibdata type="standard">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<docidentifier type="iso">ISO 123</docidentifier>
|
7
|
-
<docidentifier type="iso-with-lang">ISO 123(E)</docidentifier>
|
8
|
-
<docidentifier type="iso-reference">ISO 123(E)</docidentifier>
|
9
|
-
<docnumber>123</docnumber>
|
10
|
-
<contributor>
|
11
|
-
<role type="author"/>
|
12
|
-
<organization>
|
13
|
-
<name>International Organization for Standardization</name>
|
14
|
-
<abbreviation>ISO</abbreviation>
|
15
|
-
</organization>
|
16
|
-
</contributor>
|
17
|
-
<contributor>
|
18
|
-
<role type="publisher"/>
|
19
|
-
<organization>
|
20
|
-
<name>International Organization for Standardization</name>
|
21
|
-
<abbreviation>ISO</abbreviation>
|
22
|
-
</organization>
|
23
|
-
</contributor>
|
24
|
-
|
25
|
-
<language>en</language>
|
26
|
-
<script>script.html</script>
|
27
|
-
<status>
|
28
|
-
<stage abbreviation="IS">60</stage>
|
29
|
-
<substage>60</substage>
|
30
|
-
</status>
|
31
|
-
<copyright>
|
32
|
-
<from>2020</from>
|
33
|
-
<owner>
|
34
|
-
<organization>
|
35
|
-
<name>International Organization for Standardization</name>
|
36
|
-
<abbreviation>ISO</abbreviation>
|
37
|
-
</organization>
|
38
|
-
</owner>
|
39
|
-
</copyright>
|
40
|
-
<ext>
|
41
|
-
<doctype>article</doctype>
|
42
|
-
<editorialgroup>
|
43
|
-
<technical-committee/>
|
44
|
-
<subcommittee/>
|
45
|
-
<workgroup/>
|
46
|
-
</editorialgroup>
|
47
|
-
<structuredidentifier>
|
48
|
-
<project-number>ISO 123</project-number>
|
49
|
-
</structuredidentifier>
|
50
|
-
<stagename>International standard</stagename>
|
51
|
-
</ext>
|
52
|
-
</bibdata>
|
data/tmp/my-custom-csd/Gemfile
DELETED
data/tmp/my-custom-csd/Makefile
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
#!make
|
2
|
-
SHELL := /bin/bash
|
3
|
-
# Ensure the xml2rfc cache directory exists locally
|
4
|
-
IGNORE := $(shell mkdir -p $(HOME)/.cache/xml2rfc)
|
5
|
-
|
6
|
-
SRC := $(shell yq r metanorma.yml metanorma.source.files | cut -c 3-999)
|
7
|
-
ifeq ($(SRC),ll)
|
8
|
-
SRC := $(filter-out README.adoc, $(wildcard *.adoc))
|
9
|
-
endif
|
10
|
-
|
11
|
-
FORMAT_MARKER := mn-output-
|
12
|
-
FORMATS := $(shell grep "$(FORMAT_MARKER)" $(SRC) | cut -f 2 -d ' ' | tr ',' '\n' | sort | uniq | tr '\n' ' ')
|
13
|
-
|
14
|
-
XML := $(patsubst %.adoc,%.xml,$(SRC))
|
15
|
-
XMLRFC3 := $(patsubst %.adoc,%.v3.xml,$(SRC))
|
16
|
-
HTML := $(patsubst %.adoc,%.html,$(SRC))
|
17
|
-
DOC := $(patsubst %.adoc,%.doc,$(SRC))
|
18
|
-
PDF := $(patsubst %.adoc,%.pdf,$(SRC))
|
19
|
-
TXT := $(patsubst %.adoc,%.txt,$(SRC))
|
20
|
-
NITS := $(patsubst %.adoc,%.nits,$(wildcard draft-*.adoc))
|
21
|
-
WSD := $(wildcard models/*.wsd)
|
22
|
-
XMI := $(patsubst models/%,xmi/%,$(patsubst %.wsd,%.xmi,$(WSD)))
|
23
|
-
PNG := $(patsubst models/%,images/%,$(patsubst %.wsd,%.png,$(WSD)))
|
24
|
-
|
25
|
-
COMPILE_CMD_LOCAL := bundle exec metanorma $$FILENAME
|
26
|
-
COMPILE_CMD_DOCKER := docker run -v "$$(pwd)":/metanorma/ ribose/metanorma "metanorma $$FILENAME"
|
27
|
-
|
28
|
-
ifdef METANORMA_DOCKER
|
29
|
-
COMPILE_CMD := echo "Compiling via docker..."; $(COMPILE_CMD_DOCKER)
|
30
|
-
else
|
31
|
-
COMPILE_CMD := echo "Compiling locally..."; $(COMPILE_CMD_LOCAL)
|
32
|
-
endif
|
33
|
-
|
34
|
-
_OUT_FILES := $(foreach FORMAT,$(FORMATS),$(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
35
|
-
OUT_FILES := $(foreach F,$(_OUT_FILES),$($F))
|
36
|
-
|
37
|
-
all: images $(OUT_FILES)
|
38
|
-
|
39
|
-
%.v3.xml %.xml %.html %.doc %.pdf %.txt: %.adoc | bundle
|
40
|
-
FILENAME=$^; \
|
41
|
-
${COMPILE_CMD}
|
42
|
-
|
43
|
-
draft-%.nits: draft-%.txt
|
44
|
-
VERSIONED_NAME=`grep :name: draft-$*.adoc | cut -f 2 -d ' '`; \
|
45
|
-
cp $^ $${VERSIONED_NAME}.txt && \
|
46
|
-
idnits --verbose $${VERSIONED_NAME}.txt > $@ && \
|
47
|
-
cp $@ $${VERSIONED_NAME}.nits && \
|
48
|
-
cat $${VERSIONED_NAME}.nits
|
49
|
-
|
50
|
-
%.nits:
|
51
|
-
|
52
|
-
nits: $(NITS)
|
53
|
-
|
54
|
-
images: $(PNG)
|
55
|
-
|
56
|
-
images/%.png: models/%.wsd
|
57
|
-
plantuml -tpng -o ../images/ $<
|
58
|
-
|
59
|
-
xmi: $(XMI)
|
60
|
-
|
61
|
-
xmi/%.xmi: models/%.wsd
|
62
|
-
plantuml -xmi:star -o ../xmi/ $<
|
63
|
-
|
64
|
-
define FORMAT_TASKS
|
65
|
-
OUT_FILES-$(FORMAT) := $($(shell echo $(FORMAT) | tr '[:lower:]' '[:upper:]'))
|
66
|
-
|
67
|
-
open-$(FORMAT):
|
68
|
-
open $$(OUT_FILES-$(FORMAT))
|
69
|
-
|
70
|
-
clean-$(FORMAT):
|
71
|
-
rm -f $$(OUT_FILES-$(FORMAT))
|
72
|
-
|
73
|
-
$(FORMAT): clean-$(FORMAT) $$(OUT_FILES-$(FORMAT))
|
74
|
-
|
75
|
-
.PHONY: clean-$(FORMAT)
|
76
|
-
|
77
|
-
endef
|
78
|
-
|
79
|
-
$(foreach FORMAT,$(FORMATS),$(eval $(FORMAT_TASKS)))
|
80
|
-
|
81
|
-
open: open-html
|
82
|
-
|
83
|
-
clean:
|
84
|
-
rm -f $(OUT_FILES) && rm -rf published
|
85
|
-
|
86
|
-
bundle:
|
87
|
-
if [ "x" == "${METANORMA_DOCKER}x" ]; then bundle; fi
|
88
|
-
|
89
|
-
.PHONY: bundle all open clean
|
90
|
-
|
91
|
-
#
|
92
|
-
# Watch-related jobs
|
93
|
-
#
|
94
|
-
|
95
|
-
.PHONY: watch serve watch-serve
|
96
|
-
|
97
|
-
NODE_BINS := onchange live-serve run-p
|
98
|
-
NODE_BIN_DIR := node_modules/.bin
|
99
|
-
NODE_PACKAGE_PATHS := $(foreach PACKAGE_NAME,$(NODE_BINS),$(NODE_BIN_DIR)/$(PACKAGE_NAME))
|
100
|
-
|
101
|
-
$(NODE_PACKAGE_PATHS): package.json
|
102
|
-
npm i
|
103
|
-
|
104
|
-
watch: $(NODE_BIN_DIR)/onchange
|
105
|
-
$(MAKE) all
|
106
|
-
$< $(ALL_SRC) -- $(MAKE) all
|
107
|
-
|
108
|
-
define WATCH_TASKS
|
109
|
-
watch-$(FORMAT): $(NODE_BIN_DIR)/onchange
|
110
|
-
$(MAKE) $(FORMAT)
|
111
|
-
$$< $$(SRC_$(FORMAT)) -- $(MAKE) $(FORMAT)
|
112
|
-
|
113
|
-
.PHONY: watch-$(FORMAT)
|
114
|
-
endef
|
115
|
-
|
116
|
-
$(foreach FORMAT,$(FORMATS),$(eval $(WATCH_TASKS)))
|
117
|
-
|
118
|
-
serve: $(NODE_BIN_DIR)/live-server revealjs-css reveal.js images
|
119
|
-
export PORT=$${PORT:-8123} ; \
|
120
|
-
port=$${PORT} ; \
|
121
|
-
for html in $(HTML); do \
|
122
|
-
$< --entry-file=$$html --port=$${port} --ignore="*.html,*.xml,Makefile,Gemfile.*,package.*.json" --wait=1000 & \
|
123
|
-
port=$$(( port++ )) ;\
|
124
|
-
done
|
125
|
-
|
126
|
-
watch-serve: $(NODE_BIN_DIR)/run-p
|
127
|
-
$< watch serve
|
128
|
-
|
129
|
-
#
|
130
|
-
# Deploy jobs
|
131
|
-
#
|
132
|
-
|
133
|
-
publish:
|
134
|
-
$(MAKE) published
|
135
|
-
|
136
|
-
published:
|
137
|
-
mkdir -p $@ && \
|
138
|
-
export GLOBIGNORE=$(SRC); \
|
139
|
-
cp -a $(addsuffix .*,$(basename $(SRC))) $@/; \
|
140
|
-
unset GLOBIGNORE; \
|
141
|
-
cp $(firstword $(HTML)) $@/index.html
|
142
|
-
|
143
|
-
.PHONY: publish
|
144
|
-
|