relaton-iso 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98227cd064516c2a45ef5c8e7603ac921412a6484fe52a59068abd0811f3ba03
4
- data.tar.gz: 59fd8f722ee9581e690553c9933df5aafb8c1903aa23fa86f2c7f58256d57c04
3
+ metadata.gz: a73ac19c4da469921da4bad644b50f148d750476852e1a43c85c2cf0ffe52b87
4
+ data.tar.gz: b7bf3b134c1dc1d851b136a78d35241572cd9706f4c451791e268932b4a68b70
5
5
  SHA512:
6
- metadata.gz: 17e76f8369a9fd3b98300227b8a9ea2933cab8a9bd3c5a90b89f6017fd5f1b1964bfb44274d45d23d268fffba9d57d9c94823480a4706ac725fa02fa90ae4d3b
7
- data.tar.gz: 90d98d23acf5ec1f82d234756920d250424cad1421af5e7c2fba8edbea69ea6067c592875840b3e70197e165ebb8ea669804b6b3464ff88a00e314e03fe729a6
6
+ metadata.gz: bd884caa8c53e3d4b020335e1adbf2abab31f657069a249f821e4cac21a1d126b69d8d3c281058217b3d3aaa9c5f2f4a6d6b361ca328c8a0872fb5e1cba16565
7
+ data.tar.gz: 0c92680ecce087a3437176f5d980b59e5fca2416d9f99ac5cdd094b93106c7286cf2f9fded7544c156b54aecf988dc83917c2cf08ddfb8fa05c6f8049bf578d2
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
 
15
15
  .vscode/
16
16
  .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
17
+ Gemfile.lock
@@ -1,9 +1,12 @@
1
1
  = RelatonIso: retrieve ISO Standards for bibliographic use using the BibliographicItem model
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton-iso.svg["Gem Version", link="https://rubygems.org/gems/relaton-iso"]
4
- image:https://img.shields.io/travis/metanorma/relaton-iso/master.svg["Build Status", link="https://travis-ci.com/metanorma/relaton-iso"]
5
- image:https://ci.appveyor.com/api/projects/status/nb2hvqycupqrkqjt?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/ribose/relaton-iso"]
6
- image:https://codeclimate.com/github/metanorma/relaton-iso/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-iso"]
4
+ image:https://github.com/relaton/relaton-iso/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-iso/actions?workflow=macos"]
5
+ image:https://github.com/relaton/relaton-iso/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-iso/actions?workflow=windows"]
6
+ image:https://github.com/relaton/relaton-iso/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-iso/actions?workflow=ubuntu"]
7
+ image:https://codeclimate.com/github/relaton/relaton-iso/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-iso"]
8
+ image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-iso.svg["Pull Requests", link="https://github.com/relaton/relaton-iso/pulls"]
9
+ image:https://img.shields.io/github/commits-since/relaton/relaton/latest.svg["Commits since latest",link="https://github.com/relaton/relaton/releases"]
7
10
 
8
11
  RelatonIso is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
9
12
 
@@ -10,7 +10,7 @@ module RelatonIso
10
10
  class IsoBibliography
11
11
  class << self
12
12
  # @param text [String]
13
- # @return [RelatonIso::HitPages]
13
+ # @return [RelatonIso::HitCollection]
14
14
  def search(text)
15
15
  HitCollection.new text
16
16
  rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
@@ -25,19 +25,21 @@ module RelatonIso
25
25
  # Scrapper.get(text)
26
26
  # end
27
27
 
28
- # @param code [String] the ISO standard Code to look up (e..g "ISO 9000")
28
+ # @param ref [String] the ISO standard Code to look up (e..g "ISO 9000")
29
29
  # @param year [String] the year the standard was published (optional)
30
30
  # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required,
31
31
  # :keep_year if undated reference should return actual reference with year
32
32
  # @return [String] Relaton XML serialisation of reference
33
- def get(code, year, opts)
33
+ def get(ref, year, opts)
34
+ opts[:ref] = ref
35
+
34
36
  %r{
35
37
  ^(?<code1>[^\s]+\s[^/]+) # match code
36
38
  /?
37
39
  (?<corr>(Amd|DAmd|(CD|WD|AWI|NP)\sAmd|Cor|CD\sCor|FDAmd)\s\d+ # correction name
38
40
  :?(\d{4})?(/Cor\s\d+:\d{4})?) # match correction year
39
- }x =~ code
40
- code = code1 if code1
41
+ }x =~ ref
42
+ code = code1 || ref
41
43
 
42
44
  if year.nil?
43
45
  /^(?<code1>[^\s]+(\s\w+)?\s[\d-]+)(:(?<year1>\d{4}))?(?<code2>\s\w+)?/ =~ code
@@ -89,7 +91,7 @@ module RelatonIso
89
91
  # @param corr [String] correction
90
92
  # @return [Array<RelatonIso::Hit>]
91
93
  def isobib_search_filter(code, corr, opts)
92
- warn "fetching #{code}..."
94
+ warn "[relaton-iso] (\"#{opts[:ref]}\") fetching..."
93
95
  result = search(code)
94
96
  res = search_code result, code, corr, opts
95
97
  return res unless res.empty?
@@ -108,17 +110,19 @@ module RelatonIso
108
110
  end
109
111
 
110
112
  if %r{^ISO\s} =~ code # try ISO/IEC if ISO not found
111
- warn "Attempting ISO/IEC retrieval"
113
+ warn "[relaton-iso] Attempting ISO/IEC retrieval"
112
114
  c = code.sub "ISO", "ISO/IEC"
113
115
  res = search_code result, c, corr, opts
114
116
  end
115
117
  res
116
118
  end
117
119
 
120
+ # @param result [RelatonIso::HitCollection]
121
+ # @param corr [String] correction
122
+ # @param opts [Hash]
118
123
  def try_stages(result, corr, opts)
119
124
  res = nil
120
125
  %w[NP WD CD DIS FDIS PRF IS AWI].each do |st| # try stages
121
- warn "Attempting #{st} stage retrieval"
122
126
  c = yield st
123
127
  res = search_code result, c, corr, opts
124
128
  return res unless res.empty?
@@ -164,9 +168,12 @@ module RelatonIso
164
168
  # return iev(code) if /^IEC 60050-/.match code
165
169
  result = isobib_search_filter(code, corr, opts) || return
166
170
  ret = isobib_results_filter(result, year, opts)
167
- return ret[:ret] if ret[:ret]
168
-
169
- fetch_ref_err(code, year, ret[:years])
171
+ if ret[:ret]
172
+ warn "[relaton-iso] (\"#{opts[:ref]}\") found #{ret[:ret].docidentifier.first.id}"
173
+ ret[:ret]
174
+ else
175
+ fetch_ref_err(code, year, ret[:years])
176
+ end
170
177
  end
171
178
  end
172
179
  end
@@ -58,6 +58,7 @@ module RelatonIso
58
58
  copyright: fetch_copyright(hit_data["docRef"], doc),
59
59
  link: fetch_link(doc, url),
60
60
  relation: fetch_relations(doc),
61
+ place: ["Geneva"],
61
62
  structuredidentifier: fetch_structuredidentifier(doc),
62
63
  )
63
64
  end
@@ -205,8 +206,7 @@ module RelatonIso
205
206
  "updates"
206
207
  else r_type
207
208
  end
208
- if ["Now", "Now under review"].include? type
209
- a
209
+ if ["Now", "Now under review"].include?(type) then a
210
210
  else
211
211
  a + r.css("a").map do |id|
212
212
  fref = RelatonBib::FormattedRef.new(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "0.7.1"
4
+ VERSION = "0.8.0"
5
5
  end
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
- spec.add_development_dependency "bundler", "~> 2.0.1"
30
29
  spec.add_development_dependency "byebug"
31
30
  spec.add_development_dependency "debase"
32
31
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
@@ -38,6 +37,6 @@ Gem::Specification.new do |spec|
38
37
  spec.add_development_dependency "vcr"
39
38
  spec.add_development_dependency "webmock"
40
39
 
41
- spec.add_dependency "relaton-iec", "~> 0.5.0"
42
- spec.add_dependency "relaton-iso-bib", "~> 0.4.0"
40
+ spec.add_dependency "relaton-iec", "~> 0.6.0"
41
+ spec.add_dependency "relaton-iso-bib", "~> 0.5.0"
43
42
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.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: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2020-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 2.0.1
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 2.0.1
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: byebug
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +156,28 @@ dependencies:
170
156
  requirements:
171
157
  - - "~>"
172
158
  - !ruby/object:Gem::Version
173
- version: 0.5.0
159
+ version: 0.6.0
174
160
  type: :runtime
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - "~>"
179
165
  - !ruby/object:Gem::Version
180
- version: 0.5.0
166
+ version: 0.6.0
181
167
  - !ruby/object:Gem::Dependency
182
168
  name: relaton-iso-bib
183
169
  requirement: !ruby/object:Gem::Requirement
184
170
  requirements:
185
171
  - - "~>"
186
172
  - !ruby/object:Gem::Version
187
- version: 0.4.0
173
+ version: 0.5.0
188
174
  type: :runtime
189
175
  prerelease: false
190
176
  version_requirements: !ruby/object:Gem::Requirement
191
177
  requirements:
192
178
  - - "~>"
193
179
  - !ruby/object:Gem::Version
194
- version: 0.4.0
180
+ version: 0.5.0
195
181
  description: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
196
182
  model'
197
183
  email:
@@ -209,7 +195,6 @@ files:
209
195
  - ".rubocop.yml"
210
196
  - CODE_OF_CONDUCT.md
211
197
  - Gemfile
212
- - Gemfile.lock
213
198
  - LICENSE.txt
214
199
  - README.adoc
215
200
  - Rakefile
@@ -1,95 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- relaton-iso (0.7.1)
5
- relaton-iec (~> 0.5.0)
6
- relaton-iso-bib (~> 0.4.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.7.0)
12
- public_suffix (>= 2.0.2, < 5.0)
13
- byebug (11.0.1)
14
- coderay (1.1.2)
15
- crack (0.4.3)
16
- safe_yaml (~> 1.0.0)
17
- debase (0.2.3)
18
- debase-ruby_core_source (>= 0.10.2)
19
- debase-ruby_core_source (0.10.5)
20
- diff-lcs (1.3)
21
- docile (1.3.2)
22
- equivalent-xml (0.6.0)
23
- nokogiri (>= 1.4.3)
24
- hashdiff (0.4.0)
25
- isoics (0.1.8)
26
- json (2.2.0)
27
- method_source (0.9.2)
28
- mini_portile2 (2.4.0)
29
- nokogiri (1.10.7)
30
- mini_portile2 (~> 2.4.0)
31
- pry (0.12.2)
32
- coderay (~> 1.1.0)
33
- method_source (~> 0.9.0)
34
- pry-byebug (3.7.0)
35
- byebug (~> 11.0)
36
- pry (~> 0.10)
37
- public_suffix (4.0.1)
38
- rake (10.5.0)
39
- relaton-bib (0.4.1)
40
- addressable
41
- nokogiri
42
- relaton-iec (0.5.1)
43
- addressable
44
- relaton-iso-bib (~> 0.4.0)
45
- relaton-iso-bib (0.4.1)
46
- isoics (~> 0.1.6)
47
- relaton-bib (~> 0.4.0)
48
- ruby_deep_clone (~> 0.8.0)
49
- rspec (3.8.0)
50
- rspec-core (~> 3.8.0)
51
- rspec-expectations (~> 3.8.0)
52
- rspec-mocks (~> 3.8.0)
53
- rspec-core (3.8.2)
54
- rspec-support (~> 3.8.0)
55
- rspec-expectations (3.8.4)
56
- diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.8.0)
58
- rspec-mocks (3.8.1)
59
- diff-lcs (>= 1.2.0, < 2.0)
60
- rspec-support (~> 3.8.0)
61
- rspec-support (3.8.2)
62
- ruby-debug-ide (0.7.0)
63
- rake (>= 0.8.1)
64
- ruby_deep_clone (0.8.0)
65
- safe_yaml (1.0.5)
66
- simplecov (0.17.0)
67
- docile (~> 1.1)
68
- json (>= 1.8, < 3)
69
- simplecov-html (~> 0.10.0)
70
- simplecov-html (0.10.2)
71
- vcr (5.0.0)
72
- webmock (3.6.0)
73
- addressable (>= 2.3.6)
74
- crack (>= 0.3.2)
75
- hashdiff (>= 0.4.0, < 2.0.0)
76
-
77
- PLATFORMS
78
- ruby
79
-
80
- DEPENDENCIES
81
- bundler (~> 2.0.1)
82
- byebug
83
- debase
84
- equivalent-xml (~> 0.6)
85
- pry-byebug
86
- rake (~> 10.0)
87
- relaton-iso!
88
- rspec (~> 3.0)
89
- ruby-debug-ide
90
- simplecov
91
- vcr
92
- webmock
93
-
94
- BUNDLED WITH
95
- 2.0.2