relaton-cli 0.3.18 → 0.4.3

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: 652835bed5f2abe467e0f702efca4c78f5b5653a430bc1e5cc55e58cf2679f7f
4
- data.tar.gz: b1df5f7633597ac2f72cb828c31166a31c630474dc2b0d683f00b224946c3822
3
+ metadata.gz: dbb153837a43075460f32bbcc33fa18460868365f699dd6e2da57c01e1039066
4
+ data.tar.gz: 325431872002258b6d6f1d6d8f2c5ebfc674aadb06c8e08b23f08ed7031fe4ac
5
5
  SHA512:
6
- metadata.gz: 96936d3d7cc299b25af888e44027548d9d7caab1db081baabb390fd5e36e407442d271577b1a893a1f52a4c5a675d1fea52940c17a6d4137cd32f8750214ce5b
7
- data.tar.gz: 150877b431f1c3b88068293ffb32d9df19657c37af147ff448cb990b64f56010da2796699860b34d61d5d42f00fc3823c7f1d525d134d6e9b804b950e1e3add2
6
+ metadata.gz: 4b5d7221bf4951d058774df317617437de75648bfa1a5d720d2e130ab1df2f0ec503247a279ef0ee291603271282f69c866750d19406a1eca3e3010bb50b01c5
7
+ data.tar.gz: 40e035f13365c7664a7ebae2dd1ab302e264ab85cfa5b69e5a4c2210d257210c12f6b1639932a04e9a588e7f6076e4de926ee2821cbccf89340ce89661f0fdc0
@@ -13,8 +13,6 @@ jobs:
13
13
  ruby: [ '2.6', '2.5', '2.4' ]
14
14
  steps:
15
15
  - uses: actions/checkout@master
16
- with:
17
- submodules: recursive
18
16
  - name: Use Ruby
19
17
  uses: actions/setup-ruby@v1
20
18
  with:
@@ -13,8 +13,6 @@ jobs:
13
13
  ruby: [ '2.6', '2.5', '2.4' ]
14
14
  steps:
15
15
  - uses: actions/checkout@master
16
- with:
17
- submodules: recursive
18
16
  - name: Use Ruby
19
17
  uses: actions/setup-ruby@v1
20
18
  with:
@@ -13,8 +13,6 @@ jobs:
13
13
  ruby: [ '2.6', '2.5', '2.4' ]
14
14
  steps:
15
15
  - uses: actions/checkout@master
16
- with:
17
- submodules: recursive
18
16
  - name: Use Ruby
19
17
  uses: actions/setup-ruby@v1
20
18
  with:
@@ -1,35 +1,33 @@
1
1
  = Relaton CLI (relaton-cli): Relaton Command-line Interface
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton-cli.svg["Gem Version", link="https://rubygems.org/gems/relaton-cli"]
4
- image:https://img.shields.io/travis/metanorma/relaton-cli/master.svg["Build Status", link="https://travis-ci.org/metanorma/relaton-cli"]
5
- image:https://ci.appveyor.com/api/projects/status/fyy87flpig4q5o2u?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/ribose/relaton-cli"]
4
+ image:https://github.com/relaton/relaton-cli/workflows/ubuntu/badge.svg["Build Status", link="https://github.com/relaton/relaton-cli/actions?workflow=ubuntu"]
5
+ image:https://github.com/relaton/relaton-cli/workflows/macos/badge.svg["Build Status", link="https://github.com/relaton/relaton-cli/actions?workflow=macos"]
6
+ image:https://github.com/relaton/relaton-cli/workflows/windows/badge.svg["Build Status", link="https://github.com/relaton/relaton-cli/actions?workflow=windows"]
6
7
  image:https://codeclimate.com/github/metanorma/relaton-cli/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-cli"]
7
8
 
8
9
  Documentation in development.
9
10
 
10
- Please refer to https://github.com/metanorma/relaton.
11
+ Please refer to https://github.com/relaton/relaton.
11
12
 
12
- == Executables
13
+ == Commands
13
14
 
14
- The following executables are included:
15
+ The following commands are provided.
15
16
 
16
17
  === relaton concatenate
17
18
 
18
19
  [source,console]
19
20
  ----
20
- $ relaton concatenate Source-Directory Collection-File -t TITLE -g ORGANIZATION -n
21
+ $ relaton concatenate Source-Directory Relaton-Collection-File -t TITLE -g ORGANIZATION -n
21
22
  ----
22
23
 
23
- Iterates through all the Relaton YAML files in `Source-Directory`, and converts them in-place into Relaton XML.
24
+ Iterates through all the Relaton files (YAML and XML) in `Source-Directory`, and concatenates them into a Relaton Collection file. The extension of the Collection file can be set using the `Relaton-Collection-File` file name (i.e, if it uses an extension of `yaml`, a Relaton YAML file will be created; if `rxl`, a Relaton XML file will be created, or via the `-x [ext]` (or `--extension`) option.
24
25
 
25
- Iterates through all the Relaton XML files in `Source-Directory` (including those just converted from Relaton YAML),
26
- and outputs to `Collection-File` a `relaton-collection` document containing all the Relaton XML objects read in.
27
-
28
- For each Relaton XML file, if a document file with the same base name is identified (i.e. an XML, HTML, PDF or DOC
26
+ For each Relaton input file in the `Source-Directory`, if a document file with the same base name is identified (i.e. an XML, HTML, PDF or DOC
29
27
  file), a link to that file is inserted.
30
28
 
31
29
  If the `TITLE` or `ORGANIZATION` options are given, they are added to the `Collection-File` output as the
32
- title and author of the `relaton-collection` document.
30
+ title and author of the `Relaton-Collection-File` document.
33
31
 
34
32
  If the `-n` or `--new` option given then use the new Relaton YAML format https://github.com/relaton/relaton-bib/blob/master/docs/hash.adoc.
35
33
 
@@ -37,11 +35,11 @@ If the `-n` or `--new` option given then use the new Relaton YAML format https:/
37
35
 
38
36
  [source,console]
39
37
  ----
40
- $ relaton split Collection-File Relaton-File-Directory -x rxl -n
38
+ $ relaton split Relaton-Collection-File Relaton-File-Directory -x rxl -n
41
39
  ----
42
40
 
43
41
  Splits a `Relaton-Collection-File` into multiple files in the `Relaton-File-Directory`, and it also
44
- suports an addional `extension` options to use different extension.
42
+ suports an additional `-x` or `--extension` options to use different extension.
45
43
 
46
44
  If the `-n` or `--new` option given then use the new Relaton YAML format https://github.com/relaton/relaton-bib/blob/master/docs/hash.adoc.
47
45
 
@@ -217,9 +215,9 @@ Render a Relaton YAML file (`filename.yaml`) as an HTML file. The stylesheet and
217
215
  $ relaton yaml2xmlnew <filename.yaml> -o OUTPUT-DIRECTORY -x RELATON_EXTENSION -p PREFIX -r LIBRARY
218
216
  ----
219
217
 
220
- Convert a Relaton YAML file (`filename.yaml`) in a new format into a Relaton XML file (`filename.xml`). If the Relaton YAML file specifies multiple bibliograph items, and `OUTPUT-DIRECTORY` is nominated, also convert the file into a list of Relaton XML files for each entry, stored in that directory. The document identifier is used as the name of each Relaton XML file; the Relaton XML filename is suffixed with `RELATON_EXTENSION` (default `.rxl`) and prefixed with `PREFIX` (default empty). Any libraries that need to be required for the conversion are specified in `LIBRARY` as a space-delimited list.
218
+ Convert a Relaton YAML file (`filename.yaml`) in a new format into a Relaton XML file (`filename.xml`). If the Relaton YAML file specifies multiple bibliographic items, and `OUTPUT-DIRECTORY` is nominated, also convert the file into a list of Relaton XML files for each entry, stored in that directory. The document identifier is used as the name of each Relaton XML file; the Relaton XML filename is suffixed with `RELATON_EXTENSION` (default `.rxl`) and prefixed with `PREFIX` (default empty). Any libraries that need to be required for the conversion are specified in `LIBRARY` as a space-delimited list.
221
219
 
222
- A Relaton Colleciton YAML file contains some initial metadata, and a list of metadata about each bibliographic entry:
220
+ A Relaton Collection YAML file contains some initial metadata, and a list of metadata about each bibliographic entry:
223
221
 
224
222
  [source,yaml]
225
223
  ----
@@ -228,11 +226,11 @@ root:
228
226
  title: CalConnect Standards Registry
229
227
  items:
230
228
  - technical_committee: PUBLISH
231
- docid:
229
+ docid:
232
230
  type: CC
233
231
  id: CC 36000
234
232
  type: standard
235
- title:
233
+ title:
236
234
  type: main
237
235
  content: Standardization documents -- Vocabulary
238
236
  docstatus:
@@ -241,11 +239,11 @@ root:
241
239
  type: issued
242
240
  value: 2018-10-25
243
241
  - technical_committee: DATETIME
244
- docid:
242
+ docid:
245
243
  type: CC
246
244
  id: CC 34000
247
245
  type: standard
248
- title:
246
+ title:
249
247
  type: main
250
248
  content: Date and time -- Concepts and vocabulary
251
249
  docstatus:
@@ -255,7 +253,7 @@ root:
255
253
  value: 2018-10-25
256
254
  ----
257
255
 
258
- A Relaton YAML file describing an individual bibliographic entry is limited to metadata specific to that entry. Flavor gems have aditional fields. The following illustrates the common fields supported by all flavor gems (see link:https://github.com/relaton/relaton-bib/blob/master/docs/hash.adoc#yaml[Relaton YAML]):
256
+ A Relaton YAML file describing an individual bibliographic entry is limited to metadata specific to that entry. Flavor gems have additional fields. The following illustrates the common fields supported by all flavor gems (see link:https://github.com/relaton/relaton-bib/blob/master/docs/hash.adoc#yaml[Relaton YAML]):
259
257
 
260
258
  [source,yaml]
261
259
  ----
@@ -470,4 +468,5 @@ Convert a Relaton XML file (`filename.xml` or `filename.rxl`) into a Relaton YAM
470
468
  $ relaton yaml2xmlnew <filename.yaml> [<stylesheet>] [<liquid-template-dir>]
471
469
  ----
472
470
 
473
- Render a Relaton YAML file in a new format (`filename.yaml`) as an HTML file. The `stylesheet` and `liquid-template-dir` directories are as for <<relaton xml2html,relaton xml2html>>.
471
+ Render a Relaton YAML file in a new format (`filename.yaml`) as an HTML file. The `stylesheet` and `liquid-template-dir` directories are as for <<relaton xml2html,relaton xml2html>>.
472
+
@@ -19,7 +19,7 @@ module Relaton
19
19
  end
20
20
 
21
21
  desc "extract Metanorma-XML-File / Directory Relaton-XML-Directory", "Extract Relaton XML from Metanorma XML file / directory"
22
- option :extension, aliases: :x, desc: "File extension of Relaton XML files, defaults to 'rxl'"
22
+ option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, defaults to 'rxl'"
23
23
 
24
24
  def extract(source_dir, outdir)
25
25
  Relaton::Cli::RelatonFile.extract(source_dir, outdir, options)
@@ -29,13 +29,14 @@ module Relaton
29
29
  option :title, aliases: :t, desc: "Title of resulting Relaton collection"
30
30
  option :organization, aliases: :g, desc: "Organization owner of Relaton collection"
31
31
  option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton YAML format"
32
+ option :extension, aliases: :x, default: "rxl", desc: "File extension of destination Relaton file, defaults to 'rxl'"
32
33
 
33
34
  def concatenate(source_dir, outfile)
34
35
  Relaton::Cli::RelatonFile.concatenate(source_dir, outfile, options)
35
36
  end
36
37
 
37
38
  desc "split Relaton-Collection-File Relaton-XML-Directory", "Split a Relaton Collection into multiple files"
38
- option :extension, aliases: :x, desc: "File extension of Relaton XML files, defaults to 'rxl'"
39
+ option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, defaults to 'rxl'"
39
40
  option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton YAML format"
40
41
 
41
42
  def split(source, outdir)
@@ -43,7 +44,7 @@ module Relaton
43
44
  end
44
45
 
45
46
  desc "yaml2xml YAML", "Convert Relaton YAML into Relaton Collection XML or separate files"
46
- option :extension, aliases: :x, desc: "File extension of Relaton XML files, defaults to 'rxl'"
47
+ option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, defaults to 'rxl'"
47
48
  option :prefix, aliases: :p, desc: "Filename prefix of individual Relaton XML files, defaults to empty"
48
49
  option :outdir, aliases: :o, desc: "Output to the specified directory with individual Relaton Bibdata XML files"
49
50
  option :require, aliases: :r, type: :array, desc: "Require LIBRARY prior to execution"
@@ -54,7 +55,7 @@ module Relaton
54
55
  end
55
56
 
56
57
  desc "yaml2xmlnew YAML", "Convert Relaton YAML into Relaton Collection XML or separate files"
57
- option :extension, aliases: :x, desc: "File extension of Relaton XML files, defaults to 'rxl'"
58
+ option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, defaults to 'rxl'"
58
59
  option :prefix, aliases: :p, desc: "Filename prefix of individual Relaton XML files, defaults to empty"
59
60
  option :outdir, aliases: :o, desc: "Output to the specified directory with individual Relaton Bibdata XML files"
60
61
  option :require, aliases: :r, type: :array, desc: "Require LIBRARY prior to execution"
@@ -65,7 +66,7 @@ module Relaton
65
66
  end
66
67
 
67
68
  desc "xml2yaml XML", "Convert Relaton XML into Relaton Bibdata / Bibcollection YAML (and separate files)"
68
- option :extension, aliases: :x, desc: "File extension of Relaton YAML files, defaults to 'yaml'"
69
+ option :extension, aliases: :x, default: "yaml", desc: "File extension of Relaton YAML files, defaults to 'yaml'"
69
70
  option :prefix, aliases: :p, desc: "Filename prefix of Relaton XML files, defaults to empty"
70
71
  option :outdir, aliases: :o, desc: "Output to the specified directory with individual Relaton Bibdata YAML files"
71
72
  option :require, aliases: :r, type: :array, desc: "Require LIBRARY prior to execution"
@@ -76,7 +77,7 @@ module Relaton
76
77
  end
77
78
 
78
79
  desc "xml2yamlnew XML", "Convert Relaton XML into Relaton Bibdata / Bibcollection YAML (and separate files)"
79
- option :extension, aliases: :x, desc: "File extension of Relaton YAML files, defaults to 'yaml'"
80
+ option :extension, aliases: :x, default: "yaml", desc: "File extension of Relaton YAML files, defaults to 'yaml'"
80
81
  option :prefix, aliases: :p, desc: "Filename prefix of Relaton XML files, defaults to empty"
81
82
  option :outdir, aliases: :o, desc: "Output to the specified directory with individual Relaton Bibdata YAML files"
82
83
  option :require, aliases: :r, type: :array, desc: "Require LIBRARY prior to execution"
@@ -16,7 +16,7 @@ module Relaton
16
16
  end
17
17
 
18
18
  def concatenate
19
- write_to_file(bibcollection.to_xml(options))
19
+ concatenate_and_write_to_files
20
20
  end
21
21
 
22
22
  def split
@@ -128,7 +128,7 @@ module Relaton
128
128
  bibdata = Relaton::Bibdata.from_xml(bib.root)
129
129
  build_bibdata_relaton(bibdata, file)
130
130
 
131
- write_to_file(bibdata.to_xml, outdir, build_filename(file))
131
+ write_to_file(bibdata.send(output_type), outdir, build_filename(file))
132
132
  end
133
133
  end
134
134
 
@@ -147,6 +147,10 @@ module Relaton
147
147
  end.compact
148
148
  end
149
149
 
150
+ def concatenate_and_write_to_files
151
+ write_to_file(bibcollection.send(output_type))
152
+ end
153
+
150
154
  def split_and_write_to_files
151
155
  output_dir = outdir || build_dirname(source)
152
156
 
@@ -164,9 +168,16 @@ module Relaton
164
168
  end
165
169
  end
166
170
 
167
- def output_type
168
- output_format = options[:extension] || "rxl"
169
- (output_format == "rxl" ? "to_xml" : "to_#{output_format}").to_sym
171
+ def output_type(ext=options[:extension])
172
+ case ext
173
+ when "rxl", "xml"
174
+ :to_xml
175
+ when "yml", "yaml"
176
+ :to_yaml
177
+ else
178
+ puts "The given extension of '#{ext}' is not supported."
179
+ :to_xml
180
+ end
170
181
  end
171
182
 
172
183
  def bibdata_instance(document, file)
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cli
3
- VERSION = "0.3.18".freeze
3
+ VERSION = "0.4.3".freeze
4
4
  end
5
5
  end
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "debase"
35
35
  spec.add_development_dependency "simplecov"
36
36
 
37
- spec.add_runtime_dependency "relaton", "~> 0.5"
37
+ spec.add_runtime_dependency "relaton", "~> 0.6.0"
38
38
  spec.add_runtime_dependency "thor"
39
39
  spec.add_runtime_dependency "liquid"
40
40
  # spec.add_runtime_dependency 'byebug'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.4.3
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-12-02 00:00:00.000000000 Z
11
+ date: 2019-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0.5'
159
+ version: 0.6.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0.5'
166
+ version: 0.6.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: thor
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -210,7 +210,6 @@ files:
210
210
  - ".rubocop.yml"
211
211
  - CHANGELOG.md
212
212
  - Gemfile
213
- - Gemfile.lock
214
213
  - LICENSE
215
214
  - Rakefile
216
215
  - bin/console
@@ -1,128 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- relaton-cli (0.3.18)
5
- liquid
6
- relaton (~> 0.5)
7
- thor
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- addressable (2.7.0)
13
- public_suffix (>= 2.0.2, < 5.0)
14
- byebug (10.0.2)
15
- cnccs (0.1.5)
16
- coderay (1.1.2)
17
- debase (0.2.3)
18
- debase-ruby_core_source (>= 0.10.2)
19
- debase-ruby_core_source (0.10.5)
20
- diff-lcs (1.3)
21
- docile (1.3.2)
22
- equivalent-xml (0.6.0)
23
- nokogiri (>= 1.4.3)
24
- faraday (0.17.1)
25
- multipart-post (>= 1.2, < 3)
26
- gb-agencies (0.0.6)
27
- isoics (0.1.8)
28
- json (2.2.0)
29
- liquid (4.0.3)
30
- method_source (0.9.2)
31
- mini_portile2 (2.4.0)
32
- mixlib-shellout (2.4.4)
33
- multipart-post (2.1.1)
34
- nokogiri (1.10.5)
35
- mini_portile2 (~> 2.4.0)
36
- pry (0.12.2)
37
- coderay (~> 1.1.0)
38
- method_source (~> 0.9.0)
39
- public_suffix (4.0.1)
40
- rake (12.3.3)
41
- relaton (0.5.18)
42
- relaton-calconnect (~> 0.1.0)
43
- relaton-gb (~> 0.6.0)
44
- relaton-iec (~> 0.4.0)
45
- relaton-ietf (~> 0.6.0)
46
- relaton-iso (~> 0.6.0)
47
- relaton-itu (~> 0.3.0)
48
- relaton-nist (~> 0.3.0)
49
- relaton-ogc (~> 0.1.0)
50
- relaton-bib (0.3.12)
51
- addressable
52
- nokogiri
53
- relaton-calconnect (0.1.2)
54
- faraday
55
- relaton-iso-bib (~> 0.3.0)
56
- relaton-gb (0.6.8)
57
- cnccs (~> 0.1.1)
58
- gb-agencies (~> 0.0.1)
59
- relaton-iso-bib (~> 0.3.0)
60
- relaton-iec (0.4.11)
61
- addressable
62
- relaton-iso-bib (~> 0.3.0)
63
- relaton-ietf (0.6.10)
64
- relaton-bib (~> 0.3.0)
65
- relaton-iso (0.6.10)
66
- relaton-iec (~> 0.4.0)
67
- relaton-iso-bib (~> 0.3.0)
68
- relaton-iso-bib (0.3.12)
69
- isoics (~> 0.1.6)
70
- relaton-bib (~> 0.3.0)
71
- ruby_deep_clone (~> 0.8.0)
72
- relaton-itu (0.3.11)
73
- relaton-iso-bib (~> 0.3.0)
74
- relaton-nist (0.3.9)
75
- relaton-bib (~> 0.3.0)
76
- rubyzip
77
- relaton-ogc (0.1.4)
78
- faraday
79
- relaton-iso-bib (~> 0.3.0)
80
- rspec (3.8.0)
81
- rspec-core (~> 3.8.0)
82
- rspec-expectations (~> 3.8.0)
83
- rspec-mocks (~> 3.8.0)
84
- rspec-command (1.0.3)
85
- mixlib-shellout (~> 2.0)
86
- rspec (~> 3.2)
87
- rspec-its (~> 1.2)
88
- rspec-core (3.8.2)
89
- rspec-support (~> 3.8.0)
90
- rspec-expectations (3.8.4)
91
- diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.8.0)
93
- rspec-its (1.3.0)
94
- rspec-core (>= 3.0.0)
95
- rspec-expectations (>= 3.0.0)
96
- rspec-mocks (3.8.1)
97
- diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.8.0)
99
- rspec-support (3.8.2)
100
- ruby-debug-ide (0.7.0)
101
- rake (>= 0.8.1)
102
- ruby_deep_clone (0.8.0)
103
- rubyzip (2.0.0)
104
- simplecov (0.17.0)
105
- docile (~> 1.1)
106
- json (>= 1.8, < 3)
107
- simplecov-html (~> 0.10.0)
108
- simplecov-html (0.10.2)
109
- thor (0.20.3)
110
-
111
- PLATFORMS
112
- ruby
113
-
114
- DEPENDENCIES
115
- byebug (~> 10.0)
116
- debase
117
- equivalent-xml (~> 0.6)
118
- pry
119
- rake (~> 12.0)
120
- relaton-cli!
121
- rspec (~> 3.0)
122
- rspec-command (~> 1.0.3)
123
- rspec-core (~> 3.4)
124
- ruby-debug-ide
125
- simplecov
126
-
127
- BUNDLED WITH
128
- 2.0.2