termium 0.4.0 → 0.4.1
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 +4 -4
- data/.github/workflows/release.yml +5 -0
- data/lib/termium/core.rb +27 -14
- data/lib/termium/language_module.rb +23 -9
- data/lib/termium/version.rb +1 -1
- data/lib/termium.rb +4 -0
- data/termium.gemspec +4 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8b3fe1c60b2aeb9208c7b090abacba70c8eb152964a583d48f85aaee34dcca35
|
|
4
|
+
data.tar.gz: ff073afb1ca7b6a82b838015342fde5c66944a64f5f6d253a273fac22826a362
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d674955f7dbe077c9ea7c8804e9c60cef8cf59a46091810c7dece5e74302e732345c4419e34afa58061420232ee4136e26309fdb3f6ed0e2239bee7b4216a65
|
|
7
|
+
data.tar.gz: 210e8872e94578af94f3b5a66d7c398ed4485a3d89002baf797abf4bf84d095502b56e2d9d5695dfef26ee53f689c1fa699c8c87499aa63e46c984875f999d30
|
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
name: release
|
|
4
4
|
|
|
5
|
+
# packages: write matches the ceiling the called chain declares
|
|
6
|
+
# (relaton/support release.yml, metanorma/ci rubygems-release.yml);
|
|
7
|
+
# a reusable workflow cannot exceed the caller's grant, and a missing
|
|
8
|
+
# permission here startup-fails the run before any job starts.
|
|
5
9
|
permissions:
|
|
6
10
|
contents: write
|
|
7
11
|
id-token: write
|
|
8
12
|
pull-requests: write
|
|
13
|
+
packages: write
|
|
9
14
|
|
|
10
15
|
on:
|
|
11
16
|
workflow_dispatch:
|
data/lib/termium/core.rb
CHANGED
|
@@ -45,8 +45,12 @@ module Termium
|
|
|
45
45
|
# details="Compartment - ISO/IEC JTC 1 Information Technology Vocabulary" />
|
|
46
46
|
def to_concept(options = {})
|
|
47
47
|
Glossarist::ManagedConcept.new.tap do |concept|
|
|
48
|
-
#
|
|
49
|
-
|
|
48
|
+
# `data` must be assigned, not mutated: lutaml-model skips serializing
|
|
49
|
+
# attributes still flagged as using their default, so mutating the
|
|
50
|
+
# default `ManagedConceptData` in place drops the whole `data` block.
|
|
51
|
+
concept.data = Glossarist::ManagedConceptData.new(
|
|
52
|
+
id: identification_number,
|
|
53
|
+
)
|
|
50
54
|
|
|
51
55
|
concept.uuid = uuid
|
|
52
56
|
|
|
@@ -55,24 +59,33 @@ module Termium
|
|
|
55
59
|
concept.status = "valid"
|
|
56
60
|
|
|
57
61
|
if options[:date_accepted]
|
|
58
|
-
concept.date_accepted =
|
|
62
|
+
concept.date_accepted = Glossarist::ConceptDate.new(
|
|
63
|
+
date: options[:date_accepted],
|
|
64
|
+
type: "accepted",
|
|
65
|
+
)
|
|
59
66
|
end
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
add_localizations(concept, options)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def add_localizations(concept, options)
|
|
75
|
+
language_module.each do |lang_mod|
|
|
76
|
+
localized_concept = lang_mod.to_concept(options)
|
|
63
77
|
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
# TODO: This is needed to skip the empty french entries of 10031781 and 10031778
|
|
79
|
+
next if localized_concept.nil?
|
|
66
80
|
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
localized_concept.id = identification_number
|
|
82
|
+
localized_concept.uuid = uuid("#{identification_number}-#{lang_mod.language}")
|
|
69
83
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
localized_concept.sources = concept_sources
|
|
74
|
-
concept.add_localization(localized_concept)
|
|
84
|
+
universal_entry.each do |entry|
|
|
85
|
+
localized_concept.notes << Glossarist::DetailedDefinition.new(content: entry.value)
|
|
75
86
|
end
|
|
87
|
+
localized_concept.sources = concept_sources
|
|
88
|
+
concept.add_localization(localized_concept)
|
|
76
89
|
end
|
|
77
90
|
end
|
|
78
91
|
end
|
|
@@ -50,14 +50,15 @@ module Termium
|
|
|
50
50
|
|
|
51
51
|
def to_h
|
|
52
52
|
# TODO: This is needed to skip the empty french entries of 10031781 and 10031778
|
|
53
|
-
|
|
53
|
+
value = definition
|
|
54
|
+
return nil unless value
|
|
54
55
|
|
|
55
56
|
src = {
|
|
56
57
|
"language_code" => LANGUAGE_CODE_MAPPING[language.downcase],
|
|
57
58
|
"terms" => designations.map(&:to_h),
|
|
58
|
-
"definition" => [
|
|
59
|
-
"notes" => notes,
|
|
60
|
-
"examples" => examples,
|
|
59
|
+
"definition" => detailed_definitions([value]),
|
|
60
|
+
"notes" => detailed_definitions(notes),
|
|
61
|
+
"examples" => detailed_definitions(examples),
|
|
61
62
|
"entry_status" => "valid",
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -70,15 +71,28 @@ module Termium
|
|
|
70
71
|
x = to_h
|
|
71
72
|
return nil unless x
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
# The flat hash belongs under "data": LocalizedConcept is data-backed, and
|
|
75
|
+
# `.new` would silently discard every key that is not one of its own
|
|
76
|
+
# attributes. `of_yaml` also routes "terms" through ConceptData.
|
|
77
|
+
Glossarist::LocalizedConcept.of_yaml({ "data" => x }).tap do |concept|
|
|
74
78
|
# Fill in register parameters
|
|
75
79
|
if options[:date_accepted]
|
|
76
|
-
#
|
|
77
|
-
|
|
80
|
+
# `date_accepted` is a read-only derived accessor on Concept; the
|
|
81
|
+
# accepted date is set by way of `data.dates`.
|
|
82
|
+
concept.data.dates = [
|
|
83
|
+
Glossarist::ConceptDate.new(
|
|
84
|
+
date: options[:date_accepted],
|
|
85
|
+
type: "accepted",
|
|
86
|
+
),
|
|
87
|
+
]
|
|
78
88
|
end
|
|
79
|
-
|
|
80
|
-
# puts concept.inspect
|
|
81
89
|
end
|
|
82
90
|
end
|
|
91
|
+
|
|
92
|
+
private
|
|
93
|
+
|
|
94
|
+
def detailed_definitions(values)
|
|
95
|
+
values.map { |value| { "content" => value } }
|
|
96
|
+
end
|
|
83
97
|
end
|
|
84
98
|
end
|
data/lib/termium/version.rb
CHANGED
data/lib/termium.rb
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# glossarist's ManagedConceptCollection#save_to_files calls FileUtils without
|
|
4
|
+
# requiring it, so loading it here keeps `termium convert` from raising
|
|
5
|
+
# NameError.
|
|
6
|
+
require "fileutils"
|
|
3
7
|
require "glossarist"
|
|
4
8
|
|
|
5
9
|
module Termium
|
data/termium.gemspec
CHANGED
|
@@ -31,7 +31,10 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
32
32
|
spec.require_paths = ["lib"]
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
# glossarist 2.14 relexes rubyzip (~> 3.7, matching lutaml-model) and
|
|
35
|
+
# tracks lutaml-model 0.8.5x — 2.11.x caps rubyzip < 3, which makes
|
|
36
|
+
# the whole bundle unresolvable against current lutaml-model.
|
|
37
|
+
spec.add_dependency "glossarist", "~> 2.14.0"
|
|
35
38
|
spec.add_dependency "lutaml-model", "~> 0.8.0"
|
|
36
39
|
spec.add_dependency "thor"
|
|
37
40
|
spec.add_dependency "uuidtools"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: termium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: glossarist
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.
|
|
19
|
+
version: 2.14.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.
|
|
26
|
+
version: 2.14.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: lutaml-model
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|