relaton-jis 1.16.0 → 1.16.1

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: 6227e97046cb6fa42f7a00f120713279fd0dc673b1cbee2ecbf550e595fb46dd
4
- data.tar.gz: f952fc50ae5a6fdc7b839af1956457d9c4c6c1041e61557b2f7493a8b6b0c96f
3
+ metadata.gz: c2ee66af10fcc5b78823a228bc7ac31263f8cd52f9e8fbbfdfb47ac500eb9c4a
4
+ data.tar.gz: 68ddb0faf39ad33cd96edd29f072e41787b7c9fa262c5647768f12a481f5e2a7
5
5
  SHA512:
6
- metadata.gz: 227152cc685526b2375b53de5201a3a819b33deec0391870513f9f7eca493030809ba92a8137323c795724800821b530d651e1f1ccf48bfb1bae19b1c2d39832
7
- data.tar.gz: e67f10b5df5c9305b98b4627e4f9801751c7bd13a1545997f08d7d1d0f6717939c42c957a84535e05fc364e2ba08fb364432c7e2e1cf4e04b5bf96897c19f2b5
6
+ metadata.gz: b8c365ed292ca2405923fc74b5f9f3682bf7c95aef6cf2caa4a54e7d479203b617a530a19bf17c5ff9efb9365781f5c4b603ae7d1ec51fd467ff235eb4eed230
7
+ data.tar.gz: 74d12f5337f22272db21fb76264a18b8d2be376d96f116ae6235f712388e4eb074d8c6a7806a24860be3ac560ff4d983899a043cf02d3b2183a03a0b2c39ce3f
@@ -36,7 +36,7 @@ module RelatonJis
36
36
  def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
37
37
  code = ref.sub(/\s\((all parts|規格群)\)/, "")
38
38
  opts[:all_parts] ||= !$1.nil?
39
- warn "[relaton-jis] (\"#{ref}\") fetching..."
39
+ Util.warn "(#{ref}) fetching..."
40
40
  hits = search(code, year)
41
41
  unless hits
42
42
  hint [], ref, year
@@ -44,7 +44,7 @@ module RelatonJis
44
44
  end
45
45
  result = opts[:all_parts] ? hits.find_all_parts : hits.find
46
46
  if result.is_a? RelatonJis::BibliographicItem
47
- warn "[relaton-jis] (\"#{ref}\") found #{result.docidentifier[0].id}"
47
+ Util.warn "(#{ref}) found `#{result.docidentifier[0].id}`"
48
48
  return result
49
49
  end
50
50
  hint result, ref, year
@@ -58,12 +58,13 @@ module RelatonJis
58
58
  # @param [String, nil] year year to search
59
59
  #
60
60
  def hint(result, ref, year)
61
- warn "[relaton-jis] (\"#{ref}\") not found. The identifier must be " \
62
- "exactly as shown on the webdesk.jsa.or.jp website."
61
+ Util.warn "(#{ref}) not found. The identifier must be " \
62
+ "exactly as shown on the webdesk.jsa.or.jp website."
63
63
  if result.any?
64
- warn "[relaton-jis] (\"#{ref}\") TIP: No match for edition " \
65
- "year #{year}, but matches exist for #{result.uniq.join(', ')}."
64
+ Util.warn "(#{ref}) TIP: No match for edition year `#{year}`, " \
65
+ "but matches exist for `#{result.uniq.join('`, `')}`."
66
66
  end
67
+ nil
67
68
  end
68
69
  end
69
70
  end
@@ -0,0 +1,10 @@
1
+ module RelatonJis
2
+ module Config
3
+ include RelatonBib::Config
4
+ end
5
+ extend Config
6
+
7
+ class Configuration < RelatonBib::Configuration
8
+ PROGNAME = "relaton-jis".freeze
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module RelatonJis
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonJis.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonJis
4
- VERSION = "1.16.0"
4
+ VERSION = "1.16.1"
5
5
  end
data/lib/relaton_jis.rb CHANGED
@@ -3,6 +3,8 @@
3
3
  require "mechanize"
4
4
  require "relaton_iso_bib"
5
5
  require_relative "relaton_jis/version"
6
+ require_relative "relaton_jis/config"
7
+ require_relative "relaton_jis/util"
6
8
  require_relative "relaton_jis/bibliographic_item"
7
9
  require_relative "relaton_jis/xml_parser"
8
10
  require_relative "relaton_jis/hash_converter"
@@ -17,9 +19,9 @@ module RelatonJis
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 RelatonJis::VERSION + RelatonIsoBib::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-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.16.1
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-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -60,11 +60,13 @@ files:
60
60
  - lib/relaton_jis.rb
61
61
  - lib/relaton_jis/bibliographic_item.rb
62
62
  - lib/relaton_jis/bibliography.rb
63
+ - lib/relaton_jis/config.rb
63
64
  - lib/relaton_jis/hash_converter.rb
64
65
  - lib/relaton_jis/hit.rb
65
66
  - lib/relaton_jis/hit_collection.rb
66
67
  - lib/relaton_jis/processor.rb
67
68
  - lib/relaton_jis/scraper.rb
69
+ - lib/relaton_jis/util.rb
68
70
  - lib/relaton_jis/version.rb
69
71
  - lib/relaton_jis/xml_parser.rb
70
72
  - relaton_jis.gemspec