relaton-xsf 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 +14 -3
- data/lib/relaton_xsf/bibliography.rb +3 -3
- data/lib/relaton_xsf/config.rb +10 -0
- data/lib/relaton_xsf/data_fetcher.rb +4 -4
- data/lib/relaton_xsf/util.rb +9 -0
- data/lib/relaton_xsf/version.rb +1 -1
- data/lib/relaton_xsf.rb +2 -0
- 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: 55224ca726b71e88f72069ef99931b8433c0cce2ab1ed3f9edf6d0f1fba90b28
|
4
|
+
data.tar.gz: 5f72562f59feb8e466d29439486252d22e830abb3e023ddaaab36637b5086f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcbe15d18d80f5f1c8922e430c99ad3d204a1bd2a3e69797a097e49f663116d154d6d88ccb5e6b01418b5a19ddfc4a2afca325e23b3ff074c738975f97d22121
|
7
|
+
data.tar.gz: 1b7f92d6dfc8cbac7010ad4c346dd1cb97a221362cf50c2c4c5a13a7a646fbbe2e5c3fe015c05afa42dfbb884a0be0073bc87b77a77f014aaced38bda6bb1958
|
data/README.adoc
CHANGED
@@ -38,13 +38,24 @@ Or install it yourself as:
|
|
38
38
|
|
39
39
|
== Usage
|
40
40
|
|
41
|
-
===
|
41
|
+
=== Configuration
|
42
|
+
|
43
|
+
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 `RelatonXsf.configure` block.
|
42
44
|
|
43
45
|
[source,ruby]
|
44
46
|
----
|
45
47
|
require 'relaton_xsf'
|
46
48
|
=> true
|
47
49
|
|
50
|
+
RelatonXsf.configure do |config|
|
51
|
+
config.logger.level = Logger::DEBUG
|
52
|
+
end
|
53
|
+
----
|
54
|
+
|
55
|
+
=== Search for a standard using keywords
|
56
|
+
|
57
|
+
[source,ruby]
|
58
|
+
----
|
48
59
|
hit_collection = RelatonXsf::Bibliography.search("XEP 0001")
|
49
60
|
=> <RelatonXsf::HitCollection:0x00000000019780 @ref=XEP 0001 @fetched=false>
|
50
61
|
|
@@ -81,8 +92,8 @@ item.to_xml bibdata: true
|
|
81
92
|
[source,ruby]
|
82
93
|
----
|
83
94
|
item = RelatonXsf::Bibliography.get "XEP 0001"
|
84
|
-
[relaton-xsf] (XEP 0001)
|
85
|
-
[relaton-xsf] (XEP 0001)
|
95
|
+
[relaton-xsf] (XEP 0001) Fetching from Relaton repository ...
|
96
|
+
[relaton-xsf] (XEP 0001) Found `XEP 0001`
|
86
97
|
=> #<RelatonXsf::BibliographicItem:0x000000011275cd18
|
87
98
|
...
|
88
99
|
|
@@ -7,15 +7,15 @@ module RelatonXsf
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def get(code, _year = nil, _opts = {})
|
10
|
-
warn "
|
10
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
11
11
|
result = search(code)
|
12
12
|
if result.empty?
|
13
|
-
warn "
|
13
|
+
Util.warn "(#{code}) Not found."
|
14
14
|
return
|
15
15
|
end
|
16
16
|
|
17
17
|
bib = result.first.fetch
|
18
|
-
warn "
|
18
|
+
Util.warn "(#{code}) Found: `#{bib.docidentifier.first.id}`"
|
19
19
|
bib
|
20
20
|
end
|
21
21
|
end
|
@@ -10,14 +10,14 @@ module RelatonXsf
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.fetch(output: "data", format: "yaml")
|
13
|
-
warn "
|
13
|
+
warn "fetching data to #{output} in #{format} format"
|
14
14
|
t1 = Time.now
|
15
|
-
warn "
|
15
|
+
warn "start at #{t1}"
|
16
16
|
FileUtils.mkdir_p output
|
17
17
|
new(output, format).fetch
|
18
18
|
t2 = Time.now
|
19
19
|
t = t2 - t1
|
20
|
-
warn "
|
20
|
+
warn "finished at #{t2} (#{t.round} seconds)"
|
21
21
|
end
|
22
22
|
|
23
23
|
def index
|
@@ -39,7 +39,7 @@ module RelatonXsf
|
|
39
39
|
id = bib.docidentifier.find(&:primary).id
|
40
40
|
file = File.join @output, "#{id.gsub(' ', '-').downcase}.#{@ext}"
|
41
41
|
if @files.include? file
|
42
|
-
warn "
|
42
|
+
warn "WARNING: #{file} already exists"
|
43
43
|
end
|
44
44
|
File.write file, serialize(bib), encoding: "UTF-8"
|
45
45
|
@files << file
|
data/lib/relaton_xsf/version.rb
CHANGED
data/lib/relaton_xsf.rb
CHANGED
@@ -4,6 +4,8 @@ require "mechanize"
|
|
4
4
|
require "relaton/index"
|
5
5
|
require "relaton_bib"
|
6
6
|
require_relative "relaton_xsf/version"
|
7
|
+
require_relative "relaton_xsf/config"
|
8
|
+
require_relative "relaton_xsf/util"
|
7
9
|
require_relative "relaton_xsf/bibliographic_item"
|
8
10
|
require_relative "relaton_xsf/bibliography"
|
9
11
|
require_relative "relaton_xsf/hit_collection"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-xsf
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -70,11 +70,13 @@ files:
|
|
70
70
|
- lib/relaton_xsf/bibliographic_item.rb
|
71
71
|
- lib/relaton_xsf/bibliography.rb
|
72
72
|
- lib/relaton_xsf/bibxml_parser.rb
|
73
|
+
- lib/relaton_xsf/config.rb
|
73
74
|
- lib/relaton_xsf/data_fetcher.rb
|
74
75
|
- lib/relaton_xsf/hash_converter.rb
|
75
76
|
- lib/relaton_xsf/hit.rb
|
76
77
|
- lib/relaton_xsf/hit_collection.rb
|
77
78
|
- lib/relaton_xsf/processor.rb
|
79
|
+
- lib/relaton_xsf/util.rb
|
78
80
|
- lib/relaton_xsf/version.rb
|
79
81
|
- lib/relaton_xsf/xml_parser.rb
|
80
82
|
- sig/relaton_xsf.rbs
|