metanorma-cli 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88193e8fa2e31b1e2d7361f669af82c64a64e44729240a573c3abcc221c30112
4
- data.tar.gz: 0c1a39a506344e02866e3b364daa02c6e06af304b9384d0b6b462389a6c5260a
3
+ metadata.gz: 2410a33ad2bacfb66c4f7e6ee2c3ffb1d6c13bfb1ed65b6772c884c55ce4a663
4
+ data.tar.gz: 2fa231a58594b34711ff9b674a613e51ec6727f0639dedfcd2ed871f92b3fed5
5
5
  SHA512:
6
- metadata.gz: 866e19a6269a9bacd36767729e89ee8be8c208532176e7d61cda7065b8b08f47f44df4e480ecb9f95f1adecc15f2a8a92eb598838dd59a583ba922487b3f3ef2
7
- data.tar.gz: d0b4ab37ca0166b489d22e90b51206c10db13a5f9e98ed53d4de9ce9be183f6bf470d4314f7144b0094926b2d589a3e0a3f76807dd67328e06cbf9e998aad090
6
+ metadata.gz: 7afdd97819fec7df7ba1d056066ca658c6b4a33af191f40d88fa067fd27dafe2a37ca5ecb672465ee5d3f2904a1a86404bcf4d54d9682a1c2c55951b7ebc2f36
7
+ data.tar.gz: 1ab470e100859fae5746aa7a7fda60dbbf4cb783b23647ba6f9d1c4ef036a630d6d86cb9ee42bdf49a6aab4db695f54936b489079fbb80729e92930eae9a57e6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metanorma-cli (1.2.1)
4
+ metanorma-cli (1.2.2)
5
5
  git (~> 1.5)
6
6
  isodoc (~> 0.10.0)
7
7
  metanorma (~> 0.3.9)
@@ -69,7 +69,7 @@ GEM
69
69
  isoics (0.1.7)
70
70
  json (2.2.0)
71
71
  liquid (4.0.3)
72
- metanorma (0.3.13)
72
+ metanorma (0.3.14)
73
73
  asciidoctor
74
74
  htmlentities
75
75
  metanorma-acme (1.2.1)
@@ -242,7 +242,7 @@ GEM
242
242
  tzinfo
243
243
  tzinfo (2.0.0)
244
244
  concurrent-ruby (~> 1.0)
245
- tzinfo-data (1.2019.1)
245
+ tzinfo-data (1.2019.2)
246
246
  tzinfo (>= 1.0.0)
247
247
  unicode2latex (0.0.2)
248
248
  uuidtools (2.1.5)
@@ -22,6 +22,7 @@ install:
22
22
  build_script:
23
23
  - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
24
24
  - set GIT_TERMINAL_PROMPT=0
25
+ - gem install bundler -v "~> 2"
25
26
  - bundle config --local path vendor/bundle
26
27
  - bundle update
27
28
  - bundle install
@@ -1,151 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
+ # encoding: UTF-8
2
3
 
3
- # Note
4
- #
5
- # Currently, we are developing a new version for this CLI, and
6
- # to test it out we adding this environment variable. When the
7
- # `METANORMA_DEV_MODE` set to `true` then it will revert to the
8
- # old version of the CLI.
9
- #
10
- unless ENV.fetch("METANORMA_DEV_MODE", false) == "true"
11
- require "bundler/setup"
12
- require "metanorma/cli"
4
+ # resolve bin path, ignoring symlinks
5
+ require "pathname"
6
+ bin_file = Pathname.new(__FILE__).realpath
13
7
 
14
- Metanorma::Cli.start(ARGV)
15
- exit 0
16
- end
17
-
18
- require "optparse"
19
- require "metanorma"
20
- require "fileutils"
21
- require "nokogiri"
22
- require "metanorma-cli"
23
-
24
- registry = Metanorma::Registry.instance
25
- Metanorma::Cli.load_flavors
26
-
27
- options = {
28
- format: :asciidoc
29
- }
30
- opt_parser = OptionParser.new do |opts|
31
- opts.banner += " <file>"
32
- opts.on(
33
- '-t',
34
- '--type TYPE',
35
- String,
36
- "Type of standard to generate",
37
- "#{registry.supported_backends}"
38
- ) { |v| options[:type] = v.to_sym }
39
-
40
- output_formats = registry.output_formats.inject([]) do |acc, (processor, formats)|
41
- str = "* #{processor.to_s}: "
42
-
43
- formats.each_pair do |type, ext|
44
- str << "['#{type.to_s}': #{ext.to_s}] "
45
- end
46
-
47
- acc << str
48
- end
49
-
50
- opts.on(
51
- '-x',
52
- "--extensions all | EXT,...",
53
- Array,
54
- "Document extensions available per type (type, ['filetype': ext])",
55
- *output_formats
56
- ) { |v| options[:extension_keys] = v.map(&:to_sym) }
57
-
58
- input_formats = [:asciidoc]
59
- opts.on(
60
- '-f',
61
- '--format FORMAT',
62
- String,
63
- 'Format of source file',
64
- "#{input_formats}",
65
- ) { |v| options[:format] = v.to_sym }
66
-
67
- opts.on(
68
- '-r',
69
- '--require LIBRARY',
70
- 'Require LIBRARY prior to execution'
71
- ) { |v|
72
- options[:require] ||= []
73
- options[:require] << v
74
- }
75
-
76
- opts.on(
77
- '-v',
78
- '--version',
79
- "Print version of code (accompanied with -t)",
80
- ) { options[:version] = true }
81
-
82
- opts.on(
83
- '-w',
84
- '--wrapper',
85
- 'Create wrapper folder for HTML output'
86
- ) { options[:wrapper] = true }
87
-
88
- opts.on(
89
- '-a',
90
- '--asciimath',
91
- 'Keep Asciimath in XML output instead of converting it to MathML'
92
- ) { options[:asciimath] = true }
93
-
94
- opts.on(
95
- '-d',
96
- '--data-uri-image',
97
- 'Encode HTML output images as data URIs'
98
- ) { options[:datauriimage] = true }
99
-
100
- opts.on(
101
- '-R',
102
- '--relaton FILENAME',
103
- 'Export Relaton XML for document to nominated filename'
104
- ) { |v| options[:relaton] = v }
105
-
106
- opts.on(
107
- '-e',
108
- '--extract DIR(,ASSET1,ASSET2...)',
109
- Array,
110
- 'Export sourcecode fragments from this document to nominated directory. If ASSET1,ASSET2 are named, only those types of asset are extracted'
111
- ) do |v|
112
- options[:extract] = v[0]
113
- options[:extract_type] = []
114
- v.size > 1 and options[:extract_type] = v[1..-1].map(&:to_sym)
115
- end
116
-
117
- opts.on_tail("-h", "--help", "Show this message") do
118
- puts opts
119
- exit
120
- end
121
-
122
- end
123
-
124
- opt_parser.parse!(ARGV)
125
-
126
- =begin
127
- if options[:require]
128
- options[:require].each do |r|
129
- require r
130
- end
131
- end
132
- =end
133
-
134
- if options[:version]
135
- case options[:format]
136
- when :asciidoc
137
- processor = registry.find_processor(options[:type].to_sym)
138
- puts processor.version
139
- exit
140
- end
141
- end
8
+ # add self to libpath
9
+ $:.unshift File.expand_path("../../lib", bin_file)
142
10
 
143
- options[:filename] = ARGV.pop
11
+ # Fixes https://github.com/rubygems/rubygems/issues/1420
12
+ require "rubygems/specification"
144
13
 
145
- unless options[:filename]
146
- puts "[metanorma] Error: Need to specify a file to process."
147
- exit 0
14
+ class Gem::Specification
15
+ def this; self; end
148
16
  end
149
17
 
150
- filename = options[:filename]
151
- Metanorma::Compile.new().compile(filename, options)
18
+ # start up the CLI
19
+ require "metanorma/cli"
20
+ Metanorma::Cli.start(ARGV)
@@ -84,6 +84,7 @@ module Metanorma
84
84
  csd: "https://github.com/metanorma/mn-templates-csd",
85
85
  ogc: "https://github.com/metanorma/mn-templates-ogc",
86
86
  iso: "https://github.com/metanorma/mn-templates-iso",
87
+ ietf: "https://github.com/metanorma/mn-templates-ietf"
87
88
  }
88
89
  end
89
90
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Cli
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  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.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-30 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler