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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c6b7569853f4c7b83bced60d4788ea5e3e82d72813640ed7320e34fa20f36b0
4
- data.tar.gz: eb30221b2e85f057a4fc5dd109cec31318fc89bdc06493c6573b80b8a142680b
3
+ metadata.gz: 8b3fe1c60b2aeb9208c7b090abacba70c8eb152964a583d48f85aaee34dcca35
4
+ data.tar.gz: ff073afb1ca7b6a82b838015342fde5c66944a64f5f6d253a273fac22826a362
5
5
  SHA512:
6
- metadata.gz: 4192d75896042ea78ebf75b0571e80c4a937f6cb1deaf5ba0636978475be202491a3c439f5a58634f13382fa2efb3681169432eda2e4f2c875e98b210f59d5c4
7
- data.tar.gz: 51f3424870aa511c10b424c7082198e67d5e21c8a91308d4ba027e44127eaafc1fdc9027b80102594020bed3d0e1ab664d7384915f18e4254a87d9876134ae19
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
- # The way to set the universal concept's identifier: data.identifier
49
- concept.id = identification_number
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 = options[:date_accepted]
62
+ concept.date_accepted = Glossarist::ConceptDate.new(
63
+ date: options[:date_accepted],
64
+ type: "accepted",
65
+ )
59
66
  end
60
67
 
61
- language_module.map do |lang_mod|
62
- localized_concept = lang_mod.to_concept(options)
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
- # TODO: This is needed to skip the empty french entries of 10031781 and 10031778
65
- next if localized_concept.nil?
78
+ # TODO: This is needed to skip the empty french entries of 10031781 and 10031778
79
+ next if localized_concept.nil?
66
80
 
67
- localized_concept.id = identification_number
68
- localized_concept.uuid = uuid("#{identification_number}-#{lang_mod.language}")
81
+ localized_concept.id = identification_number
82
+ localized_concept.uuid = uuid("#{identification_number}-#{lang_mod.language}")
69
83
 
70
- universal_entry.each do |entry|
71
- localized_concept.notes << Glossarist::DetailedDefinition.new(content: entry.value)
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
- return nil unless definition
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" => [{ content: 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
- Glossarist::LocalizedConcept.new(x).tap do |concept|
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
- # puts options[:date_accepted].inspect
77
- concept.date_accepted = options[:date_accepted]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Termium
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
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
- spec.add_dependency "glossarist", "~> 2.3.5"
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.0
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-03-24 00:00:00.000000000 Z
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.3.5
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.3.5
26
+ version: 2.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: lutaml-model
29
29
  requirement: !ruby/object:Gem::Requirement