relaton-itu 1.7.5 → 1.7.6

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: 2764e22b822215ec681d22f20b979cc80cb498ffa49d87a164a6118575dd686f
4
- data.tar.gz: 9863ca9b6b6d9f76bb3265ef148115de055dd82445c5c058564345e963ada182
3
+ metadata.gz: b5d9ccc48e23558a34cc5af40c8603e64cf7a4ea5d51d7996ea17a4996cfaeec
4
+ data.tar.gz: fa28142b10ee1ef854584ee52854642305c86ad78ff32dc059f30315783ccd9b
5
5
  SHA512:
6
- metadata.gz: '087567111db88be5ee21f16942ce4b80fc07537665b565fb4b0913edcd3e6427196e541775dfaf142ddf9c0b1693d8e0067d7bbbf9602a87293890d6074089ac'
7
- data.tar.gz: f9ca1d2439bcef8bc110a8cfe10cb22ea47e2000b289f3c446459c9e51d036bbf2bb7b1f8c99b798735b02522f7e4985aa78f1cefe36ff868f301795858abdaa
6
+ metadata.gz: b304791f0d90fa0f23c378d30988f7ef1fa4d2abd36c2487fae454bba257019c0811f31354b94d8fb756dfb26eced93ac251d2ba5e64a41edfbc4268129edb08
7
+ data.tar.gz: 4535c1832d38d37f7df709abac6cc52e446f1da1be1704a8a3e4eaa0a98b47667976f88410bf54b73e6e10f50fa5f0807891f23775af772e6ff6d42ee54db18b
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -27,7 +27,13 @@ module RelatonItu
27
27
  elsif ref.match? /^ITU-R/
28
28
  rf = ref.sub(/^ITU-R\s/, "").upcase
29
29
  url = "https://raw.githubusercontent.com/relaton/relaton-data-itu-r/master/data/#{rf}.yaml"
30
- hash = YAML.safe_load Net::HTTP.get(URI(url))
30
+ resp = Net::HTTP.get_response(URI(url))
31
+ if resp.code == "404"
32
+ @array = []
33
+ return
34
+ end
35
+
36
+ hash = YAML.safe_load resp.body
31
37
  item_hash = HashConverter.hash_to_bib(hash)
32
38
  item = ItuBibliographicItem.new **item_hash
33
39
  hit = Hit.new({ url: url }, self)
@@ -105,7 +111,7 @@ module RelatonItu
105
111
  code = h["Media"]["Name"]
106
112
  title = h["Title"]
107
113
  url = h["Redirection"]
108
- type = group.downcase[0...-1]
114
+ type = h["Collection"]["Group"].downcase[0...-1]
109
115
  Hit.new({ code: code, title: title, url: url, type: type }, self)
110
116
  end
111
117
  end
@@ -19,6 +19,12 @@ module RelatonItu
19
19
  # @param text [String]
20
20
  # @return [RelatonItu::HitCollection]
21
21
  def search(text, year = nil)
22
+ # code = text.sub(/(?<=ITU-T\s\w)\.(\w+\.)(?=\d+)/, ' \1')
23
+ if text =~ /(ITU-T\s\w)\.(Suppl\.|Annex)\s?(\w?\d+)/
24
+ correct_ref = "#{$~[1]} #{$~[2]} #{$~[3]}"
25
+ warn "[relaton-itu] WARNING: Incorrect reference #{text}"
26
+ warn "[relaton-itu] the reference should be #{correct_ref}"
27
+ end
22
28
  HitCollection.new text, year
23
29
  rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
24
30
  EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
@@ -71,7 +77,7 @@ module RelatonItu
71
77
 
72
78
  def search_filter(code, year) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
73
79
  %r{
74
- ^(?<pref1>ITU)?(-(?<type1>\w))?\s?(?<code1>[^\s\/]+)
80
+ ^(?<pref1>ITU)?(-(?<type1>\w))?\s?(?<code1>[^\s\/]+(?:\/\w\.\d+)?)
75
81
  (\s\(((?<month1>\d{2})\/)?(?<year1>\d{4})\))?
76
82
  (\s-\s(?<buldate1>\d{2}\.\w{1,4}\.\d{4}))?
77
83
  (\/(?<corr1>(Amd|Cor)\s?\d+))?
@@ -1,3 +1,3 @@
1
1
  module RelatonItu
2
- VERSION = "1.7.5".freeze
2
+ VERSION = "1.7.6".freeze
3
3
  end
data/relaton-itu.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  # spec.add_development_dependency "debase"
30
30
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
31
31
  spec.add_development_dependency "pry-byebug"
32
- spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rake", "~> 13.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
34
  # spec.add_development_dependency "ruby-debug-ide"
35
35
  spec.add_development_dependency "ruby-jing"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-19 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
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: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -153,6 +153,7 @@ files:
153
153
  - README.adoc
154
154
  - Rakefile
155
155
  - bin/console
156
+ - bin/rspec
156
157
  - bin/setup
157
158
  - grammars/basicdoc.rng
158
159
  - grammars/biblio.rng
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
193
  - !ruby/object:Gem::Version
193
194
  version: '0'
194
195
  requirements: []
195
- rubygems_version: 3.2.3
196
+ rubygems_version: 3.0.6
196
197
  signing_key:
197
198
  specification_version: 4
198
199
  summary: 'RelatonItu: retrieve ITU Standards for bibliographic use using the BibliographicItem