unitsdb 2.1.1 → 2.2.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 +8 -1
- data/.gitignore +2 -0
- data/.gitmodules +4 -3
- data/.rubocop.yml +13 -8
- data/.rubocop_todo.yml +217 -100
- data/CLAUDE.md +55 -0
- data/Gemfile +4 -1
- data/README.adoc +283 -16
- data/data/dimensions.yaml +1864 -0
- data/data/prefixes.yaml +874 -0
- data/data/quantities.yaml +3715 -0
- data/data/scales.yaml +97 -0
- data/data/schemas/dimensions-schema.yaml +153 -0
- data/data/schemas/prefixes-schema.yaml +155 -0
- data/data/schemas/quantities-schema.yaml +117 -0
- data/data/schemas/scales-schema.yaml +106 -0
- data/data/schemas/unit_systems-schema.yaml +116 -0
- data/data/schemas/units-schema.yaml +215 -0
- data/data/unit_systems.yaml +78 -0
- data/data/units.yaml +14052 -0
- data/exe/unitsdb +7 -1
- data/lib/unitsdb/cli.rb +42 -15
- data/lib/unitsdb/commands/_modify.rb +40 -4
- data/lib/unitsdb/commands/base.rb +6 -2
- data/lib/unitsdb/commands/check_si/si_formatter.rb +488 -0
- data/lib/unitsdb/commands/check_si/si_matcher.rb +487 -0
- data/lib/unitsdb/commands/check_si/si_ttl_parser.rb +103 -0
- data/lib/unitsdb/commands/check_si/si_updater.rb +254 -0
- data/lib/unitsdb/commands/check_si.rb +54 -35
- data/lib/unitsdb/commands/get.rb +11 -10
- data/lib/unitsdb/commands/normalize.rb +21 -7
- data/lib/unitsdb/commands/qudt/check.rb +150 -0
- data/lib/unitsdb/commands/qudt/formatter.rb +194 -0
- data/lib/unitsdb/commands/qudt/matcher.rb +746 -0
- data/lib/unitsdb/commands/qudt/ttl_parser.rb +403 -0
- data/lib/unitsdb/commands/qudt/update.rb +126 -0
- data/lib/unitsdb/commands/qudt/updater.rb +189 -0
- data/lib/unitsdb/commands/qudt.rb +82 -0
- data/lib/unitsdb/commands/release.rb +12 -9
- data/lib/unitsdb/commands/search.rb +12 -11
- data/lib/unitsdb/commands/ucum/check.rb +42 -29
- data/lib/unitsdb/commands/ucum/formatter.rb +2 -1
- data/lib/unitsdb/commands/ucum/matcher.rb +23 -9
- data/lib/unitsdb/commands/ucum/update.rb +14 -13
- data/lib/unitsdb/commands/ucum/updater.rb +40 -6
- data/lib/unitsdb/commands/ucum/xml_parser.rb +0 -2
- data/lib/unitsdb/commands/ucum.rb +44 -4
- data/lib/unitsdb/commands/validate/identifiers.rb +2 -4
- data/lib/unitsdb/commands/validate/qudt_references.rb +111 -0
- data/lib/unitsdb/commands/validate/references.rb +36 -19
- data/lib/unitsdb/commands/validate/si_references.rb +3 -5
- data/lib/unitsdb/commands/validate/ucum_references.rb +105 -0
- data/lib/unitsdb/commands/validate.rb +67 -11
- data/lib/unitsdb/commands.rb +20 -0
- data/lib/unitsdb/database.rb +90 -52
- data/lib/unitsdb/dimension.rb +1 -4
- data/lib/unitsdb/dimension_details.rb +0 -1
- data/lib/unitsdb/dimensions.rb +0 -2
- data/lib/unitsdb/errors.rb +7 -0
- data/lib/unitsdb/prefix.rb +0 -4
- data/lib/unitsdb/prefix_reference.rb +0 -2
- data/lib/unitsdb/prefixes.rb +0 -1
- data/lib/unitsdb/quantities.rb +0 -2
- data/lib/unitsdb/quantity.rb +0 -6
- data/lib/unitsdb/qudt.rb +100 -0
- data/lib/unitsdb/root_unit_reference.rb +0 -3
- data/lib/unitsdb/scale.rb +0 -4
- data/lib/unitsdb/scale_reference.rb +0 -2
- data/lib/unitsdb/scales.rb +0 -2
- data/lib/unitsdb/si_derived_base.rb +0 -2
- data/lib/unitsdb/ucum.rb +14 -10
- data/lib/unitsdb/unit.rb +0 -10
- data/lib/unitsdb/unit_reference.rb +0 -2
- data/lib/unitsdb/unit_system.rb +1 -3
- data/lib/unitsdb/unit_system_reference.rb +0 -2
- data/lib/unitsdb/unit_systems.rb +0 -2
- data/lib/unitsdb/units.rb +0 -2
- data/lib/unitsdb/utils.rb +32 -21
- data/lib/unitsdb/version.rb +5 -1
- data/lib/unitsdb.rb +62 -14
- data/unitsdb.gemspec +6 -3
- metadata +52 -13
- data/lib/unitsdb/commands/si_formatter.rb +0 -485
- data/lib/unitsdb/commands/si_matcher.rb +0 -470
- data/lib/unitsdb/commands/si_ttl_parser.rb +0 -100
- data/lib/unitsdb/commands/si_updater.rb +0 -212
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7fda421d6dfc06976fad5da00dd85f0fb1dbb3dc4865e2904a28b237530ace05
|
|
4
|
+
data.tar.gz: 9e4fdd8395fab543936c4d4b415f05c468b788d287545d3ebfd774a53a9f766c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8453d7f411242d4fbf035b73cee6d968505c60e884606b872317a1fe53dd93b3e603a0497c1869b1768649dbf2c23a6fdcbe233dccf4eee95f482f1d440f2163
|
|
7
|
+
data.tar.gz: 5a7d1579b935b9afb7bb5e4c0ab8c25e943be6b525d401411bf97d8b3101061a0b211631af0740dcd3476fb012c2c3048dadc0399ec75f91ed425e8416bbd59e
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
name: release
|
|
4
4
|
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
packages: write
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
5
10
|
on:
|
|
6
11
|
workflow_dispatch:
|
|
7
12
|
inputs:
|
|
8
13
|
next_version:
|
|
9
14
|
description: |
|
|
10
|
-
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
|
15
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
|
16
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
|
11
17
|
required: true
|
|
12
18
|
default: 'skip'
|
|
13
19
|
repository_dispatch:
|
|
@@ -18,6 +24,7 @@ jobs:
|
|
|
18
24
|
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
|
19
25
|
with:
|
|
20
26
|
next_version: ${{ github.event.inputs.next_version }}
|
|
27
|
+
submodules: true
|
|
21
28
|
secrets:
|
|
22
29
|
rubygems-api-key: ${{ secrets.UNITSML_CI_RUBYGEMS_API_KEY }}
|
|
23
30
|
pat_token: ${{ secrets.UNITSML_CI_PAT_TOKEN }}
|
data/.gitignore
CHANGED
data/.gitmodules
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
[submodule "
|
|
2
|
-
path =
|
|
3
|
-
url = https://github.com/unitsml/unitsdb
|
|
1
|
+
[submodule "data"]
|
|
2
|
+
path = data
|
|
3
|
+
url = https://github.com/unitsml/unitsdb.git
|
|
4
|
+
branch = refs/tags/v2.0.0
|
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
inherit_from:
|
|
1
|
+
inherit_from:
|
|
2
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
3
|
+
- .rubocop_todo.yml
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
EnforcedStyle: double_quotes
|
|
5
|
+
plugins:
|
|
6
|
+
- rubocop-performance
|
|
7
|
+
- rubocop-rake
|
|
8
|
+
- rubocop-rspec
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
AllCops:
|
|
11
|
+
TargetRubyVersion: 3.1
|
|
12
|
+
NewCops: enable
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'vendor/**/*'
|
|
15
|
+
- 'data/**/*'
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,33 +1,55 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-04-03 22:15:03 UTC using RuboCop version 1.86.0.
|
|
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
9
|
# Offense count: 1
|
|
10
|
+
Gemspec/RequiredRubyVersion:
|
|
11
|
+
Exclude:
|
|
12
|
+
- 'unitsdb.gemspec'
|
|
13
|
+
|
|
14
|
+
# Offense count: 9
|
|
10
15
|
# This cop supports safe autocorrection (--autocorrect).
|
|
11
16
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
12
|
-
# SupportedStyles:
|
|
13
|
-
Layout/
|
|
17
|
+
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
18
|
+
Layout/ArgumentAlignment:
|
|
14
19
|
Exclude:
|
|
15
|
-
- 'lib/unitsdb/commands/
|
|
20
|
+
- 'lib/unitsdb/commands/get.rb'
|
|
21
|
+
- 'lib/unitsdb/commands/release.rb'
|
|
22
|
+
- 'lib/unitsdb/commands/search.rb'
|
|
23
|
+
- 'lib/unitsdb/commands/validate/identifiers.rb'
|
|
24
|
+
- 'lib/unitsdb/commands/validate/qudt_references.rb'
|
|
25
|
+
- 'lib/unitsdb/commands/validate/references.rb'
|
|
26
|
+
- 'lib/unitsdb/commands/validate/si_references.rb'
|
|
27
|
+
- 'lib/unitsdb/commands/validate/ucum_references.rb'
|
|
28
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
16
29
|
|
|
17
|
-
# Offense count:
|
|
30
|
+
# Offense count: 6
|
|
18
31
|
# This cop supports safe autocorrection (--autocorrect).
|
|
19
|
-
# Configuration parameters:
|
|
20
|
-
|
|
32
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
33
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
34
|
+
Layout/BlockAlignment:
|
|
21
35
|
Exclude:
|
|
22
|
-
- '
|
|
36
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
37
|
+
- 'spec/unitsdb/commands/qudt/update_spec.rb'
|
|
38
|
+
- 'spec/unitsdb/commands/search_spec.rb'
|
|
39
|
+
- 'spec/unitsdb/commands/validate/qudt_references_spec.rb'
|
|
40
|
+
- 'spec/unitsdb/commands/validate/ucum_references_spec.rb'
|
|
23
41
|
|
|
24
|
-
# Offense count:
|
|
42
|
+
# Offense count: 5
|
|
25
43
|
# This cop supports safe autocorrection (--autocorrect).
|
|
26
|
-
Layout/
|
|
44
|
+
Layout/BlockEndNewline:
|
|
27
45
|
Exclude:
|
|
28
|
-
- '
|
|
46
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
47
|
+
- 'spec/unitsdb/commands/qudt/update_spec.rb'
|
|
48
|
+
- 'spec/unitsdb/commands/search_spec.rb'
|
|
49
|
+
- 'spec/unitsdb/commands/validate/qudt_references_spec.rb'
|
|
50
|
+
- 'spec/unitsdb/commands/validate/ucum_references_spec.rb'
|
|
29
51
|
|
|
30
|
-
# Offense count:
|
|
52
|
+
# Offense count: 5
|
|
31
53
|
# This cop supports safe autocorrection (--autocorrect).
|
|
32
54
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
33
55
|
# SupportedHashRocketStyles: key, separator, table
|
|
@@ -35,154 +57,249 @@ Layout/EmptyLineAfterMagicComment:
|
|
|
35
57
|
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
36
58
|
Layout/HashAlignment:
|
|
37
59
|
Exclude:
|
|
38
|
-
- '
|
|
60
|
+
- 'lib/unitsdb/cli.rb'
|
|
61
|
+
- 'lib/unitsdb/commands/_modify.rb'
|
|
62
|
+
- 'lib/unitsdb/commands/qudt.rb'
|
|
63
|
+
- 'lib/unitsdb/commands/ucum.rb'
|
|
64
|
+
- 'lib/unitsdb/commands/validate.rb'
|
|
39
65
|
|
|
40
|
-
# Offense count:
|
|
66
|
+
# Offense count: 10
|
|
41
67
|
# This cop supports safe autocorrection (--autocorrect).
|
|
42
|
-
# Configuration parameters:
|
|
43
|
-
|
|
68
|
+
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
69
|
+
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
70
|
+
Layout/IndentationWidth:
|
|
44
71
|
Exclude:
|
|
45
|
-
- '
|
|
46
|
-
- 'spec/unitsdb/commands/
|
|
72
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
73
|
+
- 'spec/unitsdb/commands/qudt/update_spec.rb'
|
|
74
|
+
- 'spec/unitsdb/commands/search_spec.rb'
|
|
75
|
+
- 'spec/unitsdb/commands/validate/qudt_references_spec.rb'
|
|
76
|
+
- 'spec/unitsdb/commands/validate/ucum_references_spec.rb'
|
|
47
77
|
|
|
48
|
-
# Offense count:
|
|
49
|
-
# This cop supports
|
|
50
|
-
# Configuration parameters:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
78
|
+
# Offense count: 393
|
|
79
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
80
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
81
|
+
# URISchemes: http, https
|
|
82
|
+
Layout/LineLength:
|
|
83
|
+
Enabled: false
|
|
54
84
|
|
|
55
|
-
# Offense count:
|
|
56
|
-
|
|
85
|
+
# Offense count: 9
|
|
86
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
87
|
+
# Configuration parameters: AllowInHeredoc.
|
|
88
|
+
Layout/TrailingWhitespace:
|
|
57
89
|
Exclude:
|
|
90
|
+
- 'lib/unitsdb/commands/get.rb'
|
|
91
|
+
- 'lib/unitsdb/commands/release.rb'
|
|
58
92
|
- 'lib/unitsdb/commands/search.rb'
|
|
93
|
+
- 'lib/unitsdb/commands/validate/identifiers.rb'
|
|
94
|
+
- 'lib/unitsdb/commands/validate/qudt_references.rb'
|
|
95
|
+
- 'lib/unitsdb/commands/validate/references.rb'
|
|
59
96
|
- 'lib/unitsdb/commands/validate/si_references.rb'
|
|
97
|
+
- 'lib/unitsdb/commands/validate/ucum_references.rb'
|
|
98
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
60
99
|
|
|
61
|
-
# Offense count:
|
|
62
|
-
# Configuration parameters:
|
|
100
|
+
# Offense count: 9
|
|
101
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
102
|
+
Lint/DuplicateBranch:
|
|
103
|
+
Exclude:
|
|
104
|
+
- 'lib/unitsdb/commands/check_si/si_formatter.rb'
|
|
105
|
+
- 'lib/unitsdb/commands/qudt/matcher.rb'
|
|
106
|
+
- 'lib/unitsdb/commands/ucum/matcher.rb'
|
|
107
|
+
- 'lib/unitsdb/database.rb'
|
|
108
|
+
|
|
109
|
+
# Offense count: 82
|
|
110
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
63
111
|
Metrics/AbcSize:
|
|
64
|
-
|
|
112
|
+
Enabled: false
|
|
65
113
|
|
|
66
|
-
# Offense count:
|
|
67
|
-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
114
|
+
# Offense count: 12
|
|
115
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
68
116
|
# AllowedMethods: refine
|
|
69
117
|
Metrics/BlockLength:
|
|
70
|
-
Max:
|
|
118
|
+
Max: 62
|
|
71
119
|
|
|
72
|
-
# Offense count:
|
|
73
|
-
# Configuration parameters:
|
|
74
|
-
Metrics/ClassLength:
|
|
75
|
-
Max: 442
|
|
76
|
-
|
|
77
|
-
# Offense count: 45
|
|
78
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
120
|
+
# Offense count: 73
|
|
121
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
79
122
|
Metrics/CyclomaticComplexity:
|
|
80
|
-
|
|
123
|
+
Enabled: false
|
|
81
124
|
|
|
82
|
-
# Offense count:
|
|
125
|
+
# Offense count: 110
|
|
83
126
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
84
127
|
Metrics/MethodLength:
|
|
85
|
-
Max:
|
|
86
|
-
|
|
87
|
-
# Offense count: 5
|
|
88
|
-
# Configuration parameters: CountComments, CountAsOne.
|
|
89
|
-
Metrics/ModuleLength:
|
|
90
|
-
Max: 369
|
|
128
|
+
Max: 150
|
|
91
129
|
|
|
92
130
|
# Offense count: 2
|
|
93
131
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
94
132
|
Metrics/ParameterLists:
|
|
95
133
|
Max: 6
|
|
96
134
|
|
|
97
|
-
# Offense count:
|
|
98
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
135
|
+
# Offense count: 64
|
|
136
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
99
137
|
Metrics/PerceivedComplexity:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# Offense count: 1
|
|
103
|
-
Naming/AccessorMethodName:
|
|
104
|
-
Exclude:
|
|
105
|
-
- 'lib/unitsdb/commands/si_formatter.rb'
|
|
138
|
+
Enabled: false
|
|
106
139
|
|
|
107
140
|
# Offense count: 3
|
|
108
141
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
109
142
|
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
|
110
143
|
Naming/MethodParameterName:
|
|
111
144
|
Exclude:
|
|
112
|
-
- 'lib/unitsdb/commands/si_ttl_parser.rb'
|
|
145
|
+
- 'lib/unitsdb/commands/check_si/si_ttl_parser.rb'
|
|
113
146
|
- 'lib/unitsdb/utils.rb'
|
|
114
147
|
|
|
115
|
-
# Offense count:
|
|
116
|
-
# Configuration parameters:
|
|
117
|
-
|
|
118
|
-
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
119
|
-
# AllowedMethods: is_a?
|
|
120
|
-
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
121
|
-
Naming/PredicateName:
|
|
148
|
+
# Offense count: 9
|
|
149
|
+
# Configuration parameters: MinSize.
|
|
150
|
+
Performance/CollectionLiteralInLoop:
|
|
122
151
|
Exclude:
|
|
123
|
-
- '
|
|
124
|
-
- 'lib/unitsdb/commands/
|
|
152
|
+
- 'lib/unitsdb/commands/check_si/si_formatter.rb'
|
|
153
|
+
- 'lib/unitsdb/commands/check_si/si_matcher.rb'
|
|
154
|
+
- 'lib/unitsdb/commands/check_si/si_updater.rb'
|
|
155
|
+
- 'lib/unitsdb/database.rb'
|
|
125
156
|
|
|
126
|
-
# Offense count:
|
|
127
|
-
|
|
128
|
-
Style/CombinableLoops:
|
|
157
|
+
# Offense count: 2
|
|
158
|
+
RSpec/BeforeAfterAll:
|
|
129
159
|
Exclude:
|
|
130
|
-
- '
|
|
160
|
+
- '**/spec/spec_helper.rb'
|
|
161
|
+
- '**/spec/rails_helper.rb'
|
|
162
|
+
- '**/spec/support/**/*.rb'
|
|
163
|
+
- 'spec/unitsdb/commands/validate/references_spec.rb'
|
|
131
164
|
|
|
132
|
-
# Offense count:
|
|
133
|
-
# Configuration parameters:
|
|
134
|
-
|
|
135
|
-
|
|
165
|
+
# Offense count: 2
|
|
166
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
167
|
+
# Prefixes: when, with, without
|
|
168
|
+
RSpec/ContextWording:
|
|
169
|
+
Exclude:
|
|
170
|
+
- 'spec/unitsdb/commands/check_si_command_spec.rb'
|
|
171
|
+
|
|
172
|
+
# Offense count: 2
|
|
173
|
+
# Configuration parameters: IgnoredMetadata.
|
|
174
|
+
RSpec/DescribeClass:
|
|
175
|
+
Exclude:
|
|
176
|
+
- '**/spec/features/**/*'
|
|
177
|
+
- '**/spec/requests/**/*'
|
|
178
|
+
- '**/spec/routing/**/*'
|
|
179
|
+
- '**/spec/system/**/*'
|
|
180
|
+
- '**/spec/views/**/*'
|
|
181
|
+
- 'spec/exe/unitsdb_spec.rb'
|
|
182
|
+
- 'spec/unitsdb/version_compatibility_spec.rb'
|
|
183
|
+
|
|
184
|
+
# Offense count: 43
|
|
185
|
+
# Configuration parameters: CountAsOne.
|
|
186
|
+
RSpec/ExampleLength:
|
|
187
|
+
Max: 30
|
|
188
|
+
|
|
189
|
+
# Offense count: 22
|
|
190
|
+
RSpec/ExpectOutput:
|
|
191
|
+
Exclude:
|
|
192
|
+
- 'spec/unitsdb/commands/check_si_command_spec.rb'
|
|
193
|
+
- 'spec/unitsdb/commands/get_spec.rb'
|
|
194
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
195
|
+
- 'spec/unitsdb/commands/search_spec.rb'
|
|
196
|
+
- 'spec/unitsdb/commands/validate/identifiers_spec.rb'
|
|
197
|
+
- 'spec/unitsdb/commands/validate/si_references_spec.rb'
|
|
198
|
+
|
|
199
|
+
# Offense count: 8
|
|
200
|
+
RSpec/LeakyLocalVariable:
|
|
201
|
+
Exclude:
|
|
202
|
+
- 'spec/unitsdb/database_spec.rb'
|
|
203
|
+
- 'spec/unitsdb/dimensions_spec.rb'
|
|
204
|
+
- 'spec/unitsdb/prefixes_spec.rb'
|
|
205
|
+
- 'spec/unitsdb/quantities_spec.rb'
|
|
206
|
+
- 'spec/unitsdb/scales_spec.rb'
|
|
207
|
+
- 'spec/unitsdb/unit_spec.rb'
|
|
208
|
+
- 'spec/unitsdb/unit_systems_spec.rb'
|
|
209
|
+
- 'spec/unitsdb/units_spec.rb'
|
|
210
|
+
|
|
211
|
+
# Offense count: 6
|
|
212
|
+
# Configuration parameters: .
|
|
213
|
+
# SupportedStyles: have_received, receive
|
|
214
|
+
RSpec/MessageSpies:
|
|
215
|
+
EnforcedStyle: receive
|
|
216
|
+
|
|
217
|
+
# Offense count: 52
|
|
218
|
+
RSpec/MultipleExpectations:
|
|
219
|
+
Max: 15
|
|
220
|
+
|
|
221
|
+
# Offense count: 3
|
|
222
|
+
# Configuration parameters: AllowSubject.
|
|
223
|
+
RSpec/MultipleMemoizedHelpers:
|
|
224
|
+
Max: 6
|
|
225
|
+
|
|
226
|
+
# Offense count: 2
|
|
227
|
+
# Configuration parameters: AllowedGroups.
|
|
228
|
+
RSpec/NestedGroups:
|
|
229
|
+
Max: 4
|
|
230
|
+
|
|
231
|
+
# Offense count: 2
|
|
232
|
+
RSpec/RepeatedExample:
|
|
233
|
+
Exclude:
|
|
234
|
+
- 'spec/exe/unitsdb_spec.rb'
|
|
136
235
|
|
|
137
236
|
# Offense count: 1
|
|
237
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
|
|
238
|
+
# SupportedInflectors: default, active_support
|
|
239
|
+
RSpec/SpecFilePathFormat:
|
|
240
|
+
Exclude:
|
|
241
|
+
- '**/spec/routing/**/*'
|
|
242
|
+
- 'spec/unitsdb/bundled_data_spec.rb'
|
|
243
|
+
|
|
244
|
+
# Offense count: 17
|
|
245
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
|
246
|
+
RSpec/VerifiedDoubles:
|
|
247
|
+
Exclude:
|
|
248
|
+
- 'spec/unitsdb/commands/validate/qudt_references_spec.rb'
|
|
249
|
+
- 'spec/unitsdb/commands/validate/references_spec.rb'
|
|
250
|
+
- 'spec/unitsdb/commands/validate/ucum_references_spec.rb'
|
|
251
|
+
|
|
252
|
+
# Offense count: 5
|
|
138
253
|
# This cop supports safe autocorrection (--autocorrect).
|
|
139
|
-
# Configuration parameters:
|
|
140
|
-
# SupportedStyles:
|
|
141
|
-
|
|
254
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
255
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
256
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
257
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
258
|
+
# AllowedMethods: lambda, proc, it
|
|
259
|
+
Style/BlockDelimiters:
|
|
142
260
|
Exclude:
|
|
143
|
-
- '
|
|
261
|
+
- 'spec/unitsdb/commands/normalize_spec.rb'
|
|
262
|
+
- 'spec/unitsdb/commands/qudt/update_spec.rb'
|
|
263
|
+
- 'spec/unitsdb/commands/search_spec.rb'
|
|
264
|
+
- 'spec/unitsdb/commands/validate/qudt_references_spec.rb'
|
|
265
|
+
- 'spec/unitsdb/commands/validate/ucum_references_spec.rb'
|
|
144
266
|
|
|
145
267
|
# Offense count: 1
|
|
146
268
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
147
|
-
|
|
148
|
-
# SupportedStyles: always, always_true, never
|
|
149
|
-
Style/FrozenStringLiteralComment:
|
|
269
|
+
Style/CombinableLoops:
|
|
150
270
|
Exclude:
|
|
151
|
-
- '
|
|
152
|
-
- 'ucum-test.rb'
|
|
271
|
+
- 'lib/unitsdb/commands/check_si/si_matcher.rb'
|
|
153
272
|
|
|
154
273
|
# Offense count: 2
|
|
155
274
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
156
275
|
Style/IdenticalConditionalBranches:
|
|
157
276
|
Exclude:
|
|
158
|
-
- 'lib/unitsdb/commands/si_formatter.rb'
|
|
277
|
+
- 'lib/unitsdb/commands/check_si/si_formatter.rb'
|
|
159
278
|
|
|
160
279
|
# Offense count: 1
|
|
161
|
-
|
|
280
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
281
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
|
282
|
+
# SupportedStyles: predicate, comparison
|
|
283
|
+
Style/NumericPredicate:
|
|
162
284
|
Exclude:
|
|
163
|
-
- '
|
|
285
|
+
- 'spec/**/*'
|
|
286
|
+
- 'exe/unitsdb'
|
|
164
287
|
|
|
165
|
-
# Offense count:
|
|
288
|
+
# Offense count: 14
|
|
166
289
|
# Configuration parameters: AllowedMethods.
|
|
167
290
|
# AllowedMethods: respond_to_missing?
|
|
168
291
|
Style/OptionalBooleanParameter:
|
|
169
292
|
Exclude:
|
|
170
293
|
- 'lib/unitsdb/commands/check_si.rb'
|
|
171
|
-
- 'lib/unitsdb/commands/si_updater.rb'
|
|
294
|
+
- 'lib/unitsdb/commands/check_si/si_updater.rb'
|
|
295
|
+
- 'lib/unitsdb/commands/qudt/check.rb'
|
|
296
|
+
- 'lib/unitsdb/commands/qudt/update.rb'
|
|
297
|
+
- 'lib/unitsdb/commands/qudt/updater.rb'
|
|
172
298
|
- 'lib/unitsdb/commands/ucum/check.rb'
|
|
173
299
|
- 'lib/unitsdb/commands/ucum/updater.rb'
|
|
174
300
|
|
|
175
|
-
# Offense count:
|
|
176
|
-
#
|
|
177
|
-
|
|
178
|
-
# AllowedMethods: present?, blank?, presence, try, try!
|
|
179
|
-
Style/SafeNavigation:
|
|
301
|
+
# Offense count: 1
|
|
302
|
+
# Configuration parameters: Max.
|
|
303
|
+
Style/SafeNavigationChainLength:
|
|
180
304
|
Exclude:
|
|
181
|
-
- 'lib/unitsdb/commands/
|
|
182
|
-
|
|
183
|
-
# Offense count: 12
|
|
184
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
185
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
186
|
-
# URISchemes: http, https
|
|
187
|
-
Layout/LineLength:
|
|
188
|
-
Max: 140
|
|
305
|
+
- 'lib/unitsdb/commands/check_si/si_matcher.rb'
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Development Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bundle install # Install dependencies
|
|
9
|
+
bundle exec rake # Run full default task (rspec + rubocop)
|
|
10
|
+
bundle exec rspec # Run all tests
|
|
11
|
+
bundle exec rspec spec/path/to/file_spec.rb # Run single spec
|
|
12
|
+
bundle exec rubocop # Lint all files
|
|
13
|
+
bundle exec rake build # Build the gem
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
### Bundled Data
|
|
19
|
+
|
|
20
|
+
The gem ships UnitsDB YAML data files in `data/` (a git submodule at https://github.com/unitsml/unitsdb). These are included in the published gem via `spec.files += Dir.glob("data/**/*.yaml")` in the gemspec.
|
|
21
|
+
|
|
22
|
+
Two entry points for the bundled data:
|
|
23
|
+
- `Unitsdb.data_dir` — path to the `data/` directory inside the gem
|
|
24
|
+
- `Unitsdb.database` — pre-loaded `Database.from_db(data_dir)` instance (cached)
|
|
25
|
+
|
|
26
|
+
The correspondence between gem version and data version is tracked via
|
|
27
|
+
`Unitsdb::UNITS_DATA_VERSION` (e.g. `"2.0.0"`). **The UnitsDB data must be
|
|
28
|
+
released (tagged) before the gem can be released with updated data.** When
|
|
29
|
+
releasing with new data: tag the data in `unitsml/unitsdb`, then update
|
|
30
|
+
`.gitmodules` (`branch = refs/tags/new-data-tag`) and bump both `VERSION` and
|
|
31
|
+
`UNITS_DATA_VERSION` in `lib/unitsdb/version.rb`.
|
|
32
|
+
|
|
33
|
+
### Core Classes
|
|
34
|
+
|
|
35
|
+
- **`Unitsdb::Database`** — Loads all YAML files, provides `search`, `get_by_id`, `find_by_type`, `find_by_symbol`, `match_entities`, `validate_uniqueness`, `validate_references`
|
|
36
|
+
- **`Unitsdb::Cli`** (Thor-based) — Command-line interface with subcommands: `validate`, `search`, `get`, `check_si`, `ucum`, `qudt`, `_modify`, `release`
|
|
37
|
+
- **`lib/unitsdb/commands/base.rb`** — Base class for commands; provides `load_database` and `@options[:database]`
|
|
38
|
+
|
|
39
|
+
### Model Pattern
|
|
40
|
+
|
|
41
|
+
Entity types (Unit, Prefix, Dimension, Quantity, UnitSystem, etc.) are Lutaml::Model-serializable classes. They are loaded from YAML via `Database.from_db`, which validates `schema_version: "2.0.0"` across all files and merges them into a single object.
|
|
42
|
+
|
|
43
|
+
### Workflow Files
|
|
44
|
+
|
|
45
|
+
Workflows in `.github/workflows/` are auto-generated by **Cimas** (metanorma/cimas) and delegate to shared reusable workflows in `metanorma/ci`:
|
|
46
|
+
- `rake.yml` → `generic-rake.yml@main` — runs tests/lint on push/PR
|
|
47
|
+
- `release.yml` → `rubygems-release.yml@main` — builds and publishes gem
|
|
48
|
+
- `dependent-gems.yml` → `dependent-rake.yml@main` — tests downstream consumers
|
|
49
|
+
|
|
50
|
+
### Git Submodule
|
|
51
|
+
|
|
52
|
+
`data/` is a git submodule pinned to a specific tag in https://github.com/unitsml/unitsdb
|
|
53
|
+
(e.g. `branch = refs/tags/v2.0.0` in `.gitmodules`). The CI `rake.yml` uses
|
|
54
|
+
`submodules: 'recursive'` so tests have the data available. The release workflow
|
|
55
|
+
uses `submodules: true` to initialize the submodule during checkout.
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,12 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in suma.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem "
|
|
8
|
+
gem "canon"
|
|
9
|
+
gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
|
|
9
10
|
gem "nokogiri"
|
|
10
11
|
gem "rake"
|
|
11
12
|
gem "rspec"
|
|
12
13
|
gem "rubocop"
|
|
13
14
|
gem "rubocop-performance"
|
|
15
|
+
gem "rubocop-rake"
|
|
16
|
+
gem "rubocop-rspec"
|