iev 0.3.6 → 0.3.7

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: 42bd017437d3f78d461046e2cf5252eddb3d4b45988f1b885abe3eb4ddcf6999
4
- data.tar.gz: 2c234ead4432ea4f469973997d7c7c0fa4ba90a03d9db9039477eec7cf77a84e
3
+ metadata.gz: e35fa5a8cd6a260517986026015f363ac5114c548e44885a41a160d46e069a21
4
+ data.tar.gz: e412000b685994129c1fec6426e2e4795883d5dabccd6ffb67afc258b397ddd0
5
5
  SHA512:
6
- metadata.gz: 828c3d9eb81d35e71ef7b90b5abe6f39d9cdf3828db452092a60313e46bee8d2b1e7d6a44a4d6affe03e76e1f1ab90a7788959db9c0ff3d70a33624f748aafc0
7
- data.tar.gz: 62a2f57172955b8375a3dba2f5e8a6d4ffe004498a6aa0ceb97c5ad5dffe8083ca9f791b2b25e3d9d15efa4094e4844652b05e335c4b8aaff674d948b6d0c239
6
+ metadata.gz: 84f480fd9eaccfa0ee7e457f19b55af593680f9f858a838599a97c09de56d33b1b3afcf16b9a3a4359932beca6eca56eab0b69183bc95e75b5e3b8cff1efecab
7
+ data.tar.gz: 2345069a32ad7ab2b08d80d1508c9b6cead36dcc2a549e2744bc7f37ccec857a63e6d672d8d8d1c4fb019c406e05ff8abb1a3827455857553ffe2462654cc574
@@ -1,10 +1,14 @@
1
1
  name: rake
2
2
 
3
+ permissions:
4
+ contents: read
5
+
3
6
  on:
4
7
  push:
5
8
  branches: [ master, main ]
6
9
  tags: [ v* ]
7
10
  pull_request:
11
+ workflow_dispatch:
8
12
 
9
13
  jobs:
10
14
  rake:
@@ -1,5 +1,8 @@
1
1
  name: release
2
2
 
3
+ permissions:
4
+ contents: write
5
+
3
6
  on:
4
7
  workflow_dispatch:
5
8
  inputs:
@@ -19,4 +22,4 @@ jobs:
19
22
  next_version: ${{ github.event.inputs.next_version }}
20
23
  secrets:
21
24
  rubygems-api-key: ${{ secrets.GLOSSARIST_CI_RUBYGEMS_API_KEY }}
22
-
25
+ pat_token: ${{ secrets.GITHUB_TOKEN }}
data/.rubocop_todo.yml CHANGED
@@ -1,33 +1,18 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-06 12:27:40 UTC using RuboCop version 1.69.2.
3
+ # on 2025-11-14 11:14:05 UTC using RuboCop version 1.81.7.
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: 1
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
12
- # SupportedStyles: case, end
13
- Layout/CaseIndentation:
14
- Exclude:
15
- - 'lib/iev/iso_639_code.rb'
16
-
17
- # Offense count: 1
18
- # This cop supports safe autocorrection (--autocorrect).
19
- # Configuration parameters: EnforcedStyleAlignWith, Severity.
20
- # SupportedStylesAlignWith: keyword, variable, start_of_line
21
- Layout/EndAlignment:
22
- Exclude:
23
- - 'lib/iev/iso_639_code.rb'
24
-
25
- # Offense count: 45
9
+ # Offense count: 43
26
10
  # This cop supports safe autocorrection (--autocorrect).
27
- # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
11
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
28
12
  # URISchemes: http, https
29
13
  Layout/LineLength:
30
14
  Exclude:
15
+ - 'iev.gemspec'
31
16
  - 'lib/iev/cli/command.rb'
32
17
  - 'lib/iev/cli/command_helper.rb'
33
18
  - 'lib/iev/db_cache.rb'
@@ -36,6 +21,13 @@ Layout/LineLength:
36
21
  - 'spec/acceptance/xlsx2yaml_spec.rb'
37
22
  - 'spec/iev_spec.rb'
38
23
 
24
+ # Offense count: 7
25
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
26
+ Lint/DuplicateBranch:
27
+ Exclude:
28
+ - 'lib/iev/source_parser.rb'
29
+ - 'lib/iev/term_builder.rb'
30
+
39
31
  # Offense count: 1
40
32
  Lint/MixedRegexpCaptureTypes:
41
33
  Exclude:
@@ -59,7 +51,7 @@ Metrics/CyclomaticComplexity:
59
51
  - 'lib/iev/source_parser.rb'
60
52
  - 'lib/iev/term_builder.rb'
61
53
 
62
- # Offense count: 21
54
+ # Offense count: 20
63
55
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
64
56
  Metrics/MethodLength:
65
57
  Max: 74
@@ -71,11 +63,3 @@ Metrics/PerceivedComplexity:
71
63
  - 'lib/iev.rb'
72
64
  - 'lib/iev/converter/mathml_to_asciimath.rb'
73
65
  - 'lib/iev/term_builder.rb'
74
-
75
- # Offense count: 1
76
- # This cop supports unsafe autocorrection (--autocorrect-all).
77
- # Configuration parameters: EnforcedStyle.
78
- # SupportedStyles: literals, strict
79
- Style/MutableConstant:
80
- Exclude:
81
- - 'lib/iev/iso_639_code.rb'
data/Gemfile CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in lutaml-model.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
- gem "rspec", "~> 3.0"
10
- gem "rubocop", "~> 1.21"
11
- gem "rubocop-performance", require: false
12
- gem "rubocop-rake", require: false
13
- gem "rubocop-rspec", require: false
5
+ gem "canon"
6
+ gem "openssl"
7
+ gem "rake"
8
+ gem "rspec"
9
+ gem "rubocop"
10
+ gem "rubocop-performance"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
14
13
  gem "simplecov"
14
+
15
+ gemspec
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "iev"
5
+ require_relative "../lib/iev"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
data/iev.gemspec CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("lib", __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "iev/version"
3
+ require_relative "lib/iev/version"
6
4
 
7
5
  Gem::Specification.new do |spec|
8
6
  spec.name = "iev"
@@ -10,9 +8,9 @@ Gem::Specification.new do |spec|
10
8
  spec.authors = ["Ribose Inc."]
11
9
  spec.email = ["open.source@ribose.com"]
12
10
 
13
- spec.summary = "Iev: Fetch and encode Iev term from Electropedia"
14
- spec.description = "Iev: Fetch and encode Iev term from Electropedia"
15
- spec.homepage = "https://github.com/metanorma/iev"
11
+ spec.summary = "Glossarist toolkit for working with IEV terms from Electropedia"
12
+ spec.description = "Glossarist toolkit for working with IEV terms from Electropedia"
13
+ spec.homepage = "https://github.com/glossarist/iev"
16
14
  spec.license = "BSD-2-Clause"
17
15
 
18
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -23,14 +21,13 @@ Gem::Specification.new do |spec|
23
21
  spec.require_paths = ["lib"]
24
22
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
25
23
 
26
- spec.add_dependency "creek", "~> 2.5"
24
+ spec.add_dependency "creek", "~> 2.6"
27
25
  spec.add_dependency "glossarist", ">= 2.3.0"
28
- spec.add_dependency "nokogiri", ">= 1.16.5"
26
+ spec.add_dependency "nokogiri", "~> 1.17"
29
27
  spec.add_dependency "plurimath"
30
28
  spec.add_dependency "relaton", "~> 1.18"
31
29
  spec.add_dependency "sequel", "~> 5.40"
32
30
  spec.add_dependency "sqlite3", "~> 1.7.0"
33
31
  spec.add_dependency "thor", "~> 1.0"
34
32
  spec.add_dependency "unitsml"
35
- spec.add_dependency "zeitwerk", "~> 2.4"
36
33
  end
data/lib/iev/cli/ui.rb CHANGED
@@ -62,7 +62,7 @@ module Iev
62
62
  end
63
63
 
64
64
  def should_out?(level, topic)
65
- topic.nil? || level == :warn || $IEV_DEBUG[topic]
65
+ topic.nil? || level == :warn || ($IEV_DEBUG && $IEV_DEBUG[topic])
66
66
  end
67
67
  end
68
68
  end
data/lib/iev/cli.rb CHANGED
@@ -5,6 +5,10 @@
5
5
 
6
6
  module Iev
7
7
  module Cli
8
+ autoload :Command, "iev/cli/command"
9
+ autoload :CommandHelper, "iev/cli/command_helper"
10
+ autoload :Ui, "iev/cli/ui"
11
+
8
12
  def self.start(arguments)
9
13
  Signal.trap("INT") do
10
14
  Ui.info "Signal SIGINT received, quitting!"
data/lib/iev/converter.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Iev
4
4
  module Converter
5
+ autoload :MathmlToAsciimath, "iev/converter/mathml_to_asciimath"
6
+
5
7
  def self.mathml_to_asciimath(input)
6
8
  Iev::Converter::MathmlToAsciimath.convert(input)
7
9
  end
@@ -3,6 +3,8 @@
3
3
  # (c) Copyright 2020 Ribose Inc.
4
4
  #
5
5
 
6
+ require "htmlentities"
7
+
6
8
  module Iev
7
9
  module DataConversions
8
10
  refine String do
@@ -7,16 +7,18 @@ module Iev
7
7
  # @todo This needs to be rewritten.
8
8
  class Iso639Code
9
9
  COUNTRY_CODES = YAML.load(IO.read(File.join(__dir__, "iso_639_2.yaml")))
10
- THREE_CHAR_MEMO = {}
10
+ # rubocop:disable Style/MutableConstant
11
+ THREE_CHAR_MEMO = {} # Memoization cache, must be mutable
12
+ # rubocop:enable Style/MutableConstant
11
13
 
12
14
  def initialize(two_char_code)
13
15
  @code = case two_char_code.length
14
- when 2
15
- two_char_code
16
- else
17
- # This is to handle code "nl BE" in the Iev sheet
18
- two_char_code.split(" ").first
19
- end
16
+ when 2
17
+ two_char_code
18
+ else
19
+ # This is to handle code "nl BE" in the Iev sheet
20
+ two_char_code.split.first
21
+ end
20
22
  end
21
23
 
22
24
  def find(code_type)
@@ -5,7 +5,6 @@
5
5
 
6
6
  # rubocop:todo Style/RedundantRegexpEscape
7
7
 
8
- require "English"
9
8
  module Iev
10
9
  # Parses information from the spreadsheet's SOURCE column.
11
10
  #
@@ -65,14 +65,22 @@ module Iev
65
65
  end
66
66
 
67
67
  def extract_gender(str)
68
- gender_rx = /\b[mfn]\b/
69
-
70
- @gender = remove_from_string(str, gender_rx)
68
+ # Match gender either:
69
+ # 1. Inside brackets/parentheses: (m), [f], (n)
70
+ # 2. As standalone word with boundaries: m, f, n
71
+ gender_rx = /(?:\(|\[)[mfn](?:\)|\])|\b[mfn]\b/
72
+
73
+ match = remove_from_string(str, gender_rx)
74
+ # Extract just the letter from the match (remove brackets if present)
75
+ @gender = match&.gsub(/[\[\]()]/, "")
71
76
  end
72
77
 
73
78
  # Must happen after #extract_gender
74
79
  def extract_plurality(str)
75
- plural_rx = /\bpl\b/
80
+ # Match plurality either:
81
+ # 1. Inside brackets/parentheses: (pl), [pl]
82
+ # 2. As standalone word with boundaries: pl
83
+ plural_rx = /(?:\(|\[)pl(?:\)|\])|\bpl\b/
76
84
 
77
85
  if remove_from_string(str, plural_rx)
78
86
  @plurality = "plural"
data/lib/iev/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Iev
4
- VERSION = "0.3.6"
4
+ VERSION = "0.3.7"
5
5
  end
data/lib/iev.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "iev/version"
4
- require "iev/db"
3
+ require_relative "iev/version"
5
4
  require "open-uri"
6
5
  require "nokogiri"
7
6
 
@@ -15,17 +14,28 @@ require "relaton_bib"
15
14
  require "sequel"
16
15
  require "thor"
17
16
  require "yaml"
18
- require "zeitwerk"
19
-
20
- loader = Zeitwerk::Loader.for_gem
21
- loader.setup
22
17
 
23
18
  module Iev
19
+ autoload :Cli, "iev/cli"
20
+ autoload :Converter, "iev/converter"
21
+ autoload :DataConversions, "iev/data_conversions"
22
+ autoload :Db, "iev/db"
23
+ autoload :DbCache, "iev/db_cache"
24
+ autoload :DbWriter, "iev/db_writer"
25
+ autoload :Iso639Code, "iev/iso_639_code"
26
+ autoload :Profiler, "iev/profiler"
27
+ autoload :RelatonDb, "iev/relaton_db"
28
+ autoload :SourceParser, "iev/source_parser"
29
+ autoload :SupersessionParser, "iev/supersession_parser"
30
+ autoload :TermAttrsParser, "iev/term_attrs_parser"
31
+ autoload :TermBuilder, "iev/term_builder"
32
+ autoload :Utilities, "iev/utilities"
33
+
24
34
  #
25
35
  # Scrape Electropedia for term.
26
36
  #
27
37
  # @param [String] code for example "103-01-02"
28
- # @param [String] lang language code, for examle "en"
38
+ # @param [String] lang language code, for example "en"
29
39
  #
30
40
  # @return [String, nil] if found than term,
31
41
  # if code not found then empty string,
@@ -44,4 +54,4 @@ module Iev
44
54
  end
45
55
  end
46
56
 
47
- require "iev/cli"
57
+ require_relative "iev/cli"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-12 00:00:00.000000000 Z
11
+ date: 2025-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: creek
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.5'
19
+ version: '2.6'
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.5'
26
+ version: '2.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: glossarist
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.16.5
47
+ version: '1.17'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.16.5
54
+ version: '1.17'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: plurimath
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -136,21 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: zeitwerk
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '2.4'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '2.4'
153
- description: 'Iev: Fetch and encode Iev term from Electropedia'
139
+ description: Glossarist toolkit for working with IEV terms from Electropedia
154
140
  email:
155
141
  - open.source@ribose.com
156
142
  executables:
@@ -161,7 +147,6 @@ files:
161
147
  - ".github/workflows/rake.yml"
162
148
  - ".github/workflows/release.yml"
163
149
  - ".gitignore"
164
- - ".hound.yml"
165
150
  - ".rspec"
166
151
  - ".rubocop.yml"
167
152
  - ".rubocop_todo.yml"
@@ -194,7 +179,7 @@ files:
194
179
  - lib/iev/term_builder.rb
195
180
  - lib/iev/utilities.rb
196
181
  - lib/iev/version.rb
197
- homepage: https://github.com/metanorma/iev
182
+ homepage: https://github.com/glossarist/iev
198
183
  licenses:
199
184
  - BSD-2-Clause
200
185
  metadata: {}
@@ -216,5 +201,5 @@ requirements: []
216
201
  rubygems_version: 3.5.22
217
202
  signing_key:
218
203
  specification_version: 4
219
- summary: 'Iev: Fetch and encode Iev term from Electropedia'
204
+ summary: Glossarist toolkit for working with IEV terms from Electropedia
220
205
  test_files: []
data/.hound.yml DELETED
@@ -1,5 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- ruby:
4
- enabled: true
5
- config_file: .rubocop.yml