metanorma-cli 1.4.3pre → 1.4.5
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/lib/metanorma/cli/command.rb +16 -4
- data/lib/metanorma/cli/commands/site.rb +2 -2
- data/lib/metanorma/cli/site_generator.rb +20 -3
- data/lib/metanorma/cli/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7810d93037ab1a658d5926f6d78cd3be241572ca835bcfc7ded7a0ded10c183
|
4
|
+
data.tar.gz: cf1b89b3a511f319aa79778d36383c2e21912ab2637872acf3accd6ee0832acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 317c8c53fa4d8613c03842db8a83ad3853278a7548abf55af12a6f6cd8624d66b00cd42adfcd778561fe8cb1eafbf2d5db211ddc0e13ba9d1c2053bf7aeecad2
|
7
|
+
data.tar.gz: 7257f36e2d7f106ccaffd8464d393d8eadd4870b6c120701fdb8cded2a227cf4aa10fba43d89851282565645e96d4b385e54308d02c602c010e02a2af8162595
|
@@ -39,10 +39,8 @@ module Metanorma
|
|
39
39
|
|
40
40
|
def compile(file_name = nil)
|
41
41
|
if file_name && !options[:version]
|
42
|
-
|
43
|
-
|
44
|
-
errs.each { |e| Util.log e, :error }
|
45
|
-
exit(1) if errs.any?
|
42
|
+
documents = select_wildcard_documents(file_name) || [file_name]
|
43
|
+
documents.each { |document| compile_document(document, options.dup) }
|
46
44
|
|
47
45
|
elsif options[:version]
|
48
46
|
invoke(:version, [], type: options[:type], format: options[:format])
|
@@ -198,6 +196,20 @@ module Metanorma
|
|
198
196
|
|
199
197
|
UI.table(["Type", "Input", "Supported output format"], table_data)
|
200
198
|
end
|
199
|
+
|
200
|
+
def select_wildcard_documents(filename)
|
201
|
+
if filename.include?("*")
|
202
|
+
Dir.glob(Pathname.new(filename))
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def compile_document(filename, options)
|
207
|
+
Metanorma::Cli.load_flavors
|
208
|
+
errors = Metanorma::Cli::Compiler.compile(filename, options)
|
209
|
+
errors.each { |error| Util.log(error, :error) }
|
210
|
+
|
211
|
+
exit(1) if errors.any?
|
212
|
+
end
|
201
213
|
end
|
202
214
|
end
|
203
215
|
end
|
@@ -6,7 +6,7 @@ module Metanorma
|
|
6
6
|
module Cli
|
7
7
|
module Commands
|
8
8
|
class Site < ThorWithConfig
|
9
|
-
desc "generate SOURCE_PATH", "Generate site from collection"
|
9
|
+
desc "generate [SOURCE_PATH]", "Generate site from collection"
|
10
10
|
option :config, aliases: "-c", desc: "Metanorma configuration file"
|
11
11
|
option(
|
12
12
|
:output_dir,
|
@@ -19,7 +19,7 @@ module Metanorma
|
|
19
19
|
option :no_install_fonts, type: :boolean, desc: "Skip the font installation process"
|
20
20
|
option :continue_without_fonts, type: :boolean, desc: "Continue processing even when fonts are missing"
|
21
21
|
|
22
|
-
def generate(source_path)
|
22
|
+
def generate(source_path = Dir.pwd)
|
23
23
|
Cli::SiteGenerator.generate(source_path, options, filter_compile_options(options))
|
24
24
|
UI.say("Site has been generated at #{options[:output_dir]}")
|
25
25
|
rescue Cli::Errors::InvalidManifestFileError
|
@@ -70,9 +70,11 @@ module Metanorma
|
|
70
70
|
def compile(source)
|
71
71
|
UI.info("Compiling #{source} ...")
|
72
72
|
|
73
|
-
|
73
|
+
options = @compile_options.merge(
|
74
|
+
format: :asciidoc, output_dir: build_asset_output_directory(source)
|
75
|
+
)
|
74
76
|
|
75
|
-
Metanorma::Cli::Compiler.compile(source.to_s,
|
77
|
+
Metanorma::Cli::Compiler.compile(source.to_s, options)
|
76
78
|
end
|
77
79
|
|
78
80
|
def convert_to_html_page(collection, page_name)
|
@@ -127,7 +129,22 @@ module Metanorma
|
|
127
129
|
asset_path = [site_path, asset_folder].join("/")
|
128
130
|
@asset_directory = Pathname.new(Dir.pwd).join(asset_path)
|
129
131
|
|
130
|
-
|
132
|
+
create_directory_if_not_present!(@asset_directory)
|
133
|
+
end
|
134
|
+
|
135
|
+
def create_directory_if_not_present!(directory)
|
136
|
+
FileUtils.mkdir_p(directory) unless directory.exist?
|
137
|
+
end
|
138
|
+
|
139
|
+
def build_asset_output_directory(source)
|
140
|
+
sub_directory = Pathname.new(source.gsub(@source.to_s, "")).dirname.to_s
|
141
|
+
sub_directory.gsub!("/sources", "")
|
142
|
+
sub_directory.slice!(0)
|
143
|
+
|
144
|
+
output_directory = asset_directory.join(sub_directory)
|
145
|
+
create_directory_if_not_present!(output_directory)
|
146
|
+
|
147
|
+
output_directory
|
131
148
|
end
|
132
149
|
end
|
133
150
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -494,11 +494,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
494
494
|
version: 2.4.0
|
495
495
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
496
496
|
requirements:
|
497
|
-
- - "
|
497
|
+
- - ">="
|
498
498
|
- !ruby/object:Gem::Version
|
499
|
-
version:
|
499
|
+
version: '0'
|
500
500
|
requirements: []
|
501
|
-
rubygems_version: 3.
|
501
|
+
rubygems_version: 3.1.4
|
502
502
|
signing_key:
|
503
503
|
specification_version: 4
|
504
504
|
summary: Metanorma is the standard of standards; the metanorma gem allows you to create
|