relaton-iana 1.14.2 → 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: e28db214fb7ee96d95437e096953b44088e3dcb0b0255a224773a2c3d0265ed2
4
- data.tar.gz: 397b757c60191a373016f767ef76bd34000a77d4039ea85bd022376ca40fc3f1
3
+ metadata.gz: d6512698897df0914041e13906cca68fc122b181d3f4ec5f89016bbb8335a08e
4
+ data.tar.gz: 6a86c62db84860027c1127c7db46aa7a63cc3e86a5c79d1614b450ee15c7cd6c
5
5
  SHA512:
6
- metadata.gz: 82a9ba0764bae580b8938ef563e35b31da5a666e5accf9b99ff0f92ca9d1d2bb1c7f64515b545534efe1cb417cf68915507983be0fcbe34eb444380c3c5fe886
7
- data.tar.gz: c28062035798f285063e3fff10b6a508998512f77e8ed7d63c4918980df97de8b7e0c5bb2a2a98c7a1142b6e047040ddff7984e6179f21fb6fbc70fb6628ad60
6
+ metadata.gz: 389b62934467fa0296e801c4078e22184db48e403cd0540a3d3ede2163aaea6d6e7c82a31749706d9d3a52f35fef3943196483941db76cd2e838fc4f79e01dd3
7
+ data.tar.gz: e7134314b1dfe176b13ee5d0646a3823e7f194b22511b56b00b116a430f556c3b483f33db67f6cb7fc86c85a539dd7f2d0526d87a3c47fa1511806c766ffa4cc
@@ -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
@@ -9,6 +9,7 @@ gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
+ gem "equivalent-xml", "~> 0.6"
12
13
  gem "rubocop", "~> 1.7"
13
14
  gem "rubocop-performance"
14
15
  gem "rubocop-rails"
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>
@@ -1,7 +1,5 @@
1
1
  module RelatonIana
2
2
  class DataFetcher
3
- SOURCE = "https://raw.githubusercontent.com/ietf-ribose/iana-registries/main/".freeze
4
-
5
3
  #
6
4
  # Data fetcher initializer
7
5
  #
@@ -13,6 +11,7 @@ module RelatonIana
13
11
  @format = format
14
12
  @ext = format.sub(/^bib/, "")
15
13
  @files = []
14
+ @index = Relaton::Index.find_or_create :IANA, file: "index-v1.yaml"
16
15
  end
17
16
 
18
17
  #
@@ -41,6 +40,7 @@ module RelatonIana
41
40
  rescue StandardError => e
42
41
  warn "Error: #{e.message}. File: #{file}"
43
42
  end
43
+ @index.save
44
44
  end
45
45
 
46
46
  def parse(content)
@@ -70,6 +70,7 @@ module RelatonIana
70
70
  else
71
71
  @files << file
72
72
  end
73
+ @index.add_or_update bib.docnumber, file
73
74
  File.write file, c, encoding: "UTF-8"
74
75
  end
75
76
 
@@ -3,13 +3,20 @@
3
3
  module RelatonIana
4
4
  # Methods for search IANA standards.
5
5
  module IanaBibliography
6
- SOURCE = "https://raw.githubusercontent.com/relaton/relaton-data-iana/main/data/"
6
+ SOURCE = "https://raw.githubusercontent.com/relaton/relaton-data-iana/main/"
7
+ INDEX_FILE = "index-v1.yaml"
7
8
 
8
9
  # @param text [String]
9
10
  # @return [RelatonIana::IanaBibliographicItem]
10
11
  def search(text) # rubocop:disable Metrics/MethodLength
11
- file = text.sub(/^IANA\s/, "").gsub(/[\s,:\/]/, "_").downcase
12
- url = "#{SOURCE}#{file}.yaml"
12
+ # file = text.sub(/^IANA\s/, "").gsub(/[\s,:\/]/, "_").downcase
13
+ # url = "#{SOURCE}#{file}.yaml"
14
+ index = Relaton::Index.find_or_create :IANA, url: "#{SOURCE}index-v1.zip", file: INDEX_FILE
15
+ id = text.sub(/^IANA\s/, "")
16
+ row = index.search(id).min_by { |i| i[:id] }
17
+ return unless row
18
+
19
+ url = "#{SOURCE}#{row[:file]}"
13
20
  resp = Net::HTTP.get_response URI(url)
14
21
  return unless resp.code == "200"
15
22
 
@@ -50,5 +50,12 @@ module RelatonIana
50
50
  def grammar_hash
51
51
  @grammar_hash ||= ::RelatonIana.grammar_hash
52
52
  end
53
+
54
+ #
55
+ # Remove index file
56
+ #
57
+ def remove_index_file
58
+ Relaton::Index.find_or_create(:IANA, url: true, file: IanaBibliography::INDEX_FILE).remove_file
59
+ end
53
60
  end
54
61
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIana
4
- VERSION = "1.14.2"
4
+ VERSION = "1.16.0"
5
5
  end
data/lib/relaton_iana.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
+ require "relaton/index"
4
5
  require "relaton_bib"
5
6
  require_relative "relaton_iana/version"
6
7
  require_relative "relaton_iana/iana_bibliographic_item"
data/relaton_iana.gemspec CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
20
  # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
21
21
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+ # spec.metadata["rubygems_mfa_required"] = "true"
22
23
 
23
24
  # Specify which files should be added to the gem when it is released.
24
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,10 +30,9 @@ Gem::Specification.new do |spec|
29
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
31
  spec.require_paths = ["lib"]
31
32
 
32
- spec.add_development_dependency "equivalent-xml", "~> 0.6"
33
-
34
33
  spec.add_dependency "faraday", "~> 2.7.0"
35
- spec.add_dependency "relaton-bib", "~> 1.14.0"
34
+ spec.add_dependency "relaton-bib", "~> 1.16.0"
35
+ spec.add_dependency "relaton-index", "~> 0.2.0"
36
36
 
37
37
  # Uncomment to register a new dependency of your gem
38
38
  # spec.add_dependency "example-gem", "~> 1.0"
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.2
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-20 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
- name: equivalent-xml
14
+ name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
20
- type: :development
19
+ version: 2.7.0
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.6'
26
+ version: 2.7.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday
28
+ name: relaton-bib
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.7.0
33
+ version: 1.16.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.7.0
40
+ version: 1.16.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: relaton-bib
42
+ name: relaton-index
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.14.0
47
+ version: 0.2.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: 0.2.0
55
55
  description: 'RelatonIana: Ruby XMLDOC impementation.'
56
56
  email:
57
57
  - open.source@ribose.com