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 +4 -4
- data/.github/workflows/macos.yml +27 -0
- data/.github/workflows/ubuntu.yml +27 -0
- data/.github/workflows/windows.yml +30 -0
- data/Gemfile.lock +2 -2
- data/lib/relaton/db.rb +6 -3
- data/lib/relaton/static_cache/version +1 -1
- data/lib/relaton/version.rb +1 -1
- data/relaton/cache/version +1 -1
- data/spec/relaton_spec.rb +27 -18
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2cdb7e20a0cd747ce7bfa12efcfff9cd0b23d16f5107740a7ea3b997edd8c66
|
4
|
+
data.tar.gz: f478d531b7ac76b43166a25b921582ddc4db510969569d605b48bd00f6f96fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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
|
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 += "
|
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
|
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.
|
1
|
+
0.5.11
|
data/lib/relaton/version.rb
CHANGED
data/relaton/cache/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
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
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
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.
|
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-
|
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"
|