relaton 0.5.10 → 0.5.11

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: 62cef7ae686de32684c5f0f7c75c6df634efc4445fe59ce306de4c3c6d21882d
4
- data.tar.gz: 8a263e312bdbb73e56ce891c1d9c3d9b03ac81def88a328bf3a8ee5ced4b3101
3
+ metadata.gz: f2cdb7e20a0cd747ce7bfa12efcfff9cd0b23d16f5107740a7ea3b997edd8c66
4
+ data.tar.gz: f478d531b7ac76b43166a25b921582ddc4db510969569d605b48bd00f6f96fe2
5
5
  SHA512:
6
- metadata.gz: b53e3d71749b14d51c168315ab65314c03d3dc07758fe158fa1d8963ec41ddcfe8cc2b920ae1c42aa8aa94978b4d0f6c23fa5448981aa4de1d1885441b6676e9
7
- data.tar.gz: '085835618cb8c17d09f710bf418a88932a44734b978889f1ce3a468b6a98afdbc5b37260c56e01b1983a90a0182eb15a91d8572aec84b339b761bd6ab47532e0'
6
+ metadata.gz: 2154ea82ecaf7f66cf304fba55ef92814d96a7522d45d7f509caeabde9f5b3da73448c434f9722af45c87f7d18249ed304a8442a5baf9695273914ec9cdf47c0
7
+ data.tar.gz: 68c3e37b5e3960400c21f28e9abe046425cd011d235702bd5e525041f5406a5882b3535653cd3fdd6722586d82c6485dc5d6526ef274bd9993d58d53c5816dca
@@ -0,0 +1,27 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: macos
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-macos:
9
+ name: Test on Ruby ${{ matrix.ruby }} macOS
10
+ runs-on: macos-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ run: |
23
+ sudo gem install bundler -v "~> 2" --force
24
+ bundle install --jobs 4 --retry 3
25
+ - name: Run specs
26
+ run: |
27
+ bundle exec rake
@@ -0,0 +1,27 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: ubuntu
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-linux:
9
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ run: |
23
+ gem install bundler -v "~> 2"
24
+ bundle install --jobs 4 --retry 3
25
+ - name: Run specs
26
+ run: |
27
+ bundle exec rake
@@ -0,0 +1,30 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: windows
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-windows:
9
+ name: Test on Ruby ${{ matrix.ruby }} Windows
10
+ runs-on: windows-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ shell: pwsh
23
+ run: |
24
+ gem install bundler -v "~> 2"
25
+ bundle config --local path vendor/bundle
26
+ bundle update
27
+ bundle install --jobs 4 --retry 3
28
+ - name: Run specs
29
+ run: |
30
+ bundle exec rake
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton (0.5.10)
4
+ relaton (0.5.11)
5
5
  relaton-calconnect (~> 0.1.0)
6
6
  relaton-gb (~> 0.6.0)
7
7
  relaton-iec (~> 0.4.0)
@@ -94,7 +94,7 @@ GEM
94
94
  relaton-iec (0.4.10)
95
95
  addressable
96
96
  relaton-iso-bib (~> 0.3.0)
97
- relaton-ietf (0.6.8)
97
+ relaton-ietf (0.6.9)
98
98
  relaton-bib (~> 0.3.0)
99
99
  relaton-iso (0.6.9)
100
100
  relaton-iec (~> 0.4.0)
data/lib/relaton/db.rb CHANGED
@@ -97,7 +97,10 @@ module Relaton
97
97
  allowed = @registry.processors.reduce([]) do |m, (_k, v)|
98
98
  m << v.prefix
99
99
  end
100
- warn "#{code} does not have a recognised prefix: #{allowed.join(', ')}"
100
+ warn <<~WARN
101
+ #{code} does not have a recognised prefix: #{allowed.join(', ')}.
102
+ See https://github.com/relaton/relaton/ for instructions on prefixing and wrapping document identifiers to disambiguate them.
103
+ WARN
101
104
  end
102
105
 
103
106
  # TODO: i18n
@@ -110,7 +113,7 @@ module Relaton
110
113
  def std_id(code, year, opts, stdclass)
111
114
  prefix, code = strip_id_wrapper(code, stdclass)
112
115
  ret = code
113
- ret += ":#{year}" if year
116
+ ret += (stdclass == :relaton_gb ? "-" : ":") + year if year
114
117
  ret += " (all parts)" if opts[:all_parts]
115
118
  ["#{prefix}(#{ret.strip})", code]
116
119
  end
@@ -175,7 +178,7 @@ module Relaton
175
178
  # @return [String]
176
179
  def new_bib_entry(code, year, opts, stdclass, **args)
177
180
  bib = @registry.processors[stdclass].get(code, year, opts)
178
- bib_id = bib&.docidentifier&.first&.id&.sub(%r{(?<=\d)-(?=\d{4})}, ":")
181
+ bib_id = bib&.docidentifier&.first&.id
179
182
 
180
183
  # when docid doesn't match bib's id then return a reference to bib's id
181
184
  if args[:db] && args[:id] && bib_id && args[:id] !~ %r{\(#{bib_id}\)}
@@ -1 +1 @@
1
- 0.5.10
1
+ 0.5.11
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "0.5.10".freeze
2
+ VERSION = "0.5.11".freeze
3
3
  end
@@ -1 +1 @@
1
- 0.5.10
1
+ 0.5.11
data/spec/relaton_spec.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  RSpec.describe Relaton::Db do
2
- # let!(:db) { Relaton::Db.new("testcache", "testcache2") }
3
-
4
2
  before :each do
5
3
  FileUtils.rm_rf %w(testcache testcache2)
6
4
  @db = Relaton::Db.new "testcache", "testcache2"
@@ -12,7 +10,6 @@ RSpec.describe Relaton::Db do
12
10
 
13
11
  context "gets an ISO reference" do
14
12
  it "and caches it" do
15
- # stub_bib Isobib::IsoBibliography
16
13
  VCR.use_cassette "iso_19115_1" do
17
14
  bib = @db.fetch("ISO 19115-1", nil, {})
18
15
  expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
@@ -70,7 +67,6 @@ RSpec.describe Relaton::Db do
70
67
  end
71
68
 
72
69
  it "deals with a non-existant ISO reference" do
73
- # stub_bib Isobib::IsoBibliography
74
70
  VCR.use_cassette "iso_111111119115_1" do
75
71
  bib = @db.fetch("ISO 111111119115-1", nil, {})
76
72
  expect(bib).to be_nil
@@ -86,7 +82,6 @@ RSpec.describe Relaton::Db do
86
82
  end
87
83
 
88
84
  it "list all elements as a serialization" do
89
- # stub_bib Isobib::IsoBibliography, 2
90
85
  VCR.use_cassette "iso_19115_1_2", match_requests_on: [:path] do
91
86
  @db.fetch "ISO 19115-1", nil, {}
92
87
  @db.fetch "ISO 19115-2", nil, {}
@@ -110,23 +105,37 @@ RSpec.describe Relaton::Db do
110
105
  expect(@db.load_entry("test key")).to be_nil
111
106
  end
112
107
 
113
- it "get GB reference and cache it" do
114
- # stub_bib Gbbib::GbBibliography
115
- VCR.use_cassette "gb_t_20223_2006" do
116
- bib = @db.fetch "CN(GB/T 20223)", "2006", {}
117
- expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
118
- expect(bib.to_xml(bibdata: true)).to include "<project-number>GB/T 20223</project-number>"
119
- expect(File.exist?("testcache")).to be true
120
- expect(File.exist?("testcache2")).to be true
121
- testcache = Relaton::DbCache.new "testcache"
122
- expect(testcache["CN(GB/T 20223:2006)"]).to include "<project-number>GB/T 20223</project-number>"
123
- testcache = Relaton::DbCache.new "testcache2"
124
- expect(testcache["CN(GB/T 20223:2006)"]).to include "<project-number>GB/T 20223</project-number>"
108
+ context "get GB reference" do
109
+ it "and cache it" do
110
+ VCR.use_cassette "gb_t_20223_2006" do
111
+ bib = @db.fetch "CN(GB/T 20223)", "2006", {}
112
+ expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
113
+ expect(bib.to_xml(bibdata: true)).to include "<project-number>GB/T 20223</project-number>"
114
+ expect(File.exist?("testcache")).to be true
115
+ expect(File.exist?("testcache2")).to be true
116
+ testcache = Relaton::DbCache.new "testcache"
117
+ expect(testcache["CN(GB/T 20223:2006)"]).to include "<project-number>GB/T 20223</project-number>"
118
+ testcache = Relaton::DbCache.new "testcache2"
119
+ expect(testcache["CN(GB/T 20223:2006)"]).to include "<project-number>GB/T 20223</project-number>"
120
+ end
121
+ end
122
+
123
+ it "with year" do
124
+ VCR.use_cassette "gb_t_20223_2006" do
125
+ bib = @db.fetch "CN(GB/T 20223-2006)", nil, {}
126
+ expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
127
+ expect(bib.to_xml(bibdata: true)).to include "<project-number>GB/T 20223</project-number>"
128
+ expect(File.exist?("testcache")).to be true
129
+ expect(File.exist?("testcache2")).to be true
130
+ testcache = Relaton::DbCache.new "testcache"
131
+ expect(testcache["CN(GB/T 20223:2006)"]).to include "<project-number>GB/T 20223</project-number>"
132
+ testcache = Relaton::DbCache.new "testcache2"
133
+ expect(testcache["CN(GB/T 20223:2006)"]).to include "<project-number>GB/T 20223</project-number>"
134
+ end
125
135
  end
126
136
  end
127
137
 
128
138
  it "get RFC reference and cache it" do
129
- # stub_bib IETFBib::RfcBibliography
130
139
  VCR.use_cassette "rfc_8341" do
131
140
  bib = @db.fetch "RFC 8341", nil, {}
132
141
  expect(bib).to be_instance_of RelatonIetf::IetfBibliographicItem
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-01 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton-calconnect
@@ -344,6 +344,9 @@ executables: []
344
344
  extensions: []
345
345
  extra_rdoc_files: []
346
346
  files:
347
+ - ".github/workflows/macos.yml"
348
+ - ".github/workflows/ubuntu.yml"
349
+ - ".github/workflows/windows.yml"
347
350
  - ".gitignore"
348
351
  - ".hound.yml"
349
352
  - ".rspec"