relaton-iso 1.6.0 → 1.7.4
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 +46 -0
- data/bin/racc +29 -0
- data/lib/relaton_iso/hit_collection.rb +3 -3
- data/lib/relaton_iso/iso_bibliography.rb +1 -1
- data/lib/relaton_iso/processor.rb +7 -1
- data/lib/relaton_iso/scrapper.rb +9 -16
- data/lib/relaton_iso/version.rb +1 -1
- data/relaton_iso.gemspec +4 -4
- metadata +9 -38
- data/.github/workflows/macos.yml +0 -34
- data/.github/workflows/ubuntu.yml +0 -32
- data/.github/workflows/windows.yml +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 285f112d9488263e9befd0b7cf1edc555be821457c5704a96b4619c3d0140bce
|
4
|
+
data.tar.gz: 71425bbdfcea77012c480e000787c55084380816adb627d51f61d3335b6e64a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 488b4d385f6a18c9e5cf8199e71b8d5a9a10e1068959f98c789ffaf95d634b12c68baaad64d7145236b379f2f103e44ee2958c8091d0312d97d67d5f378fac0b
|
7
|
+
data.tar.gz: 8a1ba31f5b5b809edc081eade7b9c142d4a33b74768f5eca38c92312e48745dcc6022df491a06c3fe7ee93a544022c113ee733a403940f297d3ed63b400a9405
|
@@ -0,0 +1,46 @@
|
|
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
|
data/bin/racc
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'racc' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("racc", "racc")
|
@@ -33,7 +33,7 @@ module RelatonIso
|
|
33
33
|
|
34
34
|
# @param lang [String, NilClass]
|
35
35
|
# @return [RelatonIsoBib::IsoBibliographicItem]
|
36
|
-
def to_all_parts(lang = nil)
|
36
|
+
def to_all_parts(lang = nil) # rubocop:disable Metrics/CyclomaticComplexity
|
37
37
|
parts = @array.reject { |h| h.hit["docPart"]&.empty? }
|
38
38
|
hit = parts.min_by { |h| h.hit["docPart"].to_i }
|
39
39
|
return @array.first.fetch lang unless hit
|
@@ -42,10 +42,10 @@ module RelatonIso
|
|
42
42
|
all_parts_item = bibitem.to_all_parts
|
43
43
|
parts.reject { |h| h.hit["docRef"] == hit.hit["docRef"] }.each do |hi|
|
44
44
|
isobib = RelatonIsoBib::IsoBibliographicItem.new(
|
45
|
-
formattedref: RelatonBib::FormattedRef.new(content: hi.hit["docRef"])
|
45
|
+
formattedref: RelatonBib::FormattedRef.new(content: hi.hit["docRef"])
|
46
46
|
)
|
47
47
|
all_parts_item.relation << RelatonBib::DocumentRelation.new(
|
48
|
-
type: "instance", bibitem: isobib
|
48
|
+
type: "instance", bibitem: isobib
|
49
49
|
)
|
50
50
|
end
|
51
51
|
all_parts_item
|
@@ -29,7 +29,7 @@ module RelatonIso
|
|
29
29
|
opts[:ref] = ref.gsub(/\u2013/, "-")
|
30
30
|
|
31
31
|
%r{
|
32
|
-
^(?<code1>[^\s]+\s[
|
32
|
+
^(?<code1>[^\s]+\s[^\/]+) # match code
|
33
33
|
/?
|
34
34
|
(?<corr>(Amd|DAmd|(CD|WD|AWI|NP)\sAmd|Cor|CD\sCor|FDAmd|PRF\sAmd)\s\d+ # correction name
|
35
35
|
:?(\d{4})?(/Cor\s\d+:\d{4})?) # match correction year
|
@@ -29,7 +29,7 @@ module RelatonIso
|
|
29
29
|
# @return [RelatonIsoBib::IsoBibliographicItem]
|
30
30
|
def hash_to_bib(hash)
|
31
31
|
item_hash = ::RelatonIsoBib::HashConverter.hash_to_bib(hash)
|
32
|
-
::RelatonIsoBib::IsoBibliographicItem.new item_hash
|
32
|
+
::RelatonIsoBib::IsoBibliographicItem.new **item_hash
|
33
33
|
end
|
34
34
|
|
35
35
|
# Returns hash of XML grammar
|
@@ -37,5 +37,11 @@ module RelatonIso
|
|
37
37
|
def grammar_hash
|
38
38
|
@grammar_hash ||= ::RelatonIsoBib.grammar_hash
|
39
39
|
end
|
40
|
+
|
41
|
+
# Returns number of workers
|
42
|
+
# @return [Integer]
|
43
|
+
def threads
|
44
|
+
3
|
45
|
+
end
|
40
46
|
end
|
41
47
|
end
|
data/lib/relaton_iso/scrapper.rb
CHANGED
@@ -224,9 +224,8 @@ module RelatonIso
|
|
224
224
|
# @param status [String]
|
225
225
|
# @return [Hash]
|
226
226
|
def fetch_status(doc)
|
227
|
-
stg, substg = doc.
|
228
|
-
|
229
|
-
).text.split "."
|
227
|
+
stg, substg = doc.at("//ul[@class='dropdown-menu']/li[@class='active']/a/span[@class='stage-code']")
|
228
|
+
.text.split "."
|
230
229
|
RelatonBib::DocumentStatus.new(stage: stg, substage: substg)
|
231
230
|
end
|
232
231
|
|
@@ -260,20 +259,15 @@ module RelatonIso
|
|
260
259
|
# @param doc [Nokogiri::HTML::Document]
|
261
260
|
# @return [Array<Hash>]
|
262
261
|
def fetch_relations(doc) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
263
|
-
doc.
|
264
|
-
r_type = r.
|
262
|
+
doc.xpath("//ul[@class='steps']/li", "//div[@class='sub-step']").reduce([]) do |a, r|
|
263
|
+
r_type = r.at("h4", "h5").text
|
265
264
|
date = []
|
266
265
|
type = case r_type
|
267
266
|
when "Previously", "Will be replaced by" then "obsoletes"
|
268
|
-
when "Corrigenda/Amendments", "Revised by", "Now confirmed"
|
269
|
-
on = doc.xpath(
|
270
|
-
|
271
|
-
|
272
|
-
if on
|
273
|
-
date << { type: "circulated",
|
274
|
-
on: on.text }
|
275
|
-
"updates"
|
276
|
-
end
|
267
|
+
when "Corrigenda / Amendments", "Revised by", "Now confirmed"
|
268
|
+
on = doc.xpath('//span[@class="stage-date"][contains(., "-")]').last
|
269
|
+
date << { type: "circulated", on: on.text } if on
|
270
|
+
"updates"
|
277
271
|
else r_type
|
278
272
|
end
|
279
273
|
if ["Now", "Now under review"].include?(type) then a
|
@@ -408,8 +402,7 @@ module RelatonIso
|
|
408
402
|
owner_name = ref.match(/.*?(?=\s)/).to_s
|
409
403
|
from = ref.match(/(?<=:)\d{4}/).to_s
|
410
404
|
if from.empty?
|
411
|
-
from = doc.xpath("//span[@itemprop='releaseDate']").text
|
412
|
-
.match(/\d{4}/).to_s
|
405
|
+
from = doc.xpath("//span[@itemprop='releaseDate']").text.match(/\d{4}/).to_s
|
413
406
|
end
|
414
407
|
[{ owner: [{ name: owner_name }], from: from }]
|
415
408
|
end
|
data/lib/relaton_iso/version.rb
CHANGED
data/relaton_iso.gemspec
CHANGED
@@ -27,16 +27,16 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
28
28
|
|
29
29
|
spec.add_development_dependency "byebug"
|
30
|
-
spec.add_development_dependency "debase"
|
30
|
+
# spec.add_development_dependency "debase"
|
31
31
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
32
32
|
spec.add_development_dependency "pry-byebug"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
-
spec.add_development_dependency "ruby-debug-ide"
|
35
|
+
# spec.add_development_dependency "ruby-debug-ide"
|
36
36
|
spec.add_development_dependency "simplecov"
|
37
37
|
spec.add_development_dependency "vcr"
|
38
38
|
spec.add_development_dependency "webmock"
|
39
39
|
|
40
|
-
spec.add_dependency "relaton-iec", "~> 1.
|
41
|
-
spec.add_dependency "relaton-iso-bib", "~> 1.
|
40
|
+
spec.add_dependency "relaton-iec", "~> 1.7.0"
|
41
|
+
spec.add_dependency "relaton-iso-bib", "~> 1.7.0"
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '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'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: equivalent-xml
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,20 +80,6 @@ dependencies:
|
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '3.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: ruby-debug-ide
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: simplecov
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,28 +128,28 @@ dependencies:
|
|
156
128
|
requirements:
|
157
129
|
- - "~>"
|
158
130
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
131
|
+
version: 1.7.0
|
160
132
|
type: :runtime
|
161
133
|
prerelease: false
|
162
134
|
version_requirements: !ruby/object:Gem::Requirement
|
163
135
|
requirements:
|
164
136
|
- - "~>"
|
165
137
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
138
|
+
version: 1.7.0
|
167
139
|
- !ruby/object:Gem::Dependency
|
168
140
|
name: relaton-iso-bib
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
170
142
|
requirements:
|
171
143
|
- - "~>"
|
172
144
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
145
|
+
version: 1.7.0
|
174
146
|
type: :runtime
|
175
147
|
prerelease: false
|
176
148
|
version_requirements: !ruby/object:Gem::Requirement
|
177
149
|
requirements:
|
178
150
|
- - "~>"
|
179
151
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
152
|
+
version: 1.7.0
|
181
153
|
description: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
|
182
154
|
model'
|
183
155
|
email:
|
@@ -186,9 +158,7 @@ executables: []
|
|
186
158
|
extensions: []
|
187
159
|
extra_rdoc_files: []
|
188
160
|
files:
|
189
|
-
- ".github/workflows/
|
190
|
-
- ".github/workflows/ubuntu.yml"
|
191
|
-
- ".github/workflows/windows.yml"
|
161
|
+
- ".github/workflows/rake.yml"
|
192
162
|
- ".gitignore"
|
193
163
|
- ".hound.yml"
|
194
164
|
- ".rspec"
|
@@ -208,6 +178,7 @@ files:
|
|
208
178
|
- bin/ldiff
|
209
179
|
- bin/nokogiri
|
210
180
|
- bin/pry
|
181
|
+
- bin/racc
|
211
182
|
- bin/rake
|
212
183
|
- bin/rdebug-ide
|
213
184
|
- bin/rspec
|
@@ -240,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
211
|
- !ruby/object:Gem::Version
|
241
212
|
version: '0'
|
242
213
|
requirements: []
|
243
|
-
rubygems_version: 3.
|
214
|
+
rubygems_version: 3.2.3
|
244
215
|
signing_key:
|
245
216
|
specification_version: 4
|
246
217
|
summary: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
|
data/.github/workflows/macos.yml
DELETED
@@ -1,34 +0,0 @@
|
|
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
|
@@ -1,32 +0,0 @@
|
|
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
|
@@ -1,35 +0,0 @@
|
|
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
|