relaton-nist 0.5.1 → 0.6.0

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: 84efea59e2f35758f44b21e42574ebc3bfbda66f95d7d1c905ae645d42d55711
4
- data.tar.gz: c58d8aa8f2bc6da70c04793d196f90b4b5a0ab7868b97f7ef17fc3df3ff5f17b
3
+ metadata.gz: 7e3fe0082c96d14813be5f97e804a0a18388dddef792c2a568f1c8eafbe2ab3e
4
+ data.tar.gz: e17bcac5fbf0a88421e0ad1f323df1757a5d3ef0d2afe340dac1b129a873bbb7
5
5
  SHA512:
6
- metadata.gz: 22d62f0a3a04d03efa7ca6bf2f8d2dda988da7346fac312ac58d43998a712f9bd35bf2481f2a6aebfd4507dcc4b6e8d9f75bc10de0fd51e5e2e9f22edeeecad2
7
- data.tar.gz: 8193871dba1c5c64ba39839ed38eb34632c653ef55daf4e6850a5d4fe73446af64d27fd7eb2170ed73d0b79efb96ddbb8fee37871b986422b4ea0c1586157b7d
6
+ metadata.gz: adfa7e515816d96492539b8a0a58eca2ea0c4b0b04ea6db630185ed0acd4297bfc50eb3d6c74a7b7ad39a4c6ca259efbf511a47028e689adc4f2e2344f93def0
7
+ data.tar.gz: 649054e40e9449bb87b120683cd50027d9f2fbbfd55884cffbff5db678ac9d3f181adcce7ebd6f4379a1b95eeaa5c846cf28e5d66744f0ee5b7d096c7721128f
@@ -1,14 +1,19 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
3
  name: macos
4
4
 
5
- on: [push]
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
6
10
 
7
11
  jobs:
8
12
  test-macos:
9
13
  name: Test on Ruby ${{ matrix.ruby }} macOS
10
14
  runs-on: macos-latest
11
15
  strategy:
16
+ fail-fast: false
12
17
  matrix:
13
18
  ruby: [ '2.6', '2.5', '2.4' ]
14
19
  steps:
@@ -20,7 +25,7 @@ jobs:
20
25
  architecture: 'x64'
21
26
  - name: Update gems
22
27
  run: |
23
- sudo gem install bundler -v "~> 2" --force
28
+ sudo gem install bundler --force
24
29
  bundle install --jobs 4 --retry 3
25
30
  - name: Run specs
26
31
  run: |
@@ -1,14 +1,19 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
3
  name: ubuntu
4
4
 
5
- on: [push]
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
6
10
 
7
11
  jobs:
8
12
  test-linux:
9
13
  name: Test on Ruby ${{ matrix.ruby }} Ubuntu
10
14
  runs-on: ubuntu-latest
11
15
  strategy:
16
+ fail-fast: false
12
17
  matrix:
13
18
  ruby: [ '2.6', '2.5', '2.4' ]
14
19
  steps:
@@ -20,7 +25,7 @@ jobs:
20
25
  architecture: 'x64'
21
26
  - name: Update gems
22
27
  run: |
23
- gem install bundler -v "~> 2"
28
+ gem install bundler
24
29
  bundle install --jobs 4 --retry 3
25
30
  - name: Run specs
26
31
  run: |
@@ -1,14 +1,19 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
3
  name: windows
4
4
 
5
- on: [push]
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ '**' ]
6
10
 
7
11
  jobs:
8
12
  test-windows:
9
13
  name: Test on Ruby ${{ matrix.ruby }} Windows
10
14
  runs-on: windows-latest
11
15
  strategy:
16
+ fail-fast: false
12
17
  matrix:
13
18
  ruby: [ '2.6', '2.5', '2.4' ]
14
19
  steps:
@@ -21,7 +26,7 @@ jobs:
21
26
  - name: Update gems
22
27
  shell: pwsh
23
28
  run: |
24
- gem install bundler -v "~> 2"
29
+ gem install bundler
25
30
  bundle config --local path vendor/bundle
26
31
  bundle update
27
32
  bundle install --jobs 4 --retry 3
@@ -9,17 +9,12 @@ module RelatonNist
9
9
  ret = super
10
10
  return if ret.nil?
11
11
 
12
- keyword_hash_to_bib(ret)
13
12
  commentperiod_hash_to_bib(ret)
14
13
  ret
15
14
  end
16
15
 
17
16
  private
18
17
 
19
- def keyword_hash_to_bib(ret)
20
- ret[:keyword]&.map! { |kw| Keyword.new kw }
21
- end
22
-
23
18
  def commentperiod_hash_to_bib(ret)
24
19
  return unless ret[:commentperiod]
25
20
 
@@ -16,17 +16,18 @@ module RelatonNist
16
16
  def sort_value
17
17
  @sort_value ||= begin
18
18
  sort_phrase = [hit[:serie], hit[:code], hit[:title]].join " "
19
- corr = hit_collection.text.split.map do |w|
19
+ corr = hit_collection&.text&.split&.map do |w|
20
20
  if w =~ /\w+/ &&
21
21
  sort_phrase =~ Regexp.new(Regexp.escape(w), Regexp::IGNORECASE)
22
22
  1
23
23
  else 0
24
24
  end
25
- end.sum
25
+ end&.sum.to_i
26
26
  corr + case hit[:status]
27
- when "final" then 3
28
- when "withdrawn" then 2
29
- when "draft (withdrawn)" then 1
27
+ when "final" then 4
28
+ when "withdrawn" then 3
29
+ when "draft" then 2
30
+ when "draft (obsolete)" then 1
30
31
  else 0
31
32
  end
32
33
  end
@@ -66,12 +66,12 @@ module RelatonNist
66
66
  serie = h.at("td[1]").text.strip
67
67
  code = h.at("td[2]").text.strip
68
68
  title = link.text
69
- url = DOMAIN + link[:href]
69
+ doc_url = DOMAIN + link[:href]
70
70
  status = h.at("td[4]").text.strip.downcase
71
71
  release_date = Date.strptime h.at("td[5]").text.strip, "%m/%d/%Y"
72
72
  Hit.new(
73
73
  {
74
- code: code, serie: serie, title: title, url: url, status: status,
74
+ code: code, serie: serie, title: title, url: doc_url, status: status,
75
75
  release_date: release_date
76
76
  }, self
77
77
  )
@@ -4,7 +4,7 @@ module RelatonNist
4
4
  attr_reader :doctype
5
5
 
6
6
  # @return [Array<RelatonNist::Keyword>]
7
- attr_reader :keyword
7
+ # attr_reader :keyword
8
8
 
9
9
  # @return [RelatonNist::CommentPeriod, NilClass]
10
10
  attr_reader :commentperiod
@@ -57,7 +57,7 @@ module RelatonNist
57
57
  # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
58
58
  def initialize(**args)
59
59
  @doctype = args.delete(:doctype) || "standard"
60
- @keyword = args.delete(:keyword) || []
60
+ # @keyword = args.delete(:keyword) || []
61
61
  @commentperiod = args.delete :commentperiod
62
62
  super
63
63
  end
@@ -78,7 +78,7 @@ module RelatonNist
78
78
  # @return [Hash]
79
79
  def to_hash
80
80
  hash = super
81
- hash["keyword"] = single_element_array(keyword) if keyword&.any?
81
+ # hash["keyword"] = single_element_array(keyword) if keyword&.any?
82
82
  hash["commentperiod"] = commentperiod.to_hash if commentperiod
83
83
  hash
84
84
  end
@@ -3,7 +3,6 @@ require "relaton_nist/nist_bibliographic_item"
3
3
  require "relaton_nist/scrapper"
4
4
  require "relaton_nist/hit_collection"
5
5
  require "relaton_nist/xml_parser"
6
- require "relaton_nist/keyword"
7
6
  require "relaton_nist/comment_period"
8
7
  require "relaton_nist/document_status"
9
8
  require "relaton_nist/hash_converter"
@@ -134,7 +134,7 @@ module RelatonNist
134
134
  iter = doc["iteration"] == "initial" ? 1 : doc["iteration"]
135
135
  else
136
136
  case status
137
- when "draft (withdrawn)"
137
+ when "draft (obsolete)"
138
138
  stage = "draft-public"
139
139
  subst = "withdrawn"
140
140
  when "retired draft"
@@ -445,7 +445,7 @@ module RelatonNist
445
445
  else
446
446
  doc.xpath "//span[@id='pub-keywords-container']/span"
447
447
  end
448
- kws.map { |kw| Keyword.new kw.is_a?(String) ? kw : kw.text }
448
+ kws.map { |kw| kw.is_a?(String) ? kw : kw.text }
449
449
  end
450
450
 
451
451
  # @param doc [Nokogiri::HTML::Document]
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "0.5.1".freeze
2
+ VERSION = "0.6.0".freeze
3
3
  end
@@ -14,7 +14,6 @@ module RelatonNist
14
14
  ext = nistitem.at "./ext"
15
15
  return data unless ext
16
16
 
17
- data[:keyword] = fetch_keyword(ext)
18
17
  data[:commentperiod] = fetch_commentperiod(ext)
19
18
  data
20
19
  end
@@ -39,12 +38,6 @@ module RelatonNist
39
38
  extended: cp.at("extended")&.text
40
39
  )
41
40
  end
42
-
43
- def fetch_keyword(item)
44
- item.xpath("./keyword").map do |kw|
45
- Keyword.new kw.children.first.to_xml
46
- end
47
- end
48
41
  end
49
42
  end
50
43
  end
data/relaton_nist.gemspec CHANGED
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "webmock"
36
36
  spec.add_development_dependency "ruby-jing"
37
37
 
38
- spec.add_dependency "relaton-bib", "~> 0.5.0"
38
+ spec.add_dependency "relaton-bib", "~> 0.6.0"
39
39
  spec.add_dependency "rubyzip"
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.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: 2020-01-16 00:00:00.000000000 Z
11
+ date: 2020-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.5.0
173
+ version: 0.6.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.5.0
180
+ version: 0.6.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rubyzip
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -223,7 +223,6 @@ files:
223
223
  - lib/relaton_nist/hash_converter.rb
224
224
  - lib/relaton_nist/hit.rb
225
225
  - lib/relaton_nist/hit_collection.rb
226
- - lib/relaton_nist/keyword.rb
227
226
  - lib/relaton_nist/nist_bibliographic_item.rb
228
227
  - lib/relaton_nist/nist_bibliography.rb
229
228
  - lib/relaton_nist/processor.rb
@@ -1,23 +0,0 @@
1
- module RelatonNist
2
- class Keyword
3
- include RelatonBib
4
-
5
- # @return [Nokogiri::XML::DocumentFragment]
6
- attr_reader :element
7
-
8
- # @param element [String]
9
- def initialize(element)
10
- @element = Nokogiri::XML.fragment element
11
- end
12
-
13
- # @param builder [Nokogiri::XML::Builder]
14
- def to_xml(builder)
15
- builder.keyword element.to_xml
16
- end
17
-
18
- # @return [String]
19
- def to_hash
20
- element.text
21
- end
22
- end
23
- end