relaton-ecma 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 +28 -17
- data/lib/relaton_ecma/config.rb +10 -0
- data/lib/relaton_ecma/ecma_bibliography.rb +3 -4
- data/lib/relaton_ecma/util.rb +9 -0
- data/lib/relaton_ecma/version.rb +1 -1
- data/lib/relaton_ecma.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: 6b71aace87d7e254f0f12d8c79c95567e67f03ab86b3e71784d66feb876419eb
|
4
|
+
data.tar.gz: bf33ddaa1c8b4350cd9b7a43f96657173c4f8ae8997c044f84eb3ad81c44e370
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca703ec7cf5cc4276be529224ee261174618a0c8d7f273b02cae997dce13918598d523b610ca3b01305000a990d95872597631ced2c3c8bd8e998c939488cd2c
|
7
|
+
data.tar.gz: 6c2732b6d3ed06e9c5a93e9b2b44018221f9e5124405481169f15a15dd21c5eadc459e3dd3961c2344ff0ce55f72649a0ceae46bff48426e4788f17e5b14f8fe
|
data/README.adoc
CHANGED
@@ -29,6 +29,20 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
== Usage
|
31
31
|
|
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 `RelatonEcma.configure` block.
|
35
|
+
|
36
|
+
[source,ruby]
|
37
|
+
----
|
38
|
+
require 'relaton_ecma'
|
39
|
+
=> true
|
40
|
+
|
41
|
+
RelatonEcma.configure do |config|
|
42
|
+
config.logger.level = Logger::DEBUG
|
43
|
+
end
|
44
|
+
----
|
45
|
+
|
32
46
|
=== Fetch documents
|
33
47
|
|
34
48
|
Documents can be fetched by reference. The structure of the reference depends on the type of the document. There are three types of documents:
|
@@ -45,27 +59,24 @@ ECMA mementos have the following reference structure: `ECMA MEM/{YEAR}`. Where:
|
|
45
59
|
|
46
60
|
[source,ruby]
|
47
61
|
----
|
48
|
-
require 'relaton_ecma'
|
49
|
-
=> true
|
50
|
-
|
51
62
|
# fetch ECMA standard
|
52
63
|
item = RelatonEcma::EcmaBibliography.get 'ECMA-6'
|
53
|
-
[relaton-ecma] (
|
54
|
-
[relaton-ecma] (
|
64
|
+
[relaton-ecma] (ECMA-6) Fetching from Relaton repository ...
|
65
|
+
[relaton-ecma] (ECMA-6) Found: `ECMA-6`
|
55
66
|
#<RelatonEcma::BibliographicItem:0x00007fc645b11c10
|
56
67
|
...
|
57
68
|
|
58
69
|
# fetch ECMA standard with edition and volume
|
59
70
|
RelatonEcma::EcmaBibliography.get "ECMA-269 ed3 vol2"
|
60
|
-
[relaton-ecma] (
|
61
|
-
[relaton-ecma] (
|
71
|
+
[relaton-ecma] (ECMA-269 ed3 vol2) Fetching from Relaton repository ...
|
72
|
+
[relaton-ecma] (ECMA-269 ed3 vol2) Found: `ECMA-269`
|
62
73
|
=> #<RelatonEcma::BibliographicItem:0x0000000106ac8210
|
63
74
|
...
|
64
75
|
|
65
76
|
# fetch the last edition of ECMA standard
|
66
77
|
bib = RelatonEcma::EcmaBibliography.get "ECMA-269"
|
67
|
-
[relaton-ecma] (
|
68
|
-
[relaton-ecma] (
|
78
|
+
[relaton-ecma] (ECMA-269) Fetching from Relaton repository ...
|
79
|
+
[relaton-ecma] (ECMA-269) Found: `ECMA-269`
|
69
80
|
=> #<RelatonEcma::BibliographicItem:0x000000010a408480
|
70
81
|
...
|
71
82
|
|
@@ -74,8 +85,8 @@ bib.edition.content
|
|
74
85
|
|
75
86
|
# fetch the first volume of ECMA standard
|
76
87
|
bib = RelatonEcma::EcmaBibliography.get "ECMA-269 ed3"
|
77
|
-
[relaton-ecma] (
|
78
|
-
[relaton-ecma] (
|
88
|
+
[relaton-ecma] (ECMA-269 ed3) Fetching from Relaton repository ...
|
89
|
+
[relaton-ecma] (ECMA-269 ed3) Found: `ECMA-269`
|
79
90
|
=> #<RelatonEcma::BibliographicItem:0x000000010a3ed0e0
|
80
91
|
...
|
81
92
|
|
@@ -84,22 +95,22 @@ bib.extent.first.reference_from
|
|
84
95
|
|
85
96
|
# fetch ECMA technical report
|
86
97
|
RelatonEcma::EcmaBibliography.get 'ECMA TR/18'
|
87
|
-
[relaton-ecma] (
|
88
|
-
[relaton-ecma] (
|
98
|
+
[relaton-ecma] (ECMA TR/18) Fetching from Relaton repository ...
|
99
|
+
[relaton-ecma] (ECMA TR/18) Found: `ECMA TR/18`
|
89
100
|
=> #<RelatonEcma::BibliographicItem:0x00007fc645c00cc0
|
90
101
|
...
|
91
102
|
|
92
103
|
# fetch ECMA memento
|
93
104
|
RelatonEcma::EcmaBibliography.get "ECMA MEM/2021"
|
94
|
-
[relaton-ecma] (
|
95
|
-
[relaton-ecma] (
|
105
|
+
[relaton-ecma] (ECMA MEM/2021) Fetching from Relaton repository ...
|
106
|
+
[relaton-ecma] (ECMA MEM/2021) Found: `ECMA MEM/2021`
|
96
107
|
=> #<RelatonEcma::BibliographicItem:0x00007fc665b2f060
|
97
108
|
...
|
98
109
|
|
99
110
|
# Return nil if a document doesn't exist.
|
100
111
|
RelatonEcma::EcmaBibliography.get '1111'
|
101
|
-
[relaton-ecma] (
|
102
|
-
[relaton-ecma]
|
112
|
+
[relaton-ecma] (1111) Fetching from Relaton repository ...
|
113
|
+
[relaton-ecma] (1111) Not found.
|
103
114
|
=> nil
|
104
115
|
----
|
105
116
|
|
@@ -40,14 +40,13 @@ module RelatonEcma
|
|
40
40
|
# @param opts [Hash] not used
|
41
41
|
# @return [RelatonEcma::BibliographicItem] Relaton of reference
|
42
42
|
def get(code, _year = nil, _opts = {})
|
43
|
-
warn "
|
43
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
44
44
|
result = fetch_doc(code)
|
45
45
|
if result
|
46
|
-
warn "
|
46
|
+
Util.warn "(#{code}) Found: `#{result.docidentifier.first.id}`"
|
47
47
|
# item
|
48
48
|
else
|
49
|
-
warn "
|
50
|
-
"The code must be exactly like it is on the standards website."
|
49
|
+
Util.warn "(#{code}) Not found."
|
51
50
|
end
|
52
51
|
result
|
53
52
|
end
|
data/lib/relaton_ecma/version.rb
CHANGED
data/lib/relaton_ecma.rb
CHANGED
@@ -4,6 +4,8 @@ require "yaml"
|
|
4
4
|
require "relaton/index"
|
5
5
|
require "relaton_bib"
|
6
6
|
require "relaton_ecma/version"
|
7
|
+
require "relaton_ecma/config"
|
8
|
+
require "relaton_ecma/util"
|
7
9
|
require "relaton_ecma/bibliographic_item"
|
8
10
|
require "relaton_ecma/xml_parser"
|
9
11
|
require "relaton_ecma/hash_converter"
|
@@ -15,9 +17,9 @@ module RelatonEcma
|
|
15
17
|
# Returns hash of XML reammar
|
16
18
|
# @return [String]
|
17
19
|
def self.grammar_hash
|
18
|
-
gem_path = File.expand_path "..", __dir__
|
19
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
20
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
21
|
-
Digest::MD5.hexdigest grammars
|
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 RelatonEcma::VERSION + RelatonBib::VERSION # grammars
|
22
24
|
end
|
23
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ecma
|
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
|
@@ -79,11 +79,13 @@ files:
|
|
79
79
|
- grammars/relaton-ecma.rng
|
80
80
|
- lib/relaton_ecma.rb
|
81
81
|
- lib/relaton_ecma/bibliographic_item.rb
|
82
|
+
- lib/relaton_ecma/config.rb
|
82
83
|
- lib/relaton_ecma/data_fetcher.rb
|
83
84
|
- lib/relaton_ecma/data_parser.rb
|
84
85
|
- lib/relaton_ecma/ecma_bibliography.rb
|
85
86
|
- lib/relaton_ecma/hash_converter.rb
|
86
87
|
- lib/relaton_ecma/processor.rb
|
88
|
+
- lib/relaton_ecma/util.rb
|
87
89
|
- lib/relaton_ecma/version.rb
|
88
90
|
- lib/relaton_ecma/xml_parser.rb
|
89
91
|
- relaton_ecma.gemspec
|