glossarist 2.6.0 → 2.6.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: d8c6a7e6d8df0929ec60fdccdc44fd70a4042afec7ccd8f046cdcf6388839d21
4
- data.tar.gz: 56d29d76e0fc77885edcbc1c59cd533ec99029b4db957ad5772d78bf96356c1c
3
+ metadata.gz: b4e48f1d237829b78cd052e39afdd7c952c468be894e25856f79f93471ea2dc6
4
+ data.tar.gz: f6502f7012e30138193c4c28eee2ab551020edf27ff0c6e08cc39939e5d0c0c3
5
5
  SHA512:
6
- metadata.gz: baace51fb6d551075f190957abe4a1736c390ee06dafe7756d691ce35b23770383eb12756bf3790712935879830da929ebf0670007b2f149c26f9b9cdb4bff89
7
- data.tar.gz: d1faeeaac48cc379ddded9f51fb223b23dc8bcf2f7182e196b6b721d6b2f4bb0674875be5ca9c842a4ddafb343b14a3f46778530d0b19118000b33387437d771
6
+ metadata.gz: bcfb39fe52138d23d489cfbff45f62b0f00161d3183ef66dbb5718fcbc30694ef5e426bc9f7797329480dddb01a7c96b8f6e1dfc43e392032441bb62487c723a
7
+ data.tar.gz: 289911c5a5851389cb5e37fbc07bd45825b00cdd51fa8cac5679168af3ec9e2b7313f6afbd7093fb93b35384bfc7318dcb97a22d72869f78a321883f4ab299a4
data/.rubocop_todo.yml CHANGED
@@ -1,12 +1,12 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-05-06 17:07:44 UTC using RuboCop version 1.86.1.
3
+ # on 2026-05-06 18:35:41 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 6
9
+ # Offense count: 5
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
11
  # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
12
  Bundler/OrderedGems:
@@ -18,49 +18,27 @@ Gemspec/RequiredRubyVersion:
18
18
  Exclude:
19
19
  - 'glossarist.gemspec'
20
20
 
21
- # Offense count: 10
22
- # This cop supports safe autocorrection (--autocorrect).
23
- # Configuration parameters: EnforcedStyle, IndentationWidth.
24
- # SupportedStyles: with_first_argument, with_fixed_indentation
25
- Layout/ArgumentAlignment:
26
- Exclude:
27
- - 'lib/glossarist/cli/export_command.rb'
28
- - 'lib/glossarist/gcr_package.rb'
29
- - 'spec/unit/gcr_package_spec.rb'
30
-
31
21
  # Offense count: 1
32
22
  # This cop supports safe autocorrection (--autocorrect).
33
- Layout/EmptyLinesAroundMethodBody:
23
+ Layout/ClosingParenthesisIndentation:
34
24
  Exclude:
35
- - 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
25
+ - 'spec/unit/concept_set_spec.rb'
36
26
 
37
27
  # Offense count: 1
38
28
  # This cop supports safe autocorrection (--autocorrect).
39
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
40
- # SupportedHashRocketStyles: key, separator, table
41
- # SupportedColonStyles: key, separator, table
42
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
43
- Layout/HashAlignment:
29
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
30
+ # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
31
+ Layout/FirstArgumentIndentation:
44
32
  Exclude:
45
- - 'lib/glossarist/gcr_package.rb'
33
+ - 'spec/unit/concept_set_spec.rb'
46
34
 
47
- # Offense count: 214
35
+ # Offense count: 202
48
36
  # This cop supports safe autocorrection (--autocorrect).
49
37
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
50
38
  # URISchemes: http, https
51
39
  Layout/LineLength:
52
40
  Enabled: false
53
41
 
54
- # Offense count: 12
55
- # This cop supports safe autocorrection (--autocorrect).
56
- # Configuration parameters: AllowInHeredoc.
57
- Layout/TrailingWhitespace:
58
- Exclude:
59
- - 'lib/glossarist/cli/export_command.rb'
60
- - 'lib/glossarist/gcr_package.rb'
61
- - 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
62
- - 'spec/unit/gcr_package_spec.rb'
63
-
64
42
  # Offense count: 1
65
43
  # Configuration parameters: AllowedMethods.
66
44
  # AllowedMethods: enums
@@ -68,18 +46,12 @@ Lint/ConstantDefinitionInBlock:
68
46
  Exclude:
69
47
  - 'spec/unit/utilities/common_functions_spec.rb'
70
48
 
71
- # Offense count: 2
72
- Lint/DuplicateMethods:
73
- Exclude:
74
- - 'lib/glossarist/managed_concept.rb'
75
-
76
- # Offense count: 2
49
+ # Offense count: 1
77
50
  # This cop supports safe autocorrection (--autocorrect).
78
51
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
79
52
  # NotImplementedExceptions: NotImplementedError
80
53
  Lint/UnusedMethodArgument:
81
54
  Exclude:
82
- - 'lib/glossarist/cli/export_command.rb'
83
55
  - 'lib/glossarist/dataset_validator.rb'
84
56
 
85
57
  # Offense count: 23
@@ -170,12 +142,6 @@ Naming/VariableNumber:
170
142
  Style/FormatStringToken:
171
143
  EnforcedStyle: unannotated
172
144
 
173
- # Offense count: 2
174
- # This cop supports safe autocorrection (--autocorrect).
175
- Style/MultilineIfModifier:
176
- Exclude:
177
- - 'lib/glossarist/gcr_package.rb'
178
-
179
145
  # Offense count: 1
180
146
  # Configuration parameters: AllowedClasses.
181
147
  Style/OneClassPerFile:
@@ -184,12 +150,6 @@ Style/OneClassPerFile:
184
150
  - 'test/**/*'
185
151
  - 'lib/glossarist.rb'
186
152
 
187
- # Offense count: 1
188
- # This cop supports safe autocorrection (--autocorrect).
189
- Style/RedundantAssignment:
190
- Exclude:
191
- - 'lib/glossarist/transforms/concept_to_tbx_transform.rb'
192
-
193
153
  # Offense count: 4
194
154
  # Configuration parameters: Max.
195
155
  Style/SafeNavigationChainLength:
data/Gemfile CHANGED
@@ -7,12 +7,12 @@ gemspec
7
7
  gem "canon"
8
8
  gem "lutaml-model", "~> 0.8.0"
9
9
  gem "rake", "~> 13.0"
10
- gem "tbx", "~> 0.1"
11
10
  gem "rspec", "~> 3.0"
12
11
  gem "rubocop"
13
12
  gem "rubocop-performance"
14
13
  gem "rubocop-rake"
15
14
  gem "rubocop-rspec"
15
+ gem "tbx", "~> 0.1"
16
16
 
17
17
  # Override relaton gems with lutaml-model 0.8 compatible versions.
18
18
  # Released 2.0.0 gems have untyped lutaml-model attributes that fail with 0.8+.
@@ -5,10 +5,7 @@ module Glossarist
5
5
  class ExportCommand
6
6
  EXTENSIONS = {
7
7
  "json" => "json",
8
- "jsonld" => "jsonld",
9
- "turtle" => "ttl",
10
- "tbx" => "tbx.xml",
11
- "jsonl" => "jsonl",
8
+ **GcrPackage::COMPILED_EXTENSIONS,
12
9
  }.freeze
13
10
 
14
11
  def initialize(path, options)
@@ -22,12 +19,12 @@ module Glossarist
22
19
  FileUtils.mkdir_p(output_dir)
23
20
 
24
21
  concepts = load_concepts
25
- name = resolve_shortname(concepts)
22
+ name = resolve_shortname
26
23
 
27
24
  case format
28
25
  when "json" then export_json(concepts, output_dir)
29
- when "jsonld" then export_document(concepts, name, output_dir, :jsonld)
30
- when "turtle" then export_document(concepts, name, output_dir, :turtle)
26
+ when "jsonld" then export_jsonld(concepts, name, output_dir)
27
+ when "turtle" then export_turtle(concepts, name, output_dir)
31
28
  when "tbx" then export_tbx(concepts, name, output_dir)
32
29
  when "jsonl" then export_jsonl(concepts, name, output_dir)
33
30
  end
@@ -55,7 +52,7 @@ module Glossarist
55
52
  @options[:uri_prefix] ||= package.metadata["uri_prefix"]
56
53
  end
57
54
 
58
- def resolve_shortname(_concepts)
55
+ def resolve_shortname
59
56
  @options[:shortname] || "glossary"
60
57
  end
61
58
 
@@ -75,27 +72,30 @@ module Glossarist
75
72
  end
76
73
  end
77
74
 
78
- def export_document(concepts, name, output_dir, format)
75
+ def export_jsonld(concepts, name, output_dir)
79
76
  require "glossarist/transforms/concept_to_skos_transform"
80
77
  vocab = Transforms::ConceptToSkosTransform.transform_document(concepts,
81
78
  transform_options)
82
- ext = EXTENSIONS[format.to_s]
83
- File.write(File.join(output_dir, "#{name}.#{ext}"),
84
- vocab.public_send(:"to_#{format}"))
79
+ File.write(File.join(output_dir, "#{name}.jsonld"), vocab.to_jsonld)
80
+ end
81
+
82
+ def export_turtle(concepts, name, output_dir)
83
+ require "glossarist/transforms/concept_to_skos_transform"
84
+ vocab = Transforms::ConceptToSkosTransform.transform_document(concepts,
85
+ transform_options)
86
+ File.write(File.join(output_dir, "#{name}.ttl"), vocab.to_turtle)
85
87
  end
86
88
 
87
89
  def export_tbx(concepts, name, output_dir)
88
90
  require "glossarist/transforms/concept_to_tbx_transform"
89
91
  doc = Transforms::ConceptToTbxTransform.transform_document(concepts,
90
92
  transform_options)
91
- File.write(File.join(output_dir, "#{name}.#{EXTENSIONS['tbx']}"),
92
- doc.to_xml)
93
+ File.write(File.join(output_dir, "#{name}.tbx.xml"), doc.to_xml)
93
94
  end
94
95
 
95
96
  def export_jsonl(concepts, name, output_dir)
96
97
  require "glossarist/transforms/concept_to_skos_transform"
97
- File.open(File.join(output_dir, "#{name}.#{EXTENSIONS['jsonl']}"),
98
- "w") do |f|
98
+ File.open(File.join(output_dir, "#{name}.jsonl"), "w") do |f|
99
99
  concepts.each do |concept|
100
100
  skos = Transforms::ConceptToSkosTransform.transform(concept,
101
101
  transform_options)
@@ -35,8 +35,6 @@ module Glossarist
35
35
  end.join("\n")
36
36
  end
37
37
 
38
- private
39
-
40
38
  def to_latex_from_file(entries_file)
41
39
  File.readlines(entries_file).map do |concept_name|
42
40
  concept = concept_map[concept_name.strip.downcase]
@@ -10,8 +10,6 @@ module Glossarist
10
10
  attribute :dates, ConceptDate, collection: true
11
11
  attribute :sources, ConceptSource
12
12
  attribute :date_accepted, ConceptDate
13
- # TODO: convert to LocalizedConceptCollection when custom
14
- # collections are implemented in lutaml-model
15
13
  attribute :status, :string,
16
14
  values: Glossarist::GlossaryDefinition::CONCEPT_STATUSES
17
15
 
@@ -35,14 +33,6 @@ module Glossarist
35
33
  map :uuid, to: :uuid, with: { from: :uuid_from_yaml, to: :uuid_to_yaml }
36
34
  end
37
35
 
38
- def localized_concepts
39
- data.localized_concepts
40
- end
41
-
42
- def localized_concepts=(val)
43
- data.localized_concepts = val
44
- end
45
-
46
36
  def localizations
47
37
  data.localizations
48
38
  end
@@ -123,9 +113,6 @@ module Glossarist
123
113
  end
124
114
  alias :add_l10n :add_localization
125
115
 
126
- # Returns concept localization.
127
- # @param lang [String] language code
128
- # @return [LocalizedConcept]
129
116
  def to_jsonld
130
117
  require "glossarist/transforms/concept_to_skos_transform"
131
118
  Transforms::ConceptToSkosTransform.transform(self).to_jsonld
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.6.0"
7
+ VERSION = "2.6.1"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glossarist
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose