relaton-iso 1.6.pre1 → 1.7.3

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: 9633da24028b24feabd31b81e93ee19e2af47994b26305d7c023aecc3ca9a090
4
- data.tar.gz: 910de158883fc2f7cff8c36c4d78cd44fdf7f6d0f215096e0375b4a96389dcff
3
+ metadata.gz: d4a259567ff58157c4e2ce7cdb42516a5b48c38c48c06cf6babc2793b5705a5f
4
+ data.tar.gz: af7e308f2ef935198c892373f34c848e6adc9927416213e2332b1ee8e61e4915
5
5
  SHA512:
6
- metadata.gz: 0d413b2093884a16461db0a7358835f2279d8b227f54469caaf5bd215fa9a270f419844678359471fa16c9d7968e0339177ce37326113ebb7b6e88bc933a1115
7
- data.tar.gz: 5c883c4a58a857589ad9019507a87e68a137b3df605bd24e3d21a563b0796e5c0f56981515ec72f46dd7769c6504178758c9abcc0640b0b960c2c7c9f00bd7f3
6
+ metadata.gz: fb095cb68470acb96d7b9af3cb1401102fcb20dcbe77202667e97be6351c28f935b46429d38682bd3d95f7a345e27e8c805fbdc71460b06c5510437e6485db5a
7
+ data.tar.gz: c0ff98be71df26db50efb60ba616905e654466d0d761ea20319c0629d84edeef2fc25d0cb2405aef58a61df1f1e6c5c50227cca60c9c2f6121b5c9cc2300d44e
@@ -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[^/]+) # match code
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
@@ -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
@@ -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.css(
228
- "li.dropdown.active span.stage-code > strong"
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.css("ul.steps li").reduce([]) do |a, r| # rubocop:disable Metrics/BlockLength
264
- r_type = r.css("strong").text
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
- '//span[@class="stage-date"][contains(., "-")]'
271
- ).last
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "1.6.pre1"
4
+ VERSION = "1.7.3"
5
5
  end
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.6.pre"
41
- spec.add_dependency "relaton-iso-bib", "~> 1.6.pre"
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.6.pre1
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-12 00:00:00.000000000 Z
11
+ date: 2021-03-18 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.6.pre
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.6.pre
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.6.pre
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.6.pre
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/macos.yml"
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
@@ -236,9 +207,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
207
  version: 2.4.0
237
208
  required_rubygems_version: !ruby/object:Gem::Requirement
238
209
  requirements:
239
- - - ">"
210
+ - - ">="
240
211
  - !ruby/object:Gem::Version
241
- version: 1.3.1
212
+ version: '0'
242
213
  requirements: []
243
214
  rubygems_version: 3.0.6
244
215
  signing_key:
@@ -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