relaton-cli 1.7.pre3 → 1.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6c0e11fa51a48417dd591d2835b2637a79f9a021e58f1f1fb6e818d12e90ac3
4
- data.tar.gz: da5753170d30401fab1a0b013a338ee3cd48da9d209a5ee17e83700f0999e59d
3
+ metadata.gz: 3d05ee41c481b709bb9d24b0336ad662322799482a7973cc6019c9b16d1c426f
4
+ data.tar.gz: 25ddc1e8025dd5cf36c3d1788f807d012f5a78522429e977bad281d4bac81f9e
5
5
  SHA512:
6
- metadata.gz: cee2b8248080c68d64cc58e780e0aa77ba0ad9bd06d6e42ce4e8eda81c639bb2e5dd301e177cad0bdc12f3bd7d588a7f2b7f1eab9c426d1c81e6ef53e66e61a4
7
- data.tar.gz: ed00bade15a250b8dcaa6d531c58ca1b979ad5a73175eb97a63593f1525ae62c4002f477e3bd84a717fdc571919e43f8021980c40d0e6dc9aba1282b050c6a51
6
+ metadata.gz: 2a6105a3cd8ce03c33035a19361755e5ed3dec1c26c4d0423309c56850be5d5ea0786d2e0c8fa59669a7a860df012d97f62a4585d15e8c2e896bdc3e491cc4bf
7
+ data.tar.gz: acfd92a715fe36a393f9dbd0c6cb0db0c3bee4dc5525c853948073bbe3ee8d91b1b58d43ee69fdc5ffc416e9fe78805dffdda21b9c0e8f624e9f548dd7a1aabf
@@ -0,0 +1,34 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: macos
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
10
+
11
+ jobs:
12
+ test-macos:
13
+ name: Test on Ruby ${{ matrix.ruby }} macOS
14
+ runs-on: macos-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ steps:
20
+ - uses: actions/checkout@master
21
+ - name: Use Ruby
22
+ uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ architecture: 'x64'
26
+ - name: Update gems
27
+ run: |
28
+ sudo gem install bundler --force
29
+ ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
30
+ ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
31
+ bundle install --jobs 4 --retry 3
32
+ - name: Run specs
33
+ run: |
34
+ bundle exec rake
@@ -0,0 +1,32 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: ubuntu
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
10
+
11
+ jobs:
12
+ test-linux:
13
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ steps:
20
+ - uses: actions/checkout@master
21
+ - name: Use Ruby
22
+ uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ architecture: 'x64'
26
+ - name: Update gems
27
+ run: |
28
+ gem install bundler
29
+ bundle install --jobs 4 --retry 3
30
+ - name: Run specs
31
+ run: |
32
+ bundle exec rake
@@ -0,0 +1,35 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: windows
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
10
+
11
+ jobs:
12
+ test-windows:
13
+ name: Test on Ruby ${{ matrix.ruby }} Windows
14
+ runs-on: windows-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ steps:
20
+ - uses: actions/checkout@master
21
+ - name: Use Ruby
22
+ uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ architecture: 'x64'
26
+ - name: Update gems
27
+ shell: pwsh
28
+ run: |
29
+ gem install bundler
30
+ bundle config --local path vendor/bundle
31
+ bundle update
32
+ bundle install --jobs 4 --retry 3
33
+ - name: Run specs
34
+ run: |
35
+ bundle exec rake
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ source "https://rubygems.org"
5
5
 
6
6
  # Specify your gem's dependencies in gemspec
7
7
  gemspec
8
+
data/docs/README.adoc CHANGED
@@ -1,7 +1,9 @@
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://github.com/relaton/relaton-cli/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-cli/actions?workflow=rake"]
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"]
5
7
  image:https://codeclimate.com/github/metanorma/relaton-cli/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-cli"]
6
8
 
7
9
  Documentation in development.
@@ -41,17 +43,14 @@ suports an additional `-x` or `--extension` options to use different extension.
41
43
 
42
44
  [source,console]
43
45
  ----
44
- $ relaton fetch CODE -t TYPE -f FORMAT -y YEAR -r RETRIES --all-parts --keep-year
46
+ $ relaton fetch CODE -t TYPE -f FORMAT -y YEAR
45
47
  ----
46
48
 
47
49
  Fetch the Relaton XML entry corresponding to the document identifier `CODE`.
48
50
 
49
51
  * `YEAR` is optional, and specifies the year of publication of the standard.
50
- * `FORMAT` is optional, and specifies the output format; the recognised values for `FORMAT` are `xml` (default), yaml, `bibtex`.
51
- * `TYPE` is optional, specifies the standards class library to be used, that the identifier is part of. The recognised values for `TYPE` are `BIPM`, `CC`, `CIE`, `CN`, `ECMA`, `IEC`, `IEEE`, `IETF`, `IHO`, `ISO`, `ITU`, `NIST`, `OGC`, `OMG`, `UN`, `W3C`.
52
- * `RETRIES` is optional, number of network retries (default 1).
53
- * `--all-parts` fetch all parts.
54
- * `--keep-year` undated reference should return actual reference with year.
52
+ * `FORMAT` is optional, and specifies the output format; the recognised values for `FORMAT` are `xml` (default), `bibtex`.
53
+ * `TYPE` specifies the standards class library to be used, that the identifier is part of. The recognised values for `TYPE` are `BIPM`, `CC`, `CN`, `IEC`, `IEEE`, `IETF`, `IHO`, `ISO`, `ITU`, `NIST`, `OGC`, `OMG`, `UN`, `W3C`.
55
54
 
56
55
  === relaton extract
57
56
 
@@ -307,108 +306,4 @@ $ relaton collection import FILE -c COLLECTION -d DIRECTORY
307
306
  Import document or collection from XML `FILE` into `COLLECTION`.
308
307
 
309
308
  * `COLLECTION` is optional. If collection doesn't exist then it will be created.
310
- * `DIRECTORY` is optional, and specifies path to a directory with collections. Default is `$HOME/.relaton/collections`.
311
-
312
- === Cache DB manipulation
313
-
314
- ==== Create caache DB
315
-
316
- ----
317
- $ relaton db create DIR
318
- ----
319
-
320
- Creates a new cache DB in a directory `DIR` (optional, deafult is `/home/USER/.relaton/dbpath`). In case the target directory exists it will be used as a cache DB.
321
-
322
- ----
323
- $ relaton db create
324
- Cache DB is in "/Users/user/.relaton/cache"
325
-
326
- $ relaton db create cachedb
327
- Cache DB is in "/Users/user/RubyProjects/relaton-cli/cachedb"
328
- ----
329
-
330
- ==== Move cache DB
331
-
332
- ----
333
- $ relaton db mv DIR
334
- ----
335
-
336
- Move cache DB to another place `DIR`.
337
-
338
- ----
339
- $ relaton db mv cache_dir
340
- Cache DB is moved to "/Users/user/RubyProjects/relaton-cli/cache_dir"
341
- ----
342
-
343
- ==== Clear cache DB
344
-
345
- Delete all entries from a chache DB.
346
-
347
- ----
348
- $ relaton db clear
349
- ----
350
-
351
- ==== Fetch from cache DB
352
-
353
- ----
354
- $ relaton db fetch -t TYPE -f FORMAT -y YEAR
355
- ----
356
-
357
- Fetch an entry from a cache DB. See [relaton fetch](#relaton-fetch) for the arguments explanation.
358
-
359
- ==== Fetch all
360
-
361
- Fetch all entries from a chache DB.
362
-
363
- ----
364
- $ relaton db fetch_all TEXT -e EDITION -y YEAR -f FORMAT
365
- ----
366
-
367
- * `TEXT` (optional) search for a certan string
368
- * `EDITION` (optional) filter documets with a certain edition
369
- * `YEAR` (optional) filter documents by a year
370
- * `FORMAT` (optional) specify the output format. Recognised values are `xml` (default), yaml, `bibtex`.
371
-
372
- ----
373
- $ relaton db fetch_all
374
- <bibitem id="ISO/IECDIR1" type="international-standard">
375
- ...
376
-
377
- $ relaton db fetch_all 'Procedures for the technical work'
378
- <bibitem id="ISO/IECDIR1" type="international-standard">
379
- <fetched>2021-04-01</fetched>
380
- <title type="title-main" format="text/plain" language="en" script="Latn">Procedures for the technical work</title>
381
- ...
382
-
383
- $ relaton db fetch_all -e 3
384
- <bibitem id="ISO2146-2010" type="standard">
385
- ...
386
- <edition>3</edition>
387
- ...
388
-
389
- $ relaton db fetch_all -e 8 -y 2018
390
- <bibitem id="ISO/IECDIR2IEC" type="international-standard">
391
- <fetched>2021-04-01</fetched>
392
- <title type="title-main" format="text/plain" language="en" script="Latn">Principles and rules for the structure and drafting of ISO and IEC documents</title>
393
- <uri type="obp">https://www.iec.ch/members_experts/refdocs/iec/isoiecdir2%7Bed8.0.RLV%7Den.pdf</uri>
394
- <docidentifier type="ISO">ISO/IEC DIR 2 IEC</docidentifier>
395
- <date type="published">
396
- <on>2018-05-01</on>
397
- </date>
398
- <edition>8</edition>
399
- ...
400
- ----
401
-
402
- ==== Get document type
403
-
404
- ----
405
- $ relaton db doctype REF
406
- ----
407
-
408
- Takes a reference `REF` and retuern a document type.
409
-
410
- ----
411
- $ relaton db doctype 'CN(GB/T 1.1)'
412
- Chinese Standard
413
- GB/T 1.1
414
- ----
309
+ * `DIRECTORY` is optional, and specifies path to a directory with collections. Default is `$HOME/.relaton/collections`.
@@ -2,29 +2,21 @@ require "relaton/cli/relaton_file"
2
2
  require "relaton/cli/xml_convertor"
3
3
  require "relaton/cli/yaml_convertor"
4
4
  require "relaton/cli/subcommand_collection"
5
- require "relaton/cli/subcommand_db"
6
5
  require "fcntl"
7
6
 
8
7
  module Relaton
9
8
  module Cli
10
9
  class Command < Thor
11
- include Relaton::Cli
12
-
13
10
  desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE"
14
- option :type, aliases: :t, desc: "Type of standard to "\
11
+ option :type, aliases: :t, required: true, desc: "Type of standard to "\
15
12
  "get bibliographic entry for"
16
- option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
13
+ option :format, aliases: :f, desc: "Output format (xml, bibtex). "\
17
14
  "Default xml."
18
15
  option :year, aliases: :y, type: :numeric, desc: "Year the standard was "\
19
16
  "published"
20
- option :"all-parts", type: :boolean, desc: "Fetch all parts"
21
- option :"keep-year", type: :boolean, desc: "Undated reference should "\
22
- "return actual reference with year"
23
- option :retries, aliases: :r, type: :numeric, desc: "Number of network "\
24
- "retries. Default 1."
25
17
 
26
18
  def fetch(code)
27
- # Relaton.db
19
+ Relaton.db
28
20
  io = IO.new(STDOUT.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
29
21
  io.puts(fetch_document(code, options) || supported_type_message)
30
22
  end
@@ -43,8 +35,8 @@ module Relaton
43
35
  option :title, aliases: :t, desc: "Title of resulting Relaton collection"
44
36
  option :organization, aliases: :g, desc: "Organization owner of Relaton "\
45
37
  "collection"
46
- # option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton "\
47
- # "YAML format"
38
+ option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton "\
39
+ "YAML format"
48
40
  option :extension, aliases: :x, desc: "File extension of destination "\
49
41
  "Relaton file, defaults to 'rxl'"
50
42
 
@@ -56,8 +48,8 @@ module Relaton
56
48
  "Relaton Collection into multiple files"
57
49
  option :extension, aliases: :x, default: "rxl", desc: "File extension "\
58
50
  "of Relaton XML files, defaults to 'rxl'"
59
- # option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton "\
60
- # "YAML format"
51
+ option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton "\
52
+ "YAML format"
61
53
 
62
54
  def split(source, outdir)
63
55
  Relaton::Cli::RelatonFile.split(source, outdir, options)
@@ -147,50 +139,34 @@ module Relaton
147
139
  desc "collection SUBCOMMAND", "Collection manipulations"
148
140
  subcommand "collection", SubcommandCollection
149
141
 
150
- desc "db SUBCOMMAND", "Cache DB manipulation"
151
- subcommand "db", SubcommandDb
152
- end
153
-
154
- private
155
-
156
- # @param code [String]
157
- # @param options [Hash]
158
- # @option options [String] :type
159
- # @option options [String, NilClass] :format
160
- # @option options [Integer, NilClass] :year
161
- # @return [String, nil]
162
- def fetch_document(code, options) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
163
- year = options[:year]&.to_s
164
- if (processor = Relaton::Registry.instance.by_type options[:type]&.upcase)
165
- doc = Relaton.db.fetch_std code, year, processor.short, options.dup
166
- elsif options[:type] then return
167
- else doc = Relaton.db.fetch(code, year, options.dup)
142
+ private
143
+
144
+ # @param code [String]
145
+ # @param options [Hash]
146
+ # @option options [String] :type
147
+ # @option options [String, NilClass] :format
148
+ # @option options [Integer, NilClass] :year
149
+ def fetch_document(code, options)
150
+ if registered_types.include?(options[:type])
151
+ doc = Cli.relaton.fetch(code, options[:year]&.to_s)
152
+ if doc
153
+ options[:format] == "bibtex" ? doc.to_bibtex : doc.to_xml
154
+ else
155
+ "No matching bibliographic entry found"
156
+ end
157
+ end
158
+ rescue RelatonBib::RequestError => e
159
+ e.message
168
160
  end
169
- return "No matching bibliographic entry found" unless doc
170
-
171
- serialize doc, options[:format]
172
- rescue RelatonBib::RequestError => e
173
- e.message
174
- end
175
161
 
176
- # @param doc [RelatonBib::BibliographicItem]
177
- # @param format [String]
178
- # @return [String]
179
- def serialize(doc, format)
180
- case format
181
- when "yaml", "yml" then doc.to_hash.to_yaml
182
- when "bibtex" then doc.to_bibtex
183
- else doc.to_xml
162
+ def supported_type_message
163
+ ["Recognised types:", registered_types.sort.join(", ")].join(" ")
184
164
  end
185
- end
186
-
187
- def supported_type_message
188
- ["Recognised types:", registered_types.sort.join(", ")].join(" ")
189
- end
190
165
 
191
- def registered_types
192
- @registered_types ||=
193
- Relaton::Registry.instance.processors.each.map { |_n, pr| pr.prefix }
166
+ def registered_types
167
+ @registered_types ||=
168
+ Relaton::Registry.instance.processors.each.map { |_n, pr| pr.prefix }
169
+ end
194
170
  end
195
171
  end
196
172
  end
@@ -150,7 +150,7 @@ module Relaton
150
150
  mem << bibdata_instance(doc, xml[:file])
151
151
  else mem
152
152
  end
153
- end
153
+ end.uniq &:id
154
154
  end
155
155
 
156
156
  def concatenate_and_write_to_files
@@ -105,13 +105,13 @@ module Relaton
105
105
  "$HOME/.relaton/collections."
106
106
 
107
107
  def fetch(code)
108
- doc = Relaton.db.fetch(code, options[:year]&.to_s)
108
+ doc = Cli.relaton.fetch(code, options[:year]&.to_s)
109
109
  if doc
110
110
  colfile = File.join directory, options[:collection]
111
111
  coll = read_collection colfile
112
112
  coll << doc
113
113
  File.write colfile, coll.to_yaml, encoding: "UTF-8"
114
- else warn "No matching bibliographic entry found"
114
+ else "No matching bibliographic entry found"
115
115
  end
116
116
  end
117
117
 
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cli
3
- VERSION = "1.7.pre3".freeze
3
+ VERSION = "1.7.0".freeze
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ module Relaton::Cli
32
32
  # @param options [Hash]
33
33
  # @return [String] HTML
34
34
  def self.render(file, options)
35
- new(**options).render(file)
35
+ new(options).render(file)
36
36
  end
37
37
 
38
38
  private
@@ -37,7 +37,7 @@ module Relaton
37
37
  processor.hash_to_bib content
38
38
  else
39
39
  RelatonBib::BibliographicItem.new(
40
- **RelatonBib::HashConverter::hash_to_bib(content)
40
+ RelatonBib::HashConverter::hash_to_bib(content)
41
41
  )
42
42
  end
43
43
  end
data/lib/relaton/cli.rb CHANGED
@@ -3,35 +3,16 @@ require "relaton"
3
3
  require_relative "cli/command"
4
4
 
5
5
  module Relaton
6
- def self.db(dir = nil)
7
- Cli.relaton dir
6
+ def self.db
7
+ Cli.relaton
8
8
  end
9
9
 
10
10
  module Cli
11
11
  class RelatonDb
12
12
  include Singleton
13
13
 
14
- DBCONF = "#{Dir.home}/.relaton/dbpath".freeze
15
-
16
- # @param dir [String, nil]
17
- # @return [Relaton::Db]
18
- def db(dir)
19
- if dir
20
- File.write DBCONF, dir, encoding: "UTF-8"
21
- @db = Relaton::Db.new dir, nil
22
- else
23
- @db ||= Relaton::Db.new dbpath, nil
24
- end
25
- end
26
-
27
- private
28
-
29
- # @return [String] path to DB
30
- def dbpath
31
- if File.exist?(DBCONF)
32
- File.read(DBCONF, encoding: "UTF-8")
33
- else "#{Dir.home}/.relaton/cache"
34
- end
14
+ def db
15
+ @db ||= Relaton::Db.new("#{Dir.home}/.relaton/cache", nil)
35
16
  end
36
17
  end
37
18
 
@@ -47,10 +28,8 @@ module Relaton
47
28
  # easier we have added it as a class method so we can use this
48
29
  # whenever necessary.
49
30
  #
50
- # @param dir [String, nil]
51
- # @return [Relaton::Db]
52
- def relaton(dir)
53
- RelatonDb.instance.db dir
31
+ def relaton
32
+ RelatonDb.instance.db
54
33
  end
55
34
 
56
35
  # @param content [Nokogiri::XML::Document]
data/relaton-cli.gemspec CHANGED
@@ -23,19 +23,20 @@ Gem::Specification.new do |spec|
23
23
  spec.required_ruby_version = ">= 2.4.0"
24
24
 
25
25
  spec.add_development_dependency "byebug", "~> 11.0"
26
- # spec.add_development_dependency "debase"
26
+ spec.add_development_dependency "debase"
27
27
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
28
28
  spec.add_development_dependency "pry"
29
- spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rake", "~> 12.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
  spec.add_development_dependency "rspec-command", "~> 1.0.3"
32
32
  spec.add_development_dependency "rspec-core", "~> 3.4"
33
- # spec.add_development_dependency "ruby-debug-ide"
33
+ spec.add_development_dependency "ruby-debug-ide"
34
34
  spec.add_development_dependency "simplecov"
35
35
  spec.add_development_dependency "vcr"
36
36
  spec.add_development_dependency "webmock"
37
37
 
38
- spec.add_runtime_dependency "liquid", "~> 4"
39
- spec.add_runtime_dependency "relaton", "1.7.pre7"
38
+ spec.add_runtime_dependency "liquid"
39
+ spec.add_runtime_dependency "relaton", "~> 1.7.0"
40
40
  spec.add_runtime_dependency "thor"
41
+ # spec.add_runtime_dependency 'byebug'
41
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.7.pre3
4
+ version: 1.7.0
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-04-01 00:00:00.000000000 Z
11
+ date: 2020-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '11.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: debase
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: equivalent-xml
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +70,16 @@ dependencies:
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: '12.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: '12.0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,20 @@ dependencies:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: '3.4'
125
+ - !ruby/object:Gem::Dependency
126
+ name: ruby-debug-ide
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: simplecov
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -154,30 +182,30 @@ dependencies:
154
182
  name: liquid
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
- - - "~>"
185
+ - - ">="
158
186
  - !ruby/object:Gem::Version
159
- version: '4'
187
+ version: '0'
160
188
  type: :runtime
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
- - - "~>"
192
+ - - ">="
165
193
  - !ruby/object:Gem::Version
166
- version: '4'
194
+ version: '0'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: relaton
169
197
  requirement: !ruby/object:Gem::Requirement
170
198
  requirements:
171
- - - '='
199
+ - - "~>"
172
200
  - !ruby/object:Gem::Version
173
- version: 1.7.pre7
201
+ version: 1.7.0
174
202
  type: :runtime
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
- - - '='
206
+ - - "~>"
179
207
  - !ruby/object:Gem::Version
180
- version: 1.7.pre7
208
+ version: 1.7.0
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: thor
183
211
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +230,9 @@ extra_rdoc_files:
202
230
  - docs/README.adoc
203
231
  - LICENSE
204
232
  files:
205
- - ".github/workflows/rake.yml"
233
+ - ".github/workflows/macos.yml"
234
+ - ".github/workflows/ubuntu.yml"
235
+ - ".github/workflows/windows.yml"
206
236
  - ".gitignore"
207
237
  - ".hound.yml"
208
238
  - ".rspec"
@@ -226,7 +256,6 @@ files:
226
256
  - lib/relaton/cli/full_text_search.rb
227
257
  - lib/relaton/cli/relaton_file.rb
228
258
  - lib/relaton/cli/subcommand_collection.rb
229
- - lib/relaton/cli/subcommand_db.rb
230
259
  - lib/relaton/cli/version.rb
231
260
  - lib/relaton/cli/xml_convertor.rb
232
261
  - lib/relaton/cli/xml_to_html_renderer.rb
@@ -251,11 +280,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
280
  version: 2.4.0
252
281
  required_rubygems_version: !ruby/object:Gem::Requirement
253
282
  requirements:
254
- - - ">"
283
+ - - ">="
255
284
  - !ruby/object:Gem::Version
256
- version: 1.3.1
285
+ version: '0'
257
286
  requirements: []
258
- rubygems_version: 3.2.3
287
+ rubygems_version: 3.0.6
259
288
  signing_key:
260
289
  specification_version: 4
261
290
  summary: Relaton Command-line Interface
@@ -1,46 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: rake
4
-
5
- on:
6
- push:
7
- branches: [ master, main ]
8
- tags: [ v* ]
9
- pull_request:
10
-
11
- jobs:
12
- rake:
13
- name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- continue-on-error: ${{ matrix.experimental }}
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
- os: [ ubuntu-latest, windows-latest, macos-latest ]
21
- experimental: [ false ]
22
- include:
23
- - ruby: '3.0'
24
- os: 'ubuntu-latest'
25
- experimental: true
26
- - ruby: '3.0'
27
- os: 'windows-latest'
28
- experimental: true
29
- - ruby: '3.0'
30
- os: 'macos-latest'
31
- experimental: true
32
- steps:
33
- - uses: actions/checkout@v2
34
- with:
35
- submodules: true
36
-
37
- # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
38
- - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
39
- run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
40
-
41
- - uses: ruby/setup-ruby@v1
42
- with:
43
- ruby-version: ${{ matrix.ruby }}
44
- bundler-cache: true
45
-
46
- - run: bundle exec rake
@@ -1,73 +0,0 @@
1
- module Relaton
2
- module Cli
3
- class SubcommandDb < Thor
4
- include Relaton::Cli
5
-
6
- desc "create DIR", "Create new cache DB. Default DIR is "\
7
- "/home/user/.relaon/cache/"
8
-
9
- def create(dir = nil)
10
- db = Relaton.db (dir && File.expand_path(dir))
11
- path = db.instance_variable_get(:@db).dir
12
- warn "Cache DB is in \"#{path}\""
13
- end
14
-
15
- desc "mv DIR", "Move cache DB to a new directory"
16
-
17
- def mv(dir)
18
- new_path = File.expand_path dir
19
- path = Relaton.db.mv new_path
20
- if path
21
- File.write Cli::RelatonDb::DBCONF, path, encoding: "UTF-8"
22
- warn "Cache DB is moved to \"#{path}\""
23
- end
24
- end
25
-
26
- desc "clear", "Clear cache DB"
27
-
28
- def clear
29
- Relaton.db.clear
30
- warn "Cache DB is cleared"
31
- end
32
-
33
- desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE from "\
34
- "cache DB"
35
- option :type, aliases: :t, desc: "Type of standard to "\
36
- "get bibliographic entry for"
37
- option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
38
- "Default xml."
39
- option :year, aliases: :y, type: :numeric, desc: "Year the standard was "\
40
- "published"
41
-
42
- def fetch(code)
43
- io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
44
- opts = options.merge(fetch_db: true)
45
- io.puts(fetch_document(code, opts) || supported_type_message)
46
- end
47
-
48
- desc "fetch_all TEXT", "Query for all documents in a cache DB for a "\
49
- "certain string"
50
- option :edition, aliases: :e, desc: "Filter entries by edition"
51
- option :year, aliases: :y, desc: "Filter entries by year"
52
- option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
53
- "Default xml."
54
-
55
- def fetch_all(text = nil) # rubocop:disable Metrics/AbcSize
56
- io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
57
- opts = options.each_with_object({}) do |(k, v), o|
58
- o[k.to_sym] = v unless k == "format"
59
- end
60
- Relaton.db.fetch_all(text, **opts).each do |doc|
61
- io.puts serialize(doc, options[:format])
62
- end
63
- end
64
-
65
- desc "doctype REF", "Detect document type from REF"
66
-
67
- def doctype(ref)
68
- io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
69
- io.puts Relaton.db.docid_type(ref)
70
- end
71
- end
72
- end
73
- end