relaton-cie 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 +4 -4
- data/README.adoc +16 -5
- data/lib/relaton_cie/cie_bibliography.rb +3 -4
- data/lib/relaton_cie/config.rb +10 -0
- data/lib/relaton_cie/util.rb +9 -0
- data/lib/relaton_cie/version.rb +1 -1
- data/lib/relaton_cie.rb +6 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 561352bffe788d129ff1c272153061bd306227e93f30b2e85ccf09bf93d4cc40
|
4
|
+
data.tar.gz: 9a247f69e38255bb6a4ed8dbbd567762bc783df5a4f321f0f539ff6ce216a3b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 301d5f5d99a0f5812e986629cf25a7b195c1acef3e1600c11814176c7f3005868ceb81cb6ada5ee01f135626c2e3cd2c13602df1ee1a8e4dffe12737b857ef8c
|
7
|
+
data.tar.gz: d485fef67999bef353f2777cd527e642d5e5a698e32858550ceca4e58ec9b3f9986881e5ede1d47ab110cfd2b199a594ae0b02bcc3017165f9658b89779e2034
|
data/README.adoc
CHANGED
@@ -29,23 +29,34 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
== Usage
|
31
31
|
|
32
|
-
===
|
32
|
+
=== Configuration
|
33
|
+
|
34
|
+
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 `RelatonCie.configure` block.
|
33
35
|
|
34
36
|
[source,ruby]
|
35
37
|
----
|
36
38
|
require 'relaton_cie'
|
37
39
|
=> true
|
38
40
|
|
41
|
+
RelatonCie.configure do |config|
|
42
|
+
config.logger.level = Logger::DEBUG
|
43
|
+
end
|
44
|
+
----
|
45
|
+
|
46
|
+
=== Search document
|
47
|
+
|
48
|
+
[source,ruby]
|
49
|
+
----
|
39
50
|
item = RelatonCie::CieBibliography.get 'CIE 001-1980'
|
40
|
-
[relaton-cie] (
|
41
|
-
[relaton-cie] (
|
51
|
+
[relaton-cie] (CIE 001-1980) fetching...
|
52
|
+
[relaton-cie] (CIE 001-1980) found `CIE 001-1980`
|
42
53
|
=> #<RelatonBib::BibliographicItem:0x007fb3f6098920
|
43
54
|
...
|
44
55
|
|
45
56
|
# Return nil if a document doesn't exist.
|
46
57
|
RelatonCie::CieBibliography.get '1111'
|
47
|
-
[relaton-cie] (
|
48
|
-
[relaton-cie] WARNING no match found online for 1111
|
58
|
+
[relaton-cie] (1111) fetching...
|
59
|
+
[relaton-cie] WARNING no match found online for `1111`. The code must be exactly like it is on the standards website.
|
49
60
|
=> nil
|
50
61
|
----
|
51
62
|
|
@@ -15,13 +15,12 @@ module RelatonCie
|
|
15
15
|
# @param opts [Hash] not used
|
16
16
|
# @return [RelatonCie::BibliographicItem] Relaton of reference
|
17
17
|
def get(code, _year = nil, _opts = {})
|
18
|
-
warn "
|
18
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
19
19
|
result = search code
|
20
20
|
if result
|
21
|
-
warn "
|
21
|
+
Util.warn "(#{code}) Found: `#{result.docidentifier.first.id}`"
|
22
22
|
else
|
23
|
-
warn "
|
24
|
-
"The code must be exactly like it is on the standards website."
|
23
|
+
Util.warn "(#{code}) Not found."
|
25
24
|
end
|
26
25
|
result
|
27
26
|
end
|
data/lib/relaton_cie/version.rb
CHANGED
data/lib/relaton_cie.rb
CHANGED
@@ -5,6 +5,8 @@ require "relaton/index"
|
|
5
5
|
require "relaton_bib"
|
6
6
|
# require "relaton_bib/name_parser"
|
7
7
|
require "relaton_cie/version"
|
8
|
+
require "relaton_cie/config"
|
9
|
+
require "relaton_cie/util"
|
8
10
|
require "relaton_cie/bibliographic_item"
|
9
11
|
require "relaton_cie/cie_bibliography"
|
10
12
|
require "relaton_cie/scrapper"
|
@@ -16,9 +18,9 @@ module RelatonCie
|
|
16
18
|
# Returns hash of XML reammar
|
17
19
|
# @return [String]
|
18
20
|
def self.grammar_hash
|
19
|
-
gem_path = File.expand_path "..", __dir__
|
20
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
21
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
22
|
-
Digest::MD5.hexdigest grammars
|
21
|
+
# gem_path = File.expand_path "..", __dir__
|
22
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
23
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
24
|
+
Digest::MD5.hexdigest RelatonCie::VERSION + RelatonBib::VERSION # grammars
|
23
25
|
end
|
24
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-cie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
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-
|
11
|
+
date: 2023-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -95,10 +95,12 @@ files:
|
|
95
95
|
- lib/relaton_cie.rb
|
96
96
|
- lib/relaton_cie/bibliographic_item.rb
|
97
97
|
- lib/relaton_cie/cie_bibliography.rb
|
98
|
+
- lib/relaton_cie/config.rb
|
98
99
|
- lib/relaton_cie/data_fetcher.rb
|
99
100
|
- lib/relaton_cie/hash_converter.rb
|
100
101
|
- lib/relaton_cie/processor.rb
|
101
102
|
- lib/relaton_cie/scrapper.rb
|
103
|
+
- lib/relaton_cie/util.rb
|
102
104
|
- lib/relaton_cie/version.rb
|
103
105
|
- lib/relaton_cie/xml_parser.rb
|
104
106
|
- relaton_cie.gemspec
|