relaton-oasis 1.14.3 → 1.14.4
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 +4 -4
- data/lib/relaton_oasis/data_fetcher.rb +3 -0
- data/lib/relaton_oasis/oasis_bibliography.rb +8 -3
- data/lib/relaton_oasis/processor.rb +7 -0
- data/lib/relaton_oasis/version.rb +1 -1
- data/lib/relaton_oasis.rb +1 -0
- data/relaton_oasis.gemspec +5 -4
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3258c1d1302d56309c6e63545e12fb6b8b014b8adbabbfaa3d5ca5c3e282fb3
|
4
|
+
data.tar.gz: '09380e04f60fcdd7863098c3ea15cc0ac685fbee7d5055aeaab7cd5b34d284bd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd97e71ec0a28bb367e98566fe49e3b167cfab89f7e2b045873065ad8270cbb6c6b28331ff934b4136ac02b83a112d595db5d477ba2618ea42af22e5db80029f
|
7
|
+
data.tar.gz: c6c98cdfb711e0464a9bbe51f555625ca53d579190a511055ae4310756a0fc86505c2671c4c029b33a67fbb7fd64eb4083aec124fb488c5f7334073a663fa796
|
@@ -12,6 +12,7 @@ module RelatonOasis
|
|
12
12
|
@ext = @format.sub(/^bib|^rfc/, "")
|
13
13
|
@files = []
|
14
14
|
@index = Index.new
|
15
|
+
@index1 = Relaton::Index.find_or_create :oasis, file: "index-v1.yaml"
|
15
16
|
end
|
16
17
|
|
17
18
|
#
|
@@ -42,6 +43,7 @@ module RelatonOasis
|
|
42
43
|
fetch_parts item
|
43
44
|
end
|
44
45
|
@index.save
|
46
|
+
@index1.save
|
45
47
|
end
|
46
48
|
|
47
49
|
#
|
@@ -76,6 +78,7 @@ module RelatonOasis
|
|
76
78
|
@files << file
|
77
79
|
@index[doc] = file
|
78
80
|
end
|
81
|
+
@index1.add_or_update doc.docnumber, file
|
79
82
|
File.write file, c, encoding: "UTF-8"
|
80
83
|
end
|
81
84
|
|
@@ -3,21 +3,26 @@
|
|
3
3
|
module RelatonOasis
|
4
4
|
# Class methods for search Cenelec standards.
|
5
5
|
class OasisBibliography
|
6
|
-
ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-oasis/main/
|
6
|
+
ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-oasis/main/"
|
7
|
+
INDEX_FILE = "index-v1.yaml"
|
7
8
|
|
8
9
|
class << self
|
9
10
|
# @param text [String]
|
10
11
|
# @return [RelatonOasis::HitCollection]
|
11
12
|
def search(text, _year = nil)
|
12
13
|
/^(?:OASIS\s)?(?<code>.+)/ =~ text
|
14
|
+
index = Relaton::Index.find_or_create :oasis, url: "#{ENDPOINT}index-v1.zip", file: INDEX_FILE
|
15
|
+
row = index.search(code).min_by { |i| i[:id] }
|
16
|
+
return unless row
|
17
|
+
|
13
18
|
agent = Mechanize.new
|
14
|
-
resp = agent.get "#{ENDPOINT}#{
|
19
|
+
resp = agent.get "#{ENDPOINT}#{row[:file]}"
|
15
20
|
return unless resp.code == "200"
|
16
21
|
|
17
22
|
hash = YAML.safe_load resp.body
|
18
23
|
hash["fetched"] = Date.today.to_s
|
19
24
|
OasisBibliographicItem.from_hash hash
|
20
|
-
rescue Mechanize::ResponseCodeError => e
|
25
|
+
rescue Mechanize::ResponseCodeError, OpenURI::HTTPError => e
|
21
26
|
return if e.response_code == "404"
|
22
27
|
|
23
28
|
raise RelatonBib::RequestError, e.message
|
@@ -47,5 +47,12 @@ module RelatonOasis
|
|
47
47
|
def grammar_hash
|
48
48
|
@grammar_hash ||= ::RelatonOasis.grammar_hash
|
49
49
|
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Remove index file
|
53
|
+
#
|
54
|
+
def remove_index_file
|
55
|
+
Relaton::Index.find_or_create(:oasis, url: true, file: OasisBibliography::INDEX_FILE).remove_file
|
56
|
+
end
|
50
57
|
end
|
51
58
|
end
|
data/lib/relaton_oasis.rb
CHANGED
data/relaton_oasis.gemspec
CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Ribose Inc."]
|
9
9
|
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
|
-
spec.summary = "RelatonOasis: retrieve OASIS Standards for
|
12
|
-
"using the BibliographicItem model"
|
13
|
-
spec.description = "RelatonOasis: retrieve OASIS Standards for
|
14
|
-
"using the BibliographicItem model"
|
11
|
+
spec.summary = "RelatonOasis: retrieve OASIS Standards for " \
|
12
|
+
"bibliographic use using the BibliographicItem model"
|
13
|
+
spec.description = "RelatonOasis: retrieve OASIS Standards for " \
|
14
|
+
"bibliographic use using the BibliographicItem model"
|
15
15
|
spec.homepage = "https://github.com/metanorma/relaton-oasis"
|
16
16
|
spec.license = "BSD-2-Clause"
|
17
17
|
spec.required_ruby_version = ">= 2.7.0"
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency "mechanize", "~> 2.8.0"
|
35
35
|
spec.add_dependency "multi_json", "~> 1.15.0"
|
36
36
|
spec.add_dependency "relaton-bib", "~> 1.14.0"
|
37
|
+
spec.add_dependency "relaton-index", "~> 0.2.0"
|
37
38
|
|
38
39
|
# For more information and examples about making a new gem, checkout our
|
39
40
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-oasis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.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: 2023-05-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.14.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: relaton-index
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.0
|
55
69
|
description: 'RelatonOasis: retrieve OASIS Standards for bibliographic use using the
|
56
70
|
BibliographicItem model'
|
57
71
|
email:
|