relaton-calconnect 1.16.0 → 1.16.2

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: 022a2e1344a1dae7a3b3868026d21009d445ea87a9531b179e992efc3dda0764
4
- data.tar.gz: d77e832b03b27a8eecf378c4c69c485d03225b314c9d5103b70be9532b01c3ad
3
+ metadata.gz: 1e9b39e5854826af4fd403a0950199d18cfbe84595ba5f130231447493f0ea70
4
+ data.tar.gz: 072a5d18b306ad1b7026827fa6dde7bdf788011c4d98d3626661b79d8af5290d
5
5
  SHA512:
6
- metadata.gz: 0e722cb6c328c914c8849d758cc7ecb9c516035c0bacbd9db3cce0e9d0088c44f279e1cd85e5aa31f8d5b07f29e621f32ea5a33a2a1dedb301d406e0ab5cc3ba
7
- data.tar.gz: bf0cf4947e3f2048761e99ecce3c1a2187772b5a42af42e6d40009dbb9bc0417a6257d3f3a63eebdd23937be022f2ca8b232ca6f46e6805b727674d9566ac0e4
6
+ metadata.gz: e8d9841765bf6d9b88fa4b72601dd59df2ee965a13fd5c1f9f426d9dca56f0e4ac1ccc7da79c5fa8342c7f8285ae8261c0672432503b1fcda3040d47d6e2537e
7
+ data.tar.gz: 47c1637ef733f17083d311919020153adc96632d2262fd8c4e7d96646653773cfdbf5fa768f333d5dd221ad75d10f2b3dd72cfea2dbf79f1bc7b05a48735ecd5
data/README.adoc CHANGED
@@ -23,13 +23,24 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
26
- === Search for a standard using keywords
26
+ === Configuration
27
+
28
+ Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonCalconnect.configure` block.
27
29
 
28
30
  [source,ruby]
29
31
  ----
30
32
  require 'relaton_calconnect'
31
33
  => true
32
34
 
35
+ RelatonCalconnect.configure do |config|
36
+ config.logger.level = Logger::DEBUG
37
+ end
38
+ ----
39
+
40
+ === Search for a standard using keywords
41
+
42
+ [source,ruby]
43
+ ----
33
44
  hits = RelatonCalconnect::CcBibliography.search("CC/DIR 10005:2019")
34
45
  => <RelatonCalconnect::HitCollection:0x007f98e34a8bb0 @ref=CC/DIR 10005:2019 @fetched=false>
35
46
 
@@ -91,8 +102,8 @@ item.link
91
102
  [source,ruby]
92
103
  ----
93
104
  RelatonCalconnect::CcBibliography.get "CC/DIR 10005", "2019", {}
94
- [relaton-calconnect] ("CC/DIR 10005") fetching...
95
- [relaton-calconnect] ("CC/DIR 10005") found CC/DIR 10005:2019
105
+ [relaton-calconnect] (CC/DIR 10005) Fetching from Relaton repository ...
106
+ [relaton-calconnect] (CC/DIR 10005) Found: `CC/DIR 10005:2019`
96
107
  => #<RelatonCalconnect::CcBibliographicItem:0x007f9a73dfa290
97
108
  ...
98
109
  ----
@@ -29,13 +29,14 @@ module RelatonCalconnect
29
29
  end
30
30
  end
31
31
 
32
- warn "[relaton-calconnect] (\"#{ref}\") fetching..."
32
+ Util.warn "(#{ref}) Fetching from Relaton repository ..."
33
33
  result = search(code, year, opts) || (return nil)
34
34
  ret = bib_results_filter(result, year)
35
35
  if ret[:ret]
36
- warn "[relaton-calconnect] (\"#{ref}\") found #{ret[:ret].docidentifier.first.id}"
36
+ Util.warn "(#{ref}) Found: `#{ret[:ret].docidentifier.first.id}`"
37
37
  ret[:ret]
38
38
  else
39
+ Util.warn "(#{ref}) No found."
39
40
  fetch_ref_err(code, year, ret[:years])
40
41
  end
41
42
  end
@@ -73,12 +74,12 @@ module RelatonCalconnect
73
74
  # @param year [String]
74
75
  # @param missed_years [Array<Strig>]
75
76
  def fetch_ref_err(code, year, missed_years)
76
- id = year ? "#{code} year #{year}" : code
77
- warn "[relaton-calconnect] WARNING: no match found online for #{id}. " \
78
- "The code must be exactly like it is on the standards website."
77
+ # id = year ? "`#{code}` year `#{year}`" : code
78
+ # Util.warn "WARNING: No match found online for #{id}. " \
79
+ # "The code must be exactly like it is on the standards website."
79
80
  unless missed_years.empty?
80
- warn "[relaton-calconnect] (There was no match for #{year}, though " \
81
- "there were matches found for #{missed_years.join(', ')}.)"
81
+ Util.warn "There was no match for `#{year}`, though there " \
82
+ "were matches found for `#{missed_years.join('`, `')}`."
82
83
  end
83
84
  nil
84
85
  end
@@ -0,0 +1,10 @@
1
+ module RelatonCalconnect
2
+ module Config
3
+ include RelatonBib::Config
4
+ end
5
+ extend Config
6
+
7
+ class Configuration < RelatonBib::Configuration
8
+ PROGNAME = "relaton-calconnect".freeze
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module RelatonCalconnect
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonCalconnect.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonCalconnect
2
- VERSION = "1.16.0".freeze
2
+ VERSION = "1.16.2".freeze
3
3
  end
@@ -3,7 +3,7 @@ module RelatonCalconnect
3
3
  class << self
4
4
  # override RelatonBib::BibliographicItem.bib_item method
5
5
  # @param item_hash [Hash]
6
- # @return [RelatonIsoBib::IsoBibliographicItem]
6
+ # @return [RelatonCalconnect::CcBibliographicItem]
7
7
  def bib_item(item_hash)
8
8
  CcBibliographicItem.new(**item_hash)
9
9
  end
@@ -1,6 +1,8 @@
1
1
  require "relaton/index"
2
2
  require "relaton_bib"
3
3
  require "relaton_calconnect/version"
4
+ require "relaton_calconnect/config"
5
+ require "relaton_calconnect/util"
4
6
  require "relaton_calconnect/cc_bibliography"
5
7
  require "relaton_calconnect/hit_collection"
6
8
  require "relaton_calconnect/hit"
@@ -17,9 +19,9 @@ module RelatonCalconnect
17
19
  # Returns hash of XML reammar
18
20
  # @return [String]
19
21
  def self.grammar_hash
20
- gem_path = File.expand_path "..", __dir__
21
- grammars_path = File.join gem_path, "grammars", "*"
22
- grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
23
- Digest::MD5.hexdigest grammars
22
+ # gem_path = File.expand_path "..", __dir__
23
+ # grammars_path = File.join gem_path, "grammars", "*"
24
+ # grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
25
+ Digest::MD5.hexdigest RelatonCalconnect::VERSION + RelatonBib::VERSION # grammars
24
26
  end
25
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-calconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.16.2
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-09-03 00:00:00.000000000 Z
11
+ date: 2023-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -80,6 +80,7 @@ files:
80
80
  - lib/relaton_calconnect.rb
81
81
  - lib/relaton_calconnect/cc_bibliographic_item.rb
82
82
  - lib/relaton_calconnect/cc_bibliography.rb
83
+ - lib/relaton_calconnect/config.rb
83
84
  - lib/relaton_calconnect/data_fetcher.rb
84
85
  - lib/relaton_calconnect/hash_converter.rb
85
86
  - lib/relaton_calconnect/hit.rb
@@ -87,6 +88,7 @@ files:
87
88
  - lib/relaton_calconnect/processor.rb
88
89
  - lib/relaton_calconnect/scrapper.rb
89
90
  - lib/relaton_calconnect/technical_committee.rb
91
+ - lib/relaton_calconnect/util.rb
90
92
  - lib/relaton_calconnect/version.rb
91
93
  - lib/relaton_calconnect/xml_parser.rb
92
94
  - relaton_calconnect.gemspec