iev 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 356f0fc36121aac4f8aa2310f0ee9a4561401579962963c99cd808c04948f6f0
4
- data.tar.gz: 5a3eccfb16325056b02f5780a768171cb2f61129156d782a1bcd38e2908c1d0e
3
+ metadata.gz: ade271f8d92cb9e91edef67cd761835b01475b71be9c8fd58fc6bdb31c06ce40
4
+ data.tar.gz: 18d6111223f6555060d72360f4b636fba9f81a3341d4f80fd0fa8b4c4bbd3d69
5
5
  SHA512:
6
- metadata.gz: '082bbdd60b4d651fc4859b962bd6ee41762fdee327f1890539ff3d969147f01358d80d48a7bdb16846a31c66c3c9cc0a844155efb3e71d86e0540b8169743495'
7
- data.tar.gz: 22f9b5dd468343bcb4646ed510f8285d3d4f23fab30adf75d8c403b02e36d165ddbb062465855d116222e4f465dd3d22df3c3d54c7548983fff565904b7092af
6
+ metadata.gz: 3e3c8ca862f48a4b8c206f976de1f53b33a146a2e7f1643e212134d2db421ea8331ff57134258df82f7546eb2c6e4fce99e5811850b3ffedfb3d7e0ba6f39120
7
+ data.tar.gz: ea4678480997b220c9228cc364dd148779d35ac4c4582813e0b7aed1bcd9aa1700be63caf97f0254f83f40b0bbb7d10995c92cf7f3352a507d04f48d1b86150b
@@ -1,5 +1,3 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: rake
4
2
 
5
3
  on:
@@ -11,5 +9,3 @@ on:
11
9
  jobs:
12
10
  rake:
13
11
  uses: metanorma/ci/.github/workflows/generic-rake.yml@main
14
- secrets:
15
- pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
@@ -1,5 +1,3 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: release
4
2
 
5
3
  on:
@@ -20,6 +18,5 @@ jobs:
20
18
  with:
21
19
  next_version: ${{ github.event.inputs.next_version }}
22
20
  secrets:
23
- rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
24
- pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
21
+ rubygems-api-key: ${{ secrets.GLOSSARIST_CI_RUBYGEMS_API_KEY }}
25
22
 
data/.rubocop.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
+ - .rubocop_todo.yml
4
5
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
5
6
 
6
7
  # local repo-specific modifications
7
8
  # ...
8
-
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,81 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-01-06 12:27:40 UTC using RuboCop version 1.69.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
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
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
28
+ # URISchemes: http, https
29
+ Layout/LineLength:
30
+ Exclude:
31
+ - 'lib/iev/cli/command.rb'
32
+ - 'lib/iev/cli/command_helper.rb'
33
+ - 'lib/iev/db_cache.rb'
34
+ - 'lib/iev/source_parser.rb'
35
+ - 'spec/acceptance/db2yaml_spec.rb'
36
+ - 'spec/acceptance/xlsx2yaml_spec.rb'
37
+ - 'spec/iev_spec.rb'
38
+
39
+ # Offense count: 1
40
+ Lint/MixedRegexpCaptureTypes:
41
+ Exclude:
42
+ - 'lib/iev/term_builder.rb'
43
+
44
+ # Offense count: 10
45
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
46
+ Metrics/AbcSize:
47
+ Exclude:
48
+ - 'lib/iev/converter/mathml_to_asciimath.rb'
49
+ - 'lib/iev/db_writer.rb'
50
+ - 'lib/iev/source_parser.rb'
51
+ - 'lib/iev/term_builder.rb'
52
+
53
+ # Offense count: 5
54
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
55
+ Metrics/CyclomaticComplexity:
56
+ Exclude:
57
+ - 'lib/iev.rb'
58
+ - 'lib/iev/converter/mathml_to_asciimath.rb'
59
+ - 'lib/iev/source_parser.rb'
60
+ - 'lib/iev/term_builder.rb'
61
+
62
+ # Offense count: 21
63
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
64
+ Metrics/MethodLength:
65
+ Max: 74
66
+
67
+ # Offense count: 3
68
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
69
+ Metrics/PerceivedComplexity:
70
+ Exclude:
71
+ - 'lib/iev.rb'
72
+ - 'lib/iev/converter/mathml_to_asciimath.rb'
73
+ - '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
@@ -1,6 +1,14 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
3
+ source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in iev.gemspec
5
+ # Specify your gem's dependencies in lutaml-model.gemspec
6
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
14
+ gem "simplecov"
data/README.adoc CHANGED
@@ -1,58 +1,313 @@
1
- = IEV
1
+ = IEV: Utilities for the International Electrotechnical Vocabulary (IEC Electropedia)
2
2
 
3
3
  image:https://img.shields.io/gem/v/iev.svg["Gem Version", link="https://rubygems.org/gems/iev"]
4
- image:https://github.com/metanorma/iev/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/iev/actions?query=workflow%3Arake"]
5
- image:https://codeclimate.com/github/metanorma/iev/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/iev"]
6
- image:https://img.shields.io/github/issues-pr-raw/metanorma/iev.svg["Pull Requests", link="https://github.com/metanorma/iev/pulls"]
7
- image:https://img.shields.io/github/commits-since/metanorma/iev/latest.svg["Commits since latest",link="https://github.com/metanorma/iev/releases"]
4
+ image:https://github.com/glossarist/iev/workflows/rake/badge.svg["Build Status", link="https://github.com/glossarist/iev/actions?query=workflow%3Arake"]
5
+ image:https://codeclimate.com/github/glossarist/iev/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/glossarist/iev"]
6
+ image:https://img.shields.io/github/issues-pr-raw/glossarist/iev.svg["Pull Requests", link="https://github.com/glossarist/iev/pulls"]
7
+ image:https://img.shields.io/github/commits-since/glossarist/iev/latest.svg["Commits since latest",link="https://github.com/glossarist/iev/releases"]
8
8
 
9
- Fetch and encode IEV term from Electropedia.
10
9
 
11
- == Installation
10
+ == Purpose
12
11
 
13
- Add this line to your application's Gemfile:
12
+ This library allows accessing data of the International Electrotechnical
13
+ Vocabulary (IEV):
14
14
 
15
- [source, ruby]
15
+ * Access IEV terms remotely, via the Electropedia website (www.electropedia.org)
16
+
17
+ * Read IEV terms from an offline IEV termbase in Glossarist format
18
+
19
+ * Parse an IEV exported Excel file and convert its contents into a Glossarist
20
+ termbase
21
+
22
+ WARNING: The last feature is only meant for IEC-internal use. The IEV export
23
+ files can only be obtained from the IEC IT department.
24
+
25
+ NOTE: The https://github.com/glossarist/iev-data[`iev-data` gem] is obsolete by
26
+ this library and its functionality has been fully incorporated into this
27
+ library.
28
+
29
+ == Install
30
+
31
+ Add this line to your Gemfile:
32
+
33
+ [source,ruby]
16
34
  ----
17
35
  gem 'iev'
18
36
  ----
19
37
 
20
38
  And then execute:
21
39
 
22
- $ bundle
40
+ [source,sh]
41
+ ----
42
+ $ bundle
43
+ ----
23
44
 
24
45
  Or install it yourself as:
25
46
 
26
- $ gem install iev
47
+ [source,sh]
48
+ ----
49
+ $ gem install iev
50
+ ----
51
+
27
52
 
28
53
  == Usage
29
54
 
55
+ The gem comes with the `iev` executable, which provides the following commands:
56
+
57
+ `iev xlsx2yaml FILE`::
58
+ Converts Excel IEV exports to YAMLs.
59
+
60
+ `iev xlsx2db FILE`::
61
+ Imports Excel to SQLite database.
62
+
63
+ `iev db2yaml DB_FILE`:::
64
+ Exports SQLite to IEV YAMLs.
65
+
66
+ WARNING: The IEV XLSX export files can only be obtained from the IEC
67
+ Electropedia administrator.
68
+
69
+
70
+ === Fetching IEV terms from Electropedia
71
+
30
72
  [source, ruby]
31
73
  ----
32
74
  # Get term
33
75
 
34
- IEV.get("103-01-02", "en")
76
+ Iev.get("103-01-02", "en")
35
77
  => "functional"
36
78
 
37
79
  # If code not found
38
- IEV.get("111-11-11", "en")
80
+ Iev.get("111-11-11", "en")
39
81
  => ""
40
82
 
41
83
  # If language not found
42
- IEV.get("103-01-02", "eee")
84
+ Iev.get("103-01-02", "eee")
43
85
  => nil
44
86
  ----
45
87
 
46
- == Development
47
88
 
48
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
89
+ === Converting IEV Excel exports to a Glossarist dataset
90
+
91
+ Run the following command:
92
+
93
+ [source,sh]
94
+ ----
95
+ $ iev xlsx2yaml [termbase.xlsx]
96
+ ----
97
+
98
+ Where,
99
+
100
+ * the Glossarist termbase YAML files will be created at `[termbase.yaml]` at
101
+ the current working directory;
102
+
103
+ * ConceptYAML files for each concept (each concept identified by a unique "`Term-ID`")
104
+ are created under the `concepts/` directory (based on the current working directory).
105
+ i.e. `concepts/concept-338.yaml`.
106
+
107
+
108
+ == Structure of the IEV Excel export
109
+
110
+ The columns are:
111
+
112
+ `IEVREF`:: concept ID of this term
113
+ `LANGUAGE`:: ISO 639-1 code (2 character)
114
+ `TERM`:: the designation of this concept in language of `LANGUAGE`
115
+ `TERMATTRIBUTE`:: a field of multiple uses, an array (separated by `;`). More details below.
116
+ `SYNONYM1`:: a synonym of this term
117
+ `SYNONYM1ATTRIBUTE`:: the `TERMATTRIBUTE` that applies to `SYNONYM1`
118
+ `SYNONYM1STATUS`:: One of `Preferred`, `Deprecated`, nil.
119
+ `SYNONYM2`:: second synonym of this term
120
+ `SYNONYM2ATTRIBUTE`:: the `TERMATTRIBUTE` that applies to `SYNONYM2`
121
+ `SYNONYM2STATUS`:: One of `Preferred`, `Deprecated`, nil.
122
+ `SYNONYM3`:: 3rd synonym of this term
123
+ `SYNONYM3ATTRIBUTE`:: the `TERMATTRIBUTE` that applies to `SYNONYM3`
124
+ `SYNONYM3STATUS`:: One of `Preferred`, `Deprecated`, nil.
125
+ `SYMBOLE`:: Math symbol
126
+ `DEFINITION`:: definition text that includes `<note>` and `<example>`
127
+ `SOURCE`:: which document was this term was taken from
128
+ `PUBLICATIONDATE`:: `YYYY-MM` date of publication
129
+ `STATUS`:: Only `Standard` for now
130
+ `REPLACES`:: `IEVREF` for the deprecated term
131
+
132
+
133
+ === Term field
134
+
135
+ * Usually the text
136
+ * If it is `.....` (5 dots), it means that the translation is not available.
137
+ * If it is `foobar (acronym)` or `foobar (akronim)`, it is an acronym. `term.acronym` => `true`.
138
+
139
+ === Term attribute field
140
+
141
+ There are these data types inside the term attribute field. Make sure you split at `;` for multiple entries.
142
+
143
+ `f` or `m` or `n`:: this means `term.grammar-gender` is one of them, `term.plurality` => `singular`
144
+ `n pl`:: `term.grammar-gender` => `n`, `term.plurality` => `plural`
145
+ `m pl`:: `term.grammar-gender` => `m`, `term.plurality` => `plural`
146
+ `f pl`:: `term.grammar-gender` => `f`, `term.plurality` => `plural`
147
+ `pl`:: `term.plurality` => `plural` (else, `singular`)
148
+
149
+ `(in Zusammensetzungen) f`:: `term.compound-prefix` => true, `term.grammar-gender` => `f`
150
+ `(in Zusammensetzungen) m`:: `term.compound-prefix` => true, `term.grammar-gender` => `m`
151
+
152
+ `m, (abgelehnt)`:: `term.rejected` => true, `term.grammar-gender` => `m`
153
+ `f, (abgelehnt)`:: `term.rejected` => true, `term.grammar-gender` => `f`
154
+
155
+ `(略語)`:: `term.abbreviation` => true
156
+
157
+ `&lt;...&gt;`:: this means the text (`...`) inside is the `domain` of this term (which field this term applies in)
158
+
159
+ `&lt;相关条目:[SOMEIEVREF]&gt;`:: `SOMEIEVREF` here represents the "related to" term. Add a relationship of this term to `SOMEIEVREF`.
160
+
161
+ `Adjektiv`, `adj`, `形容詞`, `형용사`:: sets `term.grammar-particle` to `adj`
162
+ `Präfix`, `(prefix)`, `(préfixe)`, `接尾語`, `접두사`, `(词头)`:: sets `term.affix` to `prefix`
163
+
164
+
165
+ `CA`:: `term.geographical_area` => `CA`
166
+ `US`:: `term.geographical_area` => `US`
167
+
168
+ `noun`, `名詞`:: `term.grammar-particle` => `noun` (all terms default to `noun`)
169
+ `verb`, `動詞`:: `term.grammar-particle` => `verb`
170
+
171
+ `(sigle international), m` => `term.acronym = true`, `term.international = true`, `term.gender = 'm'`
172
+
173
+
174
+ === Term definition field
175
+
176
+ We need to parse out all NOTEs and EXAMPLEs and normalize them.
177
+
178
+ For all `This links to <a href=IEV112-01-01>quantity</a>`, we parse them and replace with:
179
+ `This links to {{quantity, IEV:112-01-01}}`.
180
+
181
+ e.g.
182
+
183
+ 1. Every `<NOTE {N} -` goes into a separate entry under `notes:`:
184
+
185
+ [source]
186
+ ----
187
+ quotient of two quantities of different dimensions, used as a multiplier to express the proportionality equation between them
188
+ <NOTE 1 – A coefficient is a quantity having a dimension other than one. Examples: Hall coefficient, damping coefficient, temperature coefficient, gyromagnetic coefficient.
189
+ <NOTE 2 – The term "modulus" is sometimes used instead of coefficient. Example: modulus of elasticity.
190
+ ----
191
+
192
+ [source,yaml]
193
+ ----
194
+ definition: quotient of two quantities of different dimensions, used as a multiplier to express the proportionality equation between them
195
+ notes:
196
+ - A coefficient is a quantity having a dimension other than one. Examples: Hall coefficient, damping coefficient, temperature coefficient, gyromagnetic coefficient.
197
+ - The term "modulus" is sometimes used instead of coefficient. Example: modulus of elasticity.
198
+ ----
199
+
200
+
201
+ 2. A `<NOTE -` goes into `notes:`:
202
+
203
+ [source]
204
+ ----
205
+ quantity of dimension one defined by a combination of quantities
206
+ <NOTE – Characteristic numbers occur in particular in the theory of similarity. They carry the word "number" in their names. Examples: Reynolds number, Prandtl number.
207
+ ----
208
+
209
+ [source,yaml]
210
+ ----
211
+ definition:
212
+ notes:
213
+ - Characteristic numbers occur in particular in the theory of similarity. They carry the word "number" in their names. Examples: Reynolds number, Prandtl number.
214
+ ----
215
+
216
+
217
+ 3. Sometimes there are many `Note {N} to entry: `, they are identical to `NOTE -`.
218
+
219
+ [source]
220
+ ----
221
+ set of interrelated items that collectively fulfil a requirement
222
+ <p>Note 1 to entry: A system is considered to have a defined real or abstract boundary.
223
+ <p>Note 2 to entry: External resources (from outside the system boundary) may be required for the system to operate.
224
+ <p>Note 3 to entry: A system structure may be hierarchical, e.g. system, subsystem, component, etc.
225
+ <p>Note 4 to entry: Conditions of use and maintenance should be expressed or implied within the requirement.
226
+ ----
227
+
228
+ [source,yaml]
229
+ ----
230
+ definition: set of interrelated items that collectively fulfil a requirement
231
+ notes:
232
+ - A system is considered to have a defined real or abstract boundary.
233
+ - External resources (from outside the system boundary) may be required for the system to operate.
234
+ - A system structure may be hierarchical, e.g. system, subsystem, component, etc.
235
+ - Conditions of use and maintenance should be expressed or implied within the requirement.
236
+ ----
237
+
238
+
239
+ 4. Parse `EXAMPLE`:
240
+
241
+ [source]
242
+ ----
243
+ <a href=IEV112-01-01>quantity</a> which keeps the same value under particular circumstances, or which results from theoretical considerations
244
+ <p>EXAMPLE <a href=IEV103-05-26>time constant</a>, equilibrium constant for a chemical reaction, <a href=IEV112-03-09>fundamental physical constant</a>.
245
+ ----
246
+
247
+ =>
248
+
249
+ [source,yaml]
250
+ ----
251
+ definition: {{quantity, IEV:112-01-01}} which keeps the same value under particular circumstances, or which results from theoretical considerations
252
+ examples:
253
+ - {{time constant, IEV:103-05-26}}, equilibrium constant for a chemical reaction, {{fundamental physical constant, IEV:112-03-09}}.
254
+ ----
255
+
256
+
257
+ 5. Remember to parse both `EXAMPLE` and `Note {N} to entry:`.
258
+
259
+ [source]
260
+ ----
261
+ level of sub-division within a system hierarchy
262
+ <p>EXAMPLE System, subsystem, assembly, and component. <p>Note 1 to entry: From the maintenance perspective, the indenture level depends upon various factors, including the complexity of the item's construction, the accessibility of sub items, skill level of maintenance personnel, test equipment facilities, and safety considerations.
263
+ ----
264
+
265
+ [source,yaml]
266
+ ----
267
+ definition: level of sub-division within a system hierarchy
268
+ examples:
269
+ - System, subsystem, assembly, and component.
270
+ notes:
271
+ - From the maintenance perspective, the indenture level depends upon various factors, including the complexity of the item's construction, the accessibility of sub items, skill level of maintenance personnel, test equipment facilities, and safety considerations.
272
+ ----
49
273
 
50
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
274
 
52
- == Contributing
275
+ 6. Remember to parse both `EXEMPLE` and `Note {N} à l’article:` in French
276
+
277
+ [source]
278
+ ----
279
+ niveau de subdivision à l’intérieur de la hiérarchie d’un système
280
+ <p>EXEMPLE Système, sous-système, assemblage et composant. <p>Note 1 à l’article: Du point de vue de la maintenance, le niveau dans l’arborescence dépend de divers facteurs dont la complexité de la structure de l’entité, l’accessibilité aux sous-entités, le niveau de compétence du personnel de maintenance, les moyens de mesure et d’essai, et des considérations de sécurité.
281
+ ----
282
+
283
+ [source,yaml]
284
+ ----
285
+ definition: niveau de subdivision à l’intérieur de la hiérarchie d’un système
286
+ examples:
287
+ - Système, sous-système, assemblage et composant.
288
+ notes:
289
+ - Du point de vue de la maintenance, le niveau dans l’arborescence dépend de divers facteurs dont la complexité de la structure de l’entité, l’accessibilité aux sous-entités, le niveau de compétence du personnel de maintenance, les moyens de mesure et d’essai, et des considérations de sécurité.
290
+ ----
291
+
292
+
293
+ === Source field
294
+
295
+ Original:
296
+
297
+ [source]
298
+ ----
299
+ IEC 60050-311:2001, 311-01-04
300
+ ----
301
+
302
+ After parsing:
303
+
304
+ [source,yaml]
305
+ ----
306
+ authoritative_source:
307
+ ref: IEC 60050-311:2001, 311-01-04
308
+ ----
53
309
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/iev.
55
310
 
56
- == License
311
+ == Copyright and license
57
312
 
58
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
313
+ Data copyright IEC. All others copyright Ribose.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "iev"
data/exe/iev ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../lib/iev"
5
+ require_relative "../lib/iev/cli"
6
+
7
+ Iev::Cli.start(ARGV)
data/iev.gemspec CHANGED
@@ -1,40 +1,36 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path("lib", __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "iev/version"
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "iev"
7
- spec.version = IEV::VERSION
8
- spec.authors = ["Ribose Inc."]
9
- spec.email = ["open.source@ribose.com"]
8
+ spec.name = "iev"
9
+ spec.version = Iev::VERSION
10
+ spec.authors = ["Ribose Inc."]
11
+ spec.email = ["open.source@ribose.com"]
10
12
 
11
- spec.summary = "IEV: Fetch and encode IEV term from Electropedia"
12
- spec.description = "IEV: Fetch and encode IEV term from Electropedia"
13
- spec.homepage = "https://github.com/metanorma/iev"
14
- spec.license = "BSD-2-Clause"
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"
16
+ spec.license = "BSD-2-Clause"
15
17
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
19
  f.match(%r{^(test|spec|features)/})
18
20
  end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
23
  spec.require_paths = ["lib"]
22
24
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
23
25
 
24
- spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "debug"
26
- spec.add_development_dependency "rake", "~> 13.0"
27
- spec.add_development_dependency "rspec", "~> 3.0"
28
- spec.add_development_dependency "simplecov"
29
-
30
26
  spec.add_dependency "creek", "~> 2.5"
31
27
  spec.add_dependency "glossarist", ">= 2.3.0"
32
- spec.add_dependency "unitsml"
33
- spec.add_dependency "plurimath"
34
28
  spec.add_dependency "nokogiri", ">= 1.16.5"
29
+ spec.add_dependency "plurimath"
35
30
  spec.add_dependency "relaton", "~> 1.18"
36
31
  spec.add_dependency "sequel", "~> 5.40"
37
32
  spec.add_dependency "sqlite3", "~> 1.7.0"
38
33
  spec.add_dependency "thor", "~> 1.0"
34
+ spec.add_dependency "unitsml"
39
35
  spec.add_dependency "zeitwerk", "~> 2.4"
40
36
  end
@@ -3,8 +3,8 @@
3
3
  # (c) Copyright 2020 Ribose Inc.
4
4
  #
5
5
 
6
- module IEV
7
- module CLI
6
+ module Iev
7
+ module Cli
8
8
  class Command < Thor
9
9
  include CommandHelper
10
10
 
@@ -52,58 +52,58 @@ module IEV
52
52
  end
53
53
 
54
54
  shared_option :only_concepts,
55
- desc: "Only process concepts with IEVREF matching this argument, " +
56
- "'%' and '_' wildcards are supported and have meaning as in SQL " +
57
- "LIKE operator",
58
- methods: %i[xlsx2yaml db2yaml]
55
+ desc: "Only process concepts with IEVREF matching this argument, " \
56
+ "'%' and '_' wildcards are supported and have meaning as in SQL " \
57
+ "LIKE operator",
58
+ methods: %i[xlsx2yaml db2yaml]
59
59
 
60
60
  shared_option :only_languages,
61
- desc: "Only export these languages, skip concepts which aren't " +
62
- "translated to any of them (comma-separated list, language " +
63
- "codes must be as in spreadsheet)",
64
- methods: %i[xlsx2yaml db2yaml]
61
+ desc: "Only export these languages, skip concepts which aren't " \
62
+ "translated to any of them (comma-separated list, language " \
63
+ "codes must be as in spreadsheet)",
64
+ methods: %i[xlsx2yaml db2yaml]
65
65
 
66
66
  shared_option :output,
67
- desc: "Output directory",
68
- aliases: :o,
69
- default: Dir.pwd,
70
- methods: %i[xlsx2yaml db2yaml]
67
+ desc: "Output directory",
68
+ aliases: :o,
69
+ default: Dir.pwd,
70
+ methods: %i[xlsx2yaml db2yaml]
71
71
 
72
72
  shared_option :output,
73
- desc: "Output file",
74
- aliases: :o,
75
- default: File.join(Dir.pwd, "concepts.sqlite3"),
76
- methods: :xlsx2db
73
+ desc: "Output file",
74
+ aliases: :o,
75
+ default: File.join(Dir.pwd, "concepts.sqlite3"),
76
+ methods: :xlsx2db
77
77
 
78
78
  shared_option :progress,
79
- type: :boolean,
80
- desc: "Enables or disables progress indicator. By default disabled " +
81
- "when 'CI' environment variable is set and enabled otherwise",
82
- methods: %i[xlsx2yaml xlsx2db db2yaml]
79
+ type: :boolean,
80
+ desc: "Enables or disables progress indicator. By default disabled " \
81
+ "when 'CI' environment variable is set and enabled otherwise",
82
+ methods: %i[xlsx2yaml xlsx2db db2yaml]
83
83
 
84
84
  shared_option :debug_term_attributes,
85
- desc: "Enables debug messages about term attributes recognition",
86
- type: :boolean,
87
- default: false,
88
- methods: %i[xlsx2yaml db2yaml]
85
+ desc: "Enables debug messages about term attributes recognition",
86
+ type: :boolean,
87
+ default: false,
88
+ methods: %i[xlsx2yaml db2yaml]
89
89
 
90
90
  shared_option :debug_sources,
91
- desc: "Enables debug messages about authoritative sources recognition",
92
- type: :boolean,
93
- default: false,
94
- methods: %i[xlsx2yaml db2yaml]
91
+ desc: "Enables debug messages about authoritative sources recognition",
92
+ type: :boolean,
93
+ default: false,
94
+ methods: %i[xlsx2yaml db2yaml]
95
95
 
96
96
  shared_option :debug_relaton,
97
- desc: "Enables debug messages about Relaton integration",
98
- type: :boolean,
99
- default: false,
100
- methods: %i[xlsx2yaml db2yaml]
97
+ desc: "Enables debug messages about Relaton integration",
98
+ type: :boolean,
99
+ default: false,
100
+ methods: %i[xlsx2yaml db2yaml]
101
101
 
102
102
  shared_option :profile,
103
- desc: "Generates profiler reports for this program, requires ruby-prof",
104
- type: :boolean,
105
- default: false,
106
- methods: %i[xlsx2yaml xlsx2db db2yaml]
103
+ desc: "Generates profiler reports for this program, requires ruby-prof",
104
+ type: :boolean,
105
+ default: false,
106
+ methods: %i[xlsx2yaml xlsx2db db2yaml]
107
107
  end
108
108
  end
109
109
  end