relaton-cli 1.13.0 → 1.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +0 -1
- data/.github/workflows/release.yml +5 -28
- data/docs/README.adoc +17 -16
- data/lib/relaton/cli/relaton_file.rb +1 -1
- data/lib/relaton/cli/subcommand_collection.rb +34 -33
- data/lib/relaton/cli/version.rb +1 -1
- data/relaton-cli.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ce962bd33e29dc88c310af3cf05bccd843c57a8b729f1579d3d965cf221ce37
|
4
|
+
data.tar.gz: e3168dee95d3efe4ac61678ec2fa29b8a073d19a44a97958c0043bf3047e43e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c46aba4bfd39f2006b69634dad27bc434ef669cfca55f831a2fa75de5b62a50d67a96fb514be124931a8e8fe3004027e506a01efa70aceccee503501f2f910d
|
7
|
+
data.tar.gz: b670592e721a5b98e077dcb49c3f0fa3c22c1984246fea09541c713a2888a283bd88ddc2d26c499398cadc86dc10c294b6ba81814a8286e613065e8133490e56
|
data/.github/workflows/rake.yml
CHANGED
@@ -15,31 +15,8 @@ on:
|
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
release:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
-
|
23
|
-
with:
|
24
|
-
ruby-version: '2.6'
|
25
|
-
bundler-cache: true
|
26
|
-
|
27
|
-
- run: gem install gem-release
|
28
|
-
|
29
|
-
- run: |
|
30
|
-
git config user.name github-actions
|
31
|
-
git config user.email github-actions@github.com
|
32
|
-
|
33
|
-
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip'
|
34
|
-
run: gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
35
|
-
|
36
|
-
- name: publish to rubygems.org
|
37
|
-
env:
|
38
|
-
RUBYGEMS_API_KEY: ${{secrets.RELATON_CI_RUBYGEMS_API_KEY}}
|
39
|
-
run: |
|
40
|
-
envsubst << 'EOF' > ~/.gem/credentials
|
41
|
-
---
|
42
|
-
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
43
|
-
EOF
|
44
|
-
chmod 0600 ~/.gem/credentials
|
45
|
-
gem release
|
18
|
+
uses: relaton/support/.github/workflows/release.yml@master
|
19
|
+
with:
|
20
|
+
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
secrets:
|
22
|
+
rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
|
data/docs/README.adoc
CHANGED
@@ -10,7 +10,7 @@ Please refer to https://github.com/relaton/relaton.
|
|
10
10
|
|
11
11
|
== Commands
|
12
12
|
|
13
|
-
Each command has an option `--verbose` (short form is `-v`). Use the option to get warnings in the commands
|
13
|
+
Each command has an option `--verbose` (the short form is `-v`). Use the option to get warnings in the commands output.
|
14
14
|
The following commands are provided.
|
15
15
|
|
16
16
|
=== relaton concatenate
|
@@ -23,7 +23,7 @@ $ relaton concatenate Source-Directory Relaton-Collection-File -t TITLE -g ORGAN
|
|
23
23
|
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
24
|
|
25
25
|
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
|
26
|
-
file)
|
26
|
+
file) a link to that file is inserted.
|
27
27
|
|
28
28
|
If the `TITLE` or `ORGANIZATION` options are given, they are added to the `Collection-File` output as the
|
29
29
|
title and author of the `Relaton-Collection-File` document.
|
@@ -47,12 +47,12 @@ $ relaton fetch CODE -t TYPE -f FORMAT -y YEAR -r RETRIES --all-parts --keep-yea
|
|
47
47
|
|
48
48
|
Fetch the Relaton XML entry corresponding to the document identifier `CODE`.
|
49
49
|
|
50
|
-
* `YEAR` is optional
|
51
|
-
* `FORMAT` is optional, and specifies the output format; the
|
52
|
-
* `TYPE` is optional
|
50
|
+
* `YEAR` is optional and specifies the year of publication of the standard.
|
51
|
+
* `FORMAT` is optional, and specifies the output format; the recognized values for `FORMAT` are `xml` (default), yaml, `bibtex`.
|
52
|
+
* `TYPE` is optional and specifies the standards class library to be used, that the identifier is part of. The recognized values for `TYPE` are `3GPP, BIPM, BSI, CC, CEN, CIE, CN, ECMA, IANA, IEC, IEEE, IETF, IHO, ISO, ITU, NIST, OGC, OMG, UN, W3C`.
|
53
53
|
* `RETRIES` is optional, number of network retries (default 1).
|
54
54
|
* `--all-parts` fetch all parts.
|
55
|
-
* `--keep-year` undated reference should return actual reference with year.
|
55
|
+
* `--keep-year` undated reference should return an actual reference with year.
|
56
56
|
|
57
57
|
=== relaton fetch-data
|
58
58
|
|
@@ -61,25 +61,26 @@ Fetch the Relaton XML entry corresponding to the document identifier `CODE`.
|
|
61
61
|
$ relaton fetch-data DATASET -o DIR -f FORMAT
|
62
62
|
----
|
63
63
|
|
64
|
-
Fetch all the documents from a `DATASET` source and save them to a folder `DIR` in format `FORMAT`.
|
64
|
+
Fetch all the documents from a `DATASET` source and save them to a folder `DIR` in the format `FORMAT`.
|
65
65
|
|
66
|
-
|
66
|
+
The following datasets are available:
|
67
67
|
|
68
68
|
* `nist-tech-pubs` - https://raw.githubusercontent.com/usnistgov/NIST-Tech-Pubs/nist-pages/xml/allrecords.xml
|
69
69
|
* `cie-techstreet` - https://www.techstreet.com/cie/searches/31156444
|
70
70
|
* `calconnect-org` - https://standards.calconnect.org/relaton/index.yaml
|
71
71
|
* `ogc-naming-authority` - https://raw.githubusercontent.com/opengeospatial/NamingAuthority/master/incubation/bibliography/bibliography.json
|
72
|
-
* `ieee-rawbib` - looks for the IEEE dataset in local `./ieee-rawbib` directory. The dataset could be downloaded from https://github.com/ietf-ribose/ieee-rawbib repository
|
72
|
+
* `ieee-rawbib` - looks for the IEEE dataset in the local `./ieee-rawbib` directory. The dataset could be downloaded from https://github.com/ietf-ribose/ieee-rawbib repository
|
73
73
|
* `w3c-rdf` - http://www.w3.org/2002/01/tr-automation/tr.rdf
|
74
74
|
* `w3c-tr-archive` - looks for the W3C archive dataset in local `./w3c-tr-archive` directory. The dataset could be downloaded from https://github.com/relaton/w3c-tr-archive repository
|
75
75
|
* `iana-registries` - https://github.com/ietf-ribose/iana-registries
|
76
|
-
* `status-smg-3GPP` - ftp://www.3gpp.org/Information/Databases/Spec_Status/
|
76
|
+
* `status-smg-3GPP` - updates previously downloaded data if a new archive is available in ftp://www.3gpp.org/Information/Databases/Spec_Status/
|
77
|
+
* `status-smg-3GPP-force` - download data from the latest archive in ftp://www.3gpp.org/Information/Databases/Spec_Status/
|
77
78
|
* `ietf-rfcsubseries` - https://www.rfc-editor.org/rfc-index.xml (`<bcp-entry>`, `<fyi-entry>`, `<std-entry>`)
|
78
|
-
* `ietf-internet-drafts` - looks for the Internet-Drafts dataset in local `./bibxml-ids` directory. The dataset could be downloaded using `rsync -avcizxL rsync.ietf.org::bibxml-ids ./bibxml-ids` command.
|
79
|
+
* `ietf-internet-drafts` - looks for the Internet-Drafts dataset in the local `./bibxml-ids` directory. The dataset could be downloaded using `rsync -avcizxL rsync.ietf.org::bibxml-ids ./bibxml-ids` command.
|
79
80
|
* `ietf-rfc-entries` - https://www.rfc-editor.org/rfc-index.xml (`<rfc-entry>`)
|
80
81
|
* `oasis-open` - https://www.oasis-open.org/standards/
|
81
|
-
* `bipm-data-outcomes` - looks for the BIPM dataset in local `./bipm-data-outcomes` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-data-outcomes repository
|
82
|
-
* `si-brochure` - looks for the SI-Brochure dataset in local `./bipm-si-brocure` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-si-brochure repository
|
82
|
+
* `bipm-data-outcomes` - looks for the BIPM dataset in the local `./bipm-data-outcomes` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-data-outcomes repository
|
83
|
+
* `si-brochure` - looks for the SI-Brochure dataset in the local `./bipm-si-brocure` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-si-brochure repository
|
83
84
|
|
84
85
|
Options:
|
85
86
|
|
@@ -116,7 +117,7 @@ There are two templates necessary:
|
|
116
117
|
|
117
118
|
** Index template (`_index.liquid_`)
|
118
119
|
|
119
|
-
*** The HTML Template file `_index.liquid`
|
120
|
+
*** The HTML Template file `_index.liquid` recognizes the following parameters:
|
120
121
|
*** `css`: where the CSS stylesheet `stylesheet` is injected
|
121
122
|
*** `title`: the Title of the collection, `./relaton-collection/title` in `relaton-xml`
|
122
123
|
*** `author`: the Author of the collection, `./relaton-collection/contributor[role/@type = 'author']/organization/name` in `relaton-xml`
|
@@ -124,7 +125,7 @@ There are two templates necessary:
|
|
124
125
|
|
125
126
|
** Individual bibliographic entries template (`_document.liquid`)
|
126
127
|
|
127
|
-
*** This template
|
128
|
+
*** This template recognizes attributes of a bibliographic entry (`document`) that follow the naming convention of <<relaton-yaml,Relaton YAML>>; e.g. `document.html` is the HTML URI for the document.
|
128
129
|
|
129
130
|
The default stylesheet and templates are given (which also demonstrates the structure) in the `templates` directory.
|
130
131
|
|
@@ -186,7 +187,7 @@ $ relaton yaml2xml YAML -o OUTPUT-DIRECTORY -x RELATON_EXTENSION -p PREFIX -r LI
|
|
186
187
|
Convert a Relaton YAML file (`filename.yaml`) 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.
|
187
188
|
|
188
189
|
[[relaton-yaml]]
|
189
|
-
A Relaton Collection YAML file contains some initial metadata
|
190
|
+
A Relaton Collection YAML file contains some initial metadata and a list of metadata about each bibliographic entry:
|
190
191
|
|
191
192
|
[source,yaml]
|
192
193
|
----
|
@@ -109,7 +109,7 @@ module Relaton
|
|
109
109
|
@relaton_collection ||= Bibcollection.from_xml(nokogiri_document(nil, source))
|
110
110
|
end
|
111
111
|
|
112
|
-
def extract_and_write_to_files
|
112
|
+
def extract_and_write_to_files # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
113
113
|
select_source_files.each do |file|
|
114
114
|
xml = nokogiri_document(nil, file)
|
115
115
|
xml.remove_namespaces!
|
@@ -7,8 +7,8 @@ module Relaton
|
|
7
7
|
class_option :verbose, aliases: :v, type: :boolean, desc: "Output warnings"
|
8
8
|
|
9
9
|
desc "create COLLECTION", "Create collection"
|
10
|
-
option :dir, aliases: :d, desc: "Directory to store collection.
|
11
|
-
|
10
|
+
option :dir, aliases: :d, desc: "Directory to store collection. " \
|
11
|
+
"Default is $HOME/.relaton/collections."
|
12
12
|
option :author, desc: "Author"
|
13
13
|
option :title, desc: "Title"
|
14
14
|
option :doctype, desc: "Documents type"
|
@@ -20,14 +20,14 @@ module Relaton
|
|
20
20
|
if File.exist? file_path
|
21
21
|
warn "Collection #{file} aready exist"
|
22
22
|
else
|
23
|
-
|
23
|
+
FileUtils.mkdir_p dir # unless Dir.exist? dir
|
24
24
|
File.write file_path, col.to_yaml, encoding: "UTF-8"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
desc "info COLLECTION", "View collection information"
|
29
|
-
option :dir, aliases: :d, desc: "Directory to store collection.
|
30
|
-
|
29
|
+
option :dir, aliases: :d, desc: "Directory to store collection. " \
|
30
|
+
"Default is $HOME/.relaton/collections."
|
31
31
|
|
32
32
|
def info(file) # rubocop:disable Metrics/AbcSize
|
33
33
|
path = File.join directory, file
|
@@ -41,8 +41,8 @@ module Relaton
|
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "list", "List collections"
|
44
|
-
option :dir, aliases: :d, desc: "Directory with collections. Default
|
45
|
-
|
44
|
+
option :dir, aliases: :d, desc: "Directory with collections. Default " \
|
45
|
+
"is $HOME/.relaton/collections."
|
46
46
|
option :entries, aliases: :e, type: :boolean, desc: "Show entries"
|
47
47
|
|
48
48
|
def list
|
@@ -58,13 +58,13 @@ module Relaton
|
|
58
58
|
map ls: :list
|
59
59
|
|
60
60
|
desc "get CODE", "Fetch document from collection by ID"
|
61
|
-
option :collection, aliases: :c, desc: "Collection to fetch document. "\
|
61
|
+
option :collection, aliases: :c, desc: "Collection to fetch document. " \
|
62
62
|
"By default fetch the first match across all collections."
|
63
|
-
option :dir, aliases: :d, desc: "Directory with collections. Default
|
64
|
-
|
65
|
-
option :format, aliases: :f, desc: "Output format (xml, abb). "\
|
63
|
+
option :dir, aliases: :d, desc: "Directory with collections. Default " \
|
64
|
+
"is $HOME/.relaton/collections."
|
65
|
+
option :format, aliases: :f, desc: "Output format (xml, abb). " \
|
66
66
|
"If not defined the output in a human-readable form."
|
67
|
-
option :output, aliases: :o, desc: "Output to the specified file. The "\
|
67
|
+
option :output, aliases: :o, desc: "Output to the specified file. The " \
|
68
68
|
" file's extension (abb, xml) defines output format."
|
69
69
|
|
70
70
|
def get(docid)
|
@@ -79,10 +79,10 @@ module Relaton
|
|
79
79
|
end
|
80
80
|
|
81
81
|
desc "find TEXT", "Full-text search"
|
82
|
-
option :collection, aliases: :c, desc: "Collection to search text. "\
|
82
|
+
option :collection, aliases: :c, desc: "Collection to search text. " \
|
83
83
|
"By default search across all collections."
|
84
|
-
option :dir, aliases: :d, desc: "Directory with collections. Default is "\
|
85
|
-
|
84
|
+
option :dir, aliases: :d, desc: "Directory with collections. Default is " \
|
85
|
+
"$HOME/.relaton/collections."
|
86
86
|
|
87
87
|
def find(text)
|
88
88
|
collections.each do |col|
|
@@ -98,14 +98,14 @@ module Relaton
|
|
98
98
|
map search: :find
|
99
99
|
|
100
100
|
desc "fetch CODE", "Fetch a document and store it into a collection"
|
101
|
-
option :type, aliases: :t, required: true,
|
102
|
-
|
103
|
-
option :year, aliases: :y, type: :numeric,
|
104
|
-
|
105
|
-
option :collection, aliases: :c, required: true,
|
106
|
-
|
107
|
-
option :dir, aliases: :d, desc: "Directory with collections. Default is "\
|
108
|
-
|
101
|
+
option :type, aliases: :t, required: true,
|
102
|
+
desc: "Type of standard to get bibliographic entry for"
|
103
|
+
option :year, aliases: :y, type: :numeric,
|
104
|
+
desc: "Year the standard was published"
|
105
|
+
option :collection, aliases: :c, required: true,
|
106
|
+
desc: "Collection to store a document"
|
107
|
+
option :dir, aliases: :d, desc: "Directory with collections. Default is " \
|
108
|
+
"$HOME/.relaton/collections."
|
109
109
|
|
110
110
|
def fetch(code) # rubocop:disable Metrics/AbcSize
|
111
111
|
doc = Relaton.db.fetch(code, options[:year]&.to_s)
|
@@ -118,12 +118,13 @@ module Relaton
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
desc "import FILE", "Import document or collection from an XML file "\
|
122
|
-
|
123
|
-
option :collection, aliases: :c, required: true,
|
124
|
-
|
125
|
-
|
126
|
-
|
121
|
+
desc "import FILE", "Import document or collection from an XML file " \
|
122
|
+
"into another collection"
|
123
|
+
option :collection, aliases: :c, required: true,
|
124
|
+
desc: "Collection to store a document. If " \
|
125
|
+
"collection doesn't exist then it'll be created."
|
126
|
+
option :dir, aliases: :d, desc: "Directory with collections. Default is " \
|
127
|
+
"$HOME/.relaton/collections."
|
127
128
|
|
128
129
|
def import(file) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
129
130
|
collfile = File.join directory, options[:collection]
|
@@ -143,12 +144,12 @@ module Relaton
|
|
143
144
|
end
|
144
145
|
|
145
146
|
desc "export COLLECTION", "Export collection into XML file"
|
146
|
-
option :dir, aliases: :d, desc: "Directory with collections. Default is "\
|
147
|
-
|
147
|
+
option :dir, aliases: :d, desc: "Directory with collections. Default is " \
|
148
|
+
"$HOME/.relaton/collections."
|
148
149
|
|
149
150
|
def export(file)
|
150
151
|
coll = read_collection File.join(directory, file)
|
151
|
-
outfile = file.sub(/\.\w+$/,
|
152
|
+
outfile = "#{file.sub(/\.\w+$/, '')}.xml"
|
152
153
|
File.write outfile, coll.to_xml(bibdata: true), encoding: "UTF-8"
|
153
154
|
end
|
154
155
|
|
@@ -194,7 +195,7 @@ module Relaton
|
|
194
195
|
return unless options[:entries]
|
195
196
|
|
196
197
|
Relaton::Bibcollection.new(hash["root"]).items.each do |b|
|
197
|
-
puts "
|
198
|
+
puts " #{b.docidentifier}"
|
198
199
|
end
|
199
200
|
end
|
200
201
|
|
data/lib/relaton/cli/version.rb
CHANGED
data/relaton-cli.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "webmock"
|
37
37
|
|
38
38
|
spec.add_runtime_dependency "liquid", "~> 4"
|
39
|
-
spec.add_runtime_dependency "relaton", "~> 1.
|
39
|
+
spec.add_runtime_dependency "relaton", "~> 1.14.0"
|
40
40
|
spec.add_runtime_dependency "thor"
|
41
41
|
spec.add_runtime_dependency "thor-hollaback"
|
42
42
|
end
|
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: 1.
|
4
|
+
version: 1.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08
|
11
|
+
date: 2022-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
173
|
+
version: 1.14.0
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
180
|
+
version: 1.14.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: thor
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,7 +256,7 @@ homepage: https://github.com/metanorma/relaton-cli
|
|
256
256
|
licenses:
|
257
257
|
- BSD-2-Clause
|
258
258
|
metadata: {}
|
259
|
-
post_install_message:
|
259
|
+
post_install_message:
|
260
260
|
rdoc_options: []
|
261
261
|
require_paths:
|
262
262
|
- lib
|
@@ -271,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
|
-
rubygems_version: 3.
|
275
|
-
signing_key:
|
274
|
+
rubygems_version: 3.1.6
|
275
|
+
signing_key:
|
276
276
|
specification_version: 4
|
277
277
|
summary: Relaton Command-line Interface
|
278
278
|
test_files: []
|