glossarist 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f22479e4e171b68688f2be4ac4e43826a644d106ecaac478c91d7f05afe19271
|
4
|
+
data.tar.gz: e0bcd25c609656d4ed5eec57b82e10c7a33a56f9a78513c93394bc26dc69abe5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34333ae5aeecddb918c973a708b921684ae459b9e4980c4b8718bd49c8283a1ec50a0a74a785791eabb1ed32d4537b665f79607fc0b6b3722dfa861d4b04fa81
|
7
|
+
data.tar.gz: 2f616084f0bbad3643907bff900828590c834e8dbf27bb72e12b248c427afddcbbd52fac67736624dd7712c5f7fcc01163170e9e376ea69b453803c75c149c3a
|
@@ -5,6 +5,7 @@ module Glossarist
|
|
5
5
|
# Path to concepts directory.
|
6
6
|
# @return [String]
|
7
7
|
attr_accessor :path
|
8
|
+
attr_accessor :localized_concepts_path
|
8
9
|
|
9
10
|
# @param path [String]
|
10
11
|
# concepts directory path, either absolute or relative to CWD
|
@@ -36,7 +37,7 @@ module Glossarist
|
|
36
37
|
concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date, Time])
|
37
38
|
concept_hash["uuid"] = concept_hash["id"] || File.basename(filename, ".*")
|
38
39
|
|
39
|
-
concept =
|
40
|
+
concept = Config.class_for(:managed_concept).new(concept_hash)
|
40
41
|
concept.localized_concepts.each do |_lang, id|
|
41
42
|
localized_concept = load_localized_concept(id)
|
42
43
|
concept.add_l10n(localized_concept)
|
@@ -60,8 +61,10 @@ module Glossarist
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def save_concept_to_file(concept)
|
64
|
+
@localized_concepts_path ||= "localized_concept"
|
63
65
|
concept_dir = File.join(path, "concept")
|
64
|
-
|
66
|
+
|
67
|
+
localized_concept_dir = File.join(path, @localized_concepts_path)
|
65
68
|
|
66
69
|
Dir.mkdir(concept_dir) unless Dir.exist?(concept_dir)
|
67
70
|
Dir.mkdir(localized_concept_dir) unless Dir.exist?(localized_concept_dir)
|
@@ -86,7 +89,30 @@ module Glossarist
|
|
86
89
|
end
|
87
90
|
|
88
91
|
def localized_concept_path(id)
|
89
|
-
|
92
|
+
localized_concept_possible_dir = {
|
93
|
+
"localized_concept" => File.join(
|
94
|
+
path,
|
95
|
+
"localized_concept",
|
96
|
+
"#{id}.{yaml,yml}",
|
97
|
+
),
|
98
|
+
|
99
|
+
"localized-concept" => File.join(
|
100
|
+
path,
|
101
|
+
"localized-concept",
|
102
|
+
"#{id}.{yaml,yml}",
|
103
|
+
),
|
104
|
+
}
|
105
|
+
|
106
|
+
localized_concept_possible_dir.each do |dir_name, file_path|
|
107
|
+
actual_path = Dir.glob(file_path)&.first
|
108
|
+
|
109
|
+
if actual_path
|
110
|
+
@localized_concepts_path = dir_name
|
111
|
+
return actual_path
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
actual_path
|
90
116
|
end
|
91
117
|
|
92
118
|
def v1_collection?
|
data/lib/glossarist/config.rb
CHANGED
@@ -17,7 +17,7 @@ module Glossarist
|
|
17
17
|
|
18
18
|
def managed_concepts=(managed_concepts = [])
|
19
19
|
managed_concepts.each do |managed_concept|
|
20
|
-
store(
|
20
|
+
store(Config.class_for(:managed_concept).new(managed_concept))
|
21
21
|
end
|
22
22
|
|
23
23
|
@managed_concepts.values
|
@@ -53,7 +53,7 @@ module Glossarist
|
|
53
53
|
# ManagedConcept ID
|
54
54
|
# @return [ManagedConcept]
|
55
55
|
def fetch_or_initialize(id)
|
56
|
-
fetch(id) or store(
|
56
|
+
fetch(id) or store(Config.class_for(:managed_concept).new(data: { id: id }))
|
57
57
|
end
|
58
58
|
|
59
59
|
# Adds concept to the collection. If collection contains a concept with
|
data/lib/glossarist/v1_reader.rb
CHANGED
@@ -9,8 +9,8 @@ module Glossarist
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def load_concept_from_file(filename)
|
12
|
-
concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date])
|
13
|
-
|
12
|
+
concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date, Time])
|
13
|
+
Config.class_for(:managed_concept).new(generate_v2_concept_hash(concept_hash))
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
data/lib/glossarist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossarist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton
|