relaton-oasis 1.14.3 → 1.16.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: 7c6f3b9c0380f97640c3e5a56a3e67226681746241690e9426689ef65e0e9345
4
- data.tar.gz: 2b7b26ada6346de6079bcab0ea94c74c2b77e9991f466df56f724a35638de4dc
3
+ metadata.gz: 3908ef54f79de05bfa9ee81c64f27b03e923f13fdd68df2c3a78b14bdc137bcf
4
+ data.tar.gz: 8e120eac3b886e8536532747a89b64f3c7fd9e64d098435e3e2135bde6f17acb
5
5
  SHA512:
6
- metadata.gz: fc86a45ca8524a71b770c988dd36093c026e43c42bc0a79fa0a5398187a1313bf16a4b5e78f754b648361814157c9fa704eea9b272c547697ba2a7983fa109c5
7
- data.tar.gz: c0a82b4f9484fee0dde9a48b7cf9ba8cb7b3a949d7f76df55451fef315e8bfa8c24b5cad6eed1f7d9e419b9182694c023d1f108169b4ac0d6fca36d3b04ce7f6
6
+ metadata.gz: 2f97cd29537cce17fa2f3ce144a7074727a277131a1ea5739480efe6adc3c7dfd6b7b2fc913c029e9ade56694f243311b7b30f7c5df878d34a46af6d80437fb3
7
+ data.tar.gz: 7e9373716c8c693c1532c7a0b413dd0d114597baba2c4a95be9d76b3796d76b16a38e2c44255f45b53642428ddbf7cb55c2562a6688c0cf63ca87ceb3f82ade8
@@ -7,7 +7,8 @@ on:
7
7
  inputs:
8
8
  next_version:
9
9
  description: |
10
- Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
10
+ Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
11
+ Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
11
12
  required: true
12
13
  default: 'skip'
13
14
  repository_dispatch:
data/Gemfile CHANGED
@@ -15,5 +15,5 @@ gem "rubocop-performance"
15
15
  gem "rubocop-rails"
16
16
  gem "ruby-jing"
17
17
  gem "simplecov"
18
- gem "vcr", "~> 5.0.0"
18
+ gem "vcr"
19
19
  gem "webmock"
data/README.adoc CHANGED
@@ -51,7 +51,7 @@ item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
51
51
  [source,ruby]
52
52
  ----
53
53
  item.to_xml
54
- => "<bibitem id="OASISamqp-core" type="standard" schema-version="v1.2.1">
54
+ => "<bibitem id="OASISamqp-core" type="standard" schema-version="v1.2.4">
55
55
  <fetched>2022-12-05</fetched>
56
56
  <title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
57
57
  <docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
@@ -64,12 +64,12 @@ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and add
64
64
  [source,ruby]
65
65
  ----
66
66
  item.to_xml bibdata: true
67
- => "<bibdata type="standard" schema-version="v1.2.1">
67
+ => "<bibdata type="standard" schema-version="v1.2.4">
68
68
  <fetched>2022-12-05</fetched>
69
69
  <title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
70
70
  <docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
71
71
  ...
72
- <ext schema-version="v1.0.0">
72
+ <ext schema-version="v1.0.1">
73
73
  <doctype>standard</doctype>
74
74
  <editorialgroup>
75
75
  <technical-committee>OASIS Advanced Message Queuing Protocol (AMQP) TC</technical-committee>
@@ -110,7 +110,7 @@ RelatonOasis::XMLParser.from_xml File.read("spec/fixtures/oasis_bibdata.xml")
110
110
  [source,ruby]
111
111
  ----
112
112
  hash = YAML.load_file "spec/fixtures/oasis_bibdata.yaml"
113
- => {"schema-version"=>"v1.2.1",
113
+ => {"schema-version"=>"v1.2.4",
114
114
  "id"=>"OASISamqp-core",
115
115
  ...
116
116
 
data/grammars/biblio.rng CHANGED
@@ -1283,7 +1283,7 @@
1283
1283
  <value>mergedInto</value>
1284
1284
  <value>splits</value>
1285
1285
  <value>splitInto</value>
1286
- <value>instance</value>
1286
+ <value>instanceOf</value>
1287
1287
  <value>hasInstance</value>
1288
1288
  <value>exemplarOf</value>
1289
1289
  <value>hasExemplar</value>
@@ -54,6 +54,8 @@
54
54
  <value>Security</value>
55
55
  <value>SOA</value>
56
56
  <value>Web-Services</value>
57
+ <value>Software-Development</value>
58
+ <value>Virtualization</value>
57
59
  </choice>
58
60
  </define>
59
61
  </grammar>
@@ -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
  #
@@ -61,7 +63,7 @@ module RelatonOasis
61
63
  #
62
64
  # Save document to file
63
65
  #
64
- # @param [RelatonOasis::OasisBibliographicItem] doc
66
+ # @param [RelatonOasis::OasisBibliographicItem] doc
65
67
  #
66
68
  def save_doc(doc) # rubocop:disable Metrics/MethodLength
67
69
  c = case @format
@@ -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
 
@@ -10,10 +10,16 @@ module RelatonOasis
10
10
  #
11
11
  def initialize(node)
12
12
  @node = node
13
- @title = @node.at("./summary/div/h2").text
14
- @text = @node.at(
13
+ end
14
+
15
+ def title
16
+ @title ||= @node.at("./summary/div/h2").text
17
+ end
18
+
19
+ def text
20
+ @text ||= @node.at(
15
21
  "./div/div/div[contains(@class, 'standard__grid--cite-as')]/p[em or i or a or span]",
16
- )&.text
22
+ )&.text&.strip
17
23
  end
18
24
 
19
25
  #
@@ -27,8 +33,10 @@ module RelatonOasis
27
33
  doctype: parse_doctype,
28
34
  title: parse_title,
29
35
  docid: parse_docid,
36
+ link: parse_link,
30
37
  docnumber: parse_docnumber,
31
38
  date: parse_date,
39
+ contributor: parse_contributor,
32
40
  abstract: parse_abstract,
33
41
  language: ["en"],
34
42
  script: ["Latn"],
@@ -44,7 +52,7 @@ module RelatonOasis
44
52
  # @return [Array<RelatonBib::TypedTitleString>] <description>
45
53
  #
46
54
  def parse_title
47
- [RelatonBib::TypedTitleString.new(type: "main", content: @title, language: "en", script: "Latn")]
55
+ [RelatonBib::TypedTitleString.new(type: "main", content: title, language: "en", script: "Latn")]
48
56
  end
49
57
 
50
58
  #
@@ -60,7 +68,7 @@ module RelatonOasis
60
68
  end
61
69
  end
62
70
 
63
- #
71
+ # #
64
72
  # Parse abstract.
65
73
  #
66
74
  # @return [Array<RelatonBib::FormattedString>] abstract
@@ -87,6 +95,19 @@ module RelatonOasis
87
95
  RelatonBib::EditorialGroup.new tc
88
96
  end
89
97
 
98
+ def parse_authorizer
99
+ @node.xpath("./div[@class='standard__details']/a").map do |a|
100
+ cnt = RelatonBib::Contact.new(type: "uri", value: a[:href])
101
+ org = RelatonBib::Organization.new name: a.text.strip, contact: [cnt]
102
+ role = { type: "authorizer", description: ["Committee"] }
103
+ RelatonBib::ContributionInfo.new entity: org, role: [role]
104
+ end
105
+ end
106
+
107
+ def link_node
108
+ @link_node ||= @node.at("./div/div/div[contains(@class, 'standard__grid--cite-as')]/p[strong or span/strong]/a")
109
+ end
110
+
90
111
  #
91
112
  # Parse relation.
92
113
  #
@@ -118,6 +139,30 @@ module RelatonOasis
118
139
  ).map { |p| p.text.gsub(/^\[{1,2}|\]$/, "").strip }
119
140
  end
120
141
 
142
+ def parse_link
143
+ return [] if parts.size > 1
144
+
145
+ links.map do |l|
146
+ type = l[:href].match(/\.(\w+)$/)&.captures&.first
147
+ type ||= "src"
148
+ type.sub!("docx", "doc")
149
+ type.sub!("html", "src")
150
+ RelatonBib::TypedUri.new(type: type, content: l[:href])
151
+ end
152
+ end
153
+
154
+ def parts
155
+ @parts ||= @node.xpath(
156
+ "./div/div/div[contains(@class, 'standard__grid--cite-as')]/p[strong or span/strong]",
157
+ )
158
+ end
159
+
160
+ def links
161
+ l = @node.xpath("./div/div/div[1]/p[1]/a[@href]")
162
+ l = @node.xpath("./div/div/div[1]/p[2]/a[@href]") if l.empty?
163
+ l
164
+ end
165
+
121
166
  #
122
167
  # Parse document number.
123
168
  #
@@ -140,7 +185,7 @@ module RelatonOasis
140
185
  # @return [String] document identifier
141
186
  #
142
187
  def parts_to_docid(parts)
143
- id = parts[1..-1].each_with_object(parts[0].split("-")) do |part, acc|
188
+ id = parts[1..].each_with_object(parts[0].split("-")) do |part, acc|
144
189
  chunks = part.split "-"
145
190
  chunks.each.with_index do |chunk, idx|
146
191
  unless chunk.casecmp(acc[idx])&.zero?
@@ -1,6 +1,93 @@
1
1
  module RelatonOasis
2
2
  # Common methods for document and part parsers.
3
3
  module DataParserUtils
4
+ #
5
+ # Parse contributor.
6
+ #
7
+ # @return [Array<RelatonBib::ContributionInfo>] contributors
8
+ #
9
+ def parse_contributor
10
+ publisher_oasis + parse_authorizer + parse_chairs + parse_editors
11
+ end
12
+
13
+ def publisher_oasis
14
+ cnt = RelatonBib::Contact.new type: "uri", value: "https://www.oasis-open.org/"
15
+ entity = RelatonBib::Organization.new name: "OASIS", contact: [cnt]
16
+ role = [
17
+ { type: "authorizer", description: ["Standards Development Organization"] },
18
+ { type: "publisher" },
19
+ ]
20
+ [RelatonBib::ContributionInfo.new(entity: entity, role: role)]
21
+ end
22
+
23
+ def parse_editors_from_text
24
+ return [] unless text
25
+
26
+ text.match(/(?<=Edited\sby\s)[^.]+/).to_s.split(/,?\sand\s|,\s/).map do |c|
27
+ RelatonBib::ContributionInfo.new(role: [type: "editor"], entity: create_person(c))
28
+ end
29
+ end
30
+
31
+ def page
32
+ return @page if defined? @page
33
+
34
+ if link_node && link_node[:href].match?(/\.html$/)
35
+ agent = Mechanize.new
36
+ agent.agent.allowed_error_codes = [404]
37
+ sleep 1 # to avoid 429 error
38
+ resp = agent.get link_node[:href]
39
+ @page = resp if resp.code == "200"
40
+ end
41
+ end
42
+
43
+ def parse_chairs
44
+ return [] unless page
45
+
46
+ page.xpath(
47
+ "//p[preceding-sibling::p[starts-with(., 'Chair')]][following-sibling::p[starts-with(., 'Editor')]]",
48
+ ).map { |p| create_contribution_info(p, "editor", ["Chair"]) }
49
+ end
50
+
51
+ def parse_editors
52
+ return parse_editors_from_text unless page
53
+
54
+ page.xpath(
55
+ "//p[contains(@class, 'Contributor')][preceding-sibling::p[starts-with(., 'Editor')]]" \
56
+ "[following-sibling::p[contains(@class, 'Title')]]",
57
+ ).map { |p| create_contribution_info(p, "editor") }
58
+ end
59
+
60
+ def create_contribution_info(person, type, description = [])
61
+ name = person.text.match(/^[^(]+/).to_s.strip
62
+ email, org = person.xpath ".//a[@href]"
63
+ entity = create_person name, email, org
64
+ role = { type: type, description: description }
65
+ RelatonBib::ContributionInfo.new(role: [role], entity: entity)
66
+ end
67
+
68
+ def create_person(name, email = nil, org = nil)
69
+ forename, surname = name.split
70
+ fn = RelatonBib::Forename.new(content: forename, language: ["en"], script: ["Latn"])
71
+ sn = RelatonBib::LocalizedString.new(surname, "en", "Latn")
72
+ name = RelatonBib::FullName.new(surname: sn, forename: [fn])
73
+ RelatonBib::Person.new(name: name, contact: contact(email), affiliation: affiliation(org))
74
+ end
75
+
76
+ def contact(email)
77
+ return [] unless email
78
+
79
+ [RelatonBib::Contact.new(type: "email", value: email[:href].split(":")[1])]
80
+ end
81
+
82
+ def affiliation(org)
83
+ return [] unless org
84
+
85
+ cnt = RelatonBib::Contact.new(type: "uri", value: org[:href])
86
+ org_name = org.text.gsub(/[\r\n]+/, " ")
87
+ organization = RelatonBib::Organization.new name: org_name, contact: [cnt]
88
+ [RelatonBib::Affiliation.new(organization: organization)]
89
+ end
90
+
4
91
  #
5
92
  # Parse document identifier specification.
6
93
  #
@@ -9,7 +96,7 @@ module RelatonOasis
9
96
  # @return [String] document identifier with specification if needed
10
97
  #
11
98
  def parse_spec(num)
12
- id = case @text
99
+ id = case text
13
100
  when /OASIS Project Specification (\d+)/ then "#{num}-PS#{$1}"
14
101
  when /Committee Specification (\d+)/ then "#{num}-CS#{$1}"
15
102
  else num
@@ -27,11 +114,10 @@ module RelatonOasis
27
114
  def parse_part(docid)
28
115
  return docid if docid.match?(/(?:Part|Pt)\d+/i)
29
116
 
30
- id = case @title
31
- when /Part\s(\d+)/ then "#{docid}-Pt#{$1}"
32
- else docid
33
- end
34
- parse_errata(id)
117
+ case title
118
+ when /Part\s(\d+)/ then "#{docid}-Pt#{$1}"
119
+ else docid
120
+ end
35
121
  end
36
122
 
37
123
  #
@@ -42,11 +128,11 @@ module RelatonOasis
42
128
  # @return [String] document identifier with errata if needed
43
129
  #
44
130
  def parse_errata(id)
45
- return id if id.match?(/errata\d+/i)
131
+ return id.sub("errata", "Errata") if id.match?(/errata\d+/i)
46
132
 
47
- case @title
48
- when /Plus\sErrata\s(\d+)/ then "#{id}-plus-errata#{$1}"
49
- when /Errata\s(\d+)/ then "#{id}-errata#{$1}"
133
+ case title
134
+ when /Plus\sErrata\s(\d+)/ then "#{id}-plus-Errata#{$1}"
135
+ when /Errata\s(\d+)/ then "#{id}-Errata#{$1}"
50
136
  else id
51
137
  end
52
138
  end
@@ -67,7 +153,7 @@ module RelatonOasis
67
153
  # @return [String] document type
68
154
  #
69
155
  def parse_doctype
70
- case @text
156
+ case text
71
157
  when /OASIS Project Specification/, /Committee Specification/
72
158
  "specification"
73
159
  when /Technical Memorandum/ then "memorandum"
@@ -10,13 +10,21 @@ module RelatonOasis
10
10
  #
11
11
  def initialize(node)
12
12
  @node = node
13
- @text = node.xpath(
13
+ end
14
+
15
+ def text
16
+ @text ||= @node.xpath(
14
17
  "./strong/following-sibling::text()|./span/strong/../following-sibling::text()",
15
18
  ).text.strip
19
+ end
20
+
21
+ def title
22
+ return @title if @title
23
+
16
24
  t = @node.at("./span[@class='citationTitle' or @class='citeTitle']|./em|./i")
17
25
  @title = if t then t.text
18
26
  else
19
- @text.match(/(?<content>.+)\s(?:Edited|\d{2}\s\w+\d{4})/)[:content]
27
+ text.match(/(?<content>.+)\s(?:Edited|\d{2}\s\w+\d{4})/)[:content]
20
28
  end.strip
21
29
  end
22
30
 
@@ -34,10 +42,10 @@ module RelatonOasis
34
42
  link: parse_link,
35
43
  docnumber: parse_docnumber,
36
44
  date: parse_date,
37
- # abstract: parse_abstract,
45
+ abstract: parse_abstract,
38
46
  language: ["en"],
39
47
  script: ["Latn"],
40
- # editorialgroup: parse_editorialgroup,
48
+ editorialgroup: parse_editorialgroup,
41
49
  relation: parse_relation,
42
50
  contributor: parse_contributor,
43
51
  technology_area: parse_technology_area,
@@ -50,7 +58,7 @@ module RelatonOasis
50
58
  # @return [Array<RelatonBib::TypedTitleString>] title
51
59
  #
52
60
  def parse_title
53
- [RelatonBib::TypedTitleString.new(type: "main", content: @title, language: "en", script: "Latn")]
61
+ [RelatonBib::TypedTitleString.new(type: "main", content: title, language: "en", script: "Latn")]
54
62
  end
55
63
 
56
64
  #
@@ -61,9 +69,10 @@ module RelatonOasis
61
69
  def parse_docnumber
62
70
  ref = @node.at("./span[@class='citationLabel']/strong|./strong|b/span")
63
71
  num = ref.text.match(/[^\[\]]+/).to_s
72
+ id = parse_errata(num)
64
73
  # some part references need to be added by "Pt" to be distinguishable from root doc
65
- num += "-Pt" if %w[CMIS-v1.1 DocBook-5.0 XACML-V3.0 mqtt-v3.1.1 OData-JSON-Format-v4.0].include?(num)
66
- parse_spec num
74
+ id += "-Pt" if %w[CMIS-v1.1 DocBook-5.0 XACML-V3.0 mqtt-v3.1.1 OData-JSON-Format-v4.0].include?(id)
75
+ parse_spec id
67
76
  end
68
77
 
69
78
  #
@@ -82,29 +91,28 @@ module RelatonOasis
82
91
  # @return [Array<RelatonBib::BibliographicDate>] bibliographic dates
83
92
  #
84
93
  def parse_date
85
- /(?<on>\d{1,2}\s\w+\s\d{4})/ =~ @text
94
+ /(?<on>\d{1,2}\s\w+\s\d{4})/ =~ text
86
95
  [RelatonBib::BibliographicDate.new(on: Date.parse(on).to_s, type: "issued")]
87
96
  end
88
97
 
89
- # def parse_abstract
90
- # /\d{2}\s\w+\s\d{4}\.\s(?<content>.+)\sLatest\sversion/ =~ @text
91
- # [RelatonBib::FormattedString.new(content: content, language: "en", script: "Latn")]
92
- # end
98
+ def parse_abstract
99
+ page.xpath("//p[preceding-sibling::p[starts-with(., 'Abstract')]][1]").map do |p|
100
+ cnt = p.text.gsub(/[\r\n]+/, " ").strip
101
+ RelatonBib::FormattedString.new(content: cnt, language: "en", script: "Latn")
102
+ end
103
+ end
93
104
 
94
105
  #
95
- # Parse contributor.
106
+ # Parse technical committee.
96
107
  #
97
- # @return [Array<RelatonBib::ContributionInfo>] contributors
108
+ # @return [RelatonBib::EditorialGroup] technical committee
98
109
  #
99
- def parse_contributor
100
- @text.match(/(?<=Edited\sby\s)[^.]+/).to_s.split(/,\s|,?\sand\s/).map do |c|
101
- forename, surname = c.split
102
- fn = RelatonBib::LocalizedString.new(forename, "en", "Latn")
103
- sn = RelatonBib::LocalizedString.new(surname, "en", "Latn")
104
- name = RelatonBib::FullName.new(surname: sn, forename: [fn])
105
- entity = RelatonBib::Person.new(name: name)
106
- RelatonBib::ContributionInfo.new(role: [type: "editor"], entity: entity)
110
+ def parse_editorialgroup
111
+ tc = page.xpath("//p[preceding-sibling::p[starts-with(., 'Technical')]][1]//a").map do |a|
112
+ wg = RelatonBib::WorkGroup.new name: a.text.strip
113
+ RelatonBib::TechnicalCommittee.new wg
107
114
  end
115
+ RelatonBib::EditorialGroup.new tc
108
116
  end
109
117
 
110
118
  #
@@ -119,6 +127,21 @@ module RelatonOasis
119
127
  [RelatonBib::DocumentRelation.new(type: "partOf", bibitem: bib)]
120
128
  end
121
129
 
130
+ def parse_authorizer
131
+ return [] unless page
132
+
133
+ page.xpath("//p[preceding-sibling::p[starts-with(., 'Technical')]][1]//a").map do |a|
134
+ cnt = RelatonBib::Contact.new(type: "uri", value: a[:href])
135
+ org = RelatonBib::Organization.new name: a.text.gsub(/[\r\n]+/, " ").strip, contact: [cnt]
136
+ role = { type: "authorizer", description: ["Committee"] }
137
+ RelatonBib::ContributionInfo.new entity: org, role: [role]
138
+ end
139
+ end
140
+
141
+ def link_node
142
+ @link_node = @node.at("./a")
143
+ end
144
+
122
145
  #
123
146
  # Parse technology area.
124
147
  #
@@ -3,7 +3,7 @@ module RelatonOasis
3
3
  AREAS = %w[Cloud Content-Technologies Cybersecurity e-Business eGov/Legal
4
4
  Emergency-Management Energy Information-Modeling IoT
5
5
  Lifecycle-Integration Localization Messaging Privacy/Identity
6
- Security SOA Web-Services].freeze
6
+ Security SOA Web-Services Software-Development Virtualization].freeze
7
7
 
8
8
  attr_reader :technology_area
9
9
 
@@ -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/data/"
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}#{code.upcase}.yaml"
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
@@ -29,7 +34,7 @@ module RelatonOasis
29
34
  # reference is required
30
35
  # @return [RelatonOasis::OasisBibliographicItem, nil]
31
36
  def get(code, year = nil, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
32
- warn "[relaton-oasis] (#{code} fetching..."
37
+ warn "[relaton-oasis] (#{code}) fetching..."
33
38
  bibitem = search code, year
34
39
  if bibitem
35
40
  docid = bibitem.docidentifier.detect(&:primary).id
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonOasis
4
- VERSION = "1.14.3"
4
+ VERSION = "1.16.0"
5
5
  end
data/lib/relaton_oasis.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "mechanize"
4
+ require "relaton/index"
4
5
  require "relaton_bib"
5
6
  require_relative "relaton_oasis/version"
6
7
  require_relative "relaton_oasis/oasis_bibliographic_item"
@@ -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 bibliographic use "\
12
- "using the BibliographicItem model"
13
- spec.description = "RelatonOasis: retrieve OASIS Standards for bibliographic use "\
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"
@@ -33,7 +33,8 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_dependency "mechanize", "~> 2.8.0"
35
35
  spec.add_dependency "multi_json", "~> 1.15.0"
36
- spec.add_dependency "relaton-bib", "~> 1.14.0"
36
+ spec.add_dependency "relaton-bib", "~> 1.16.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.3
4
+ version: 1.16.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: 2023-05-21 00:00:00.000000000 Z
11
+ date: 2023-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -44,14 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.14.0
47
+ version: 1.16.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.14.0
54
+ version: 1.16.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: