unitsdb 1.0.0 → 2.0.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/.rspec +2 -1
  4. data/.rubocop_todo.yml +168 -15
  5. data/Gemfile +3 -2
  6. data/README.adoc +803 -1
  7. data/exe/unitsdb +7 -0
  8. data/lib/unitsdb/cli.rb +88 -0
  9. data/lib/unitsdb/commands/_modify.rb +22 -0
  10. data/lib/unitsdb/commands/base.rb +26 -0
  11. data/lib/unitsdb/commands/check_si.rb +124 -0
  12. data/lib/unitsdb/commands/get.rb +133 -0
  13. data/lib/unitsdb/commands/normalize.rb +81 -0
  14. data/lib/unitsdb/commands/release.rb +73 -0
  15. data/lib/unitsdb/commands/search.rb +219 -0
  16. data/lib/unitsdb/commands/si_formatter.rb +485 -0
  17. data/lib/unitsdb/commands/si_matcher.rb +470 -0
  18. data/lib/unitsdb/commands/si_ttl_parser.rb +100 -0
  19. data/lib/unitsdb/commands/si_updater.rb +212 -0
  20. data/lib/unitsdb/commands/ucum/check.rb +126 -0
  21. data/lib/unitsdb/commands/ucum/formatter.rb +141 -0
  22. data/lib/unitsdb/commands/ucum/matcher.rb +301 -0
  23. data/lib/unitsdb/commands/ucum/update.rb +84 -0
  24. data/lib/unitsdb/commands/ucum/updater.rb +98 -0
  25. data/lib/unitsdb/commands/ucum/xml_parser.rb +34 -0
  26. data/lib/unitsdb/commands/ucum.rb +43 -0
  27. data/lib/unitsdb/commands/validate/identifiers.rb +42 -0
  28. data/lib/unitsdb/commands/validate/references.rb +318 -0
  29. data/lib/unitsdb/commands/validate/si_references.rb +109 -0
  30. data/lib/unitsdb/commands/validate.rb +40 -0
  31. data/lib/unitsdb/database.rb +662 -0
  32. data/lib/unitsdb/dimension.rb +49 -0
  33. data/lib/unitsdb/dimension_details.rb +20 -0
  34. data/lib/unitsdb/dimension_reference.rb +8 -0
  35. data/lib/unitsdb/dimensions.rb +5 -10
  36. data/lib/unitsdb/errors.rb +13 -0
  37. data/lib/unitsdb/external_reference.rb +14 -0
  38. data/lib/unitsdb/identifier.rb +8 -0
  39. data/lib/unitsdb/localized_string.rb +17 -0
  40. data/lib/unitsdb/prefix.rb +30 -0
  41. data/lib/unitsdb/prefix_reference.rb +10 -0
  42. data/lib/unitsdb/prefixes.rb +5 -11
  43. data/lib/unitsdb/quantities.rb +5 -31
  44. data/lib/unitsdb/quantity.rb +21 -0
  45. data/lib/unitsdb/quantity_reference.rb +10 -0
  46. data/lib/unitsdb/root_unit_reference.rb +14 -0
  47. data/lib/unitsdb/scale.rb +17 -0
  48. data/lib/unitsdb/scale_properties.rb +12 -0
  49. data/lib/unitsdb/scale_reference.rb +10 -0
  50. data/lib/unitsdb/scales.rb +12 -0
  51. data/lib/unitsdb/si_derived_base.rb +19 -0
  52. data/lib/unitsdb/symbol_presentations.rb +3 -8
  53. data/lib/unitsdb/ucum.rb +198 -0
  54. data/lib/unitsdb/unit.rb +63 -0
  55. data/lib/unitsdb/unit_reference.rb +10 -0
  56. data/lib/unitsdb/unit_system.rb +15 -0
  57. data/lib/unitsdb/unit_system_reference.rb +10 -0
  58. data/lib/unitsdb/unit_systems.rb +5 -10
  59. data/lib/unitsdb/units.rb +5 -10
  60. data/lib/unitsdb/utils.rb +84 -0
  61. data/lib/unitsdb/version.rb +1 -1
  62. data/lib/unitsdb.rb +12 -2
  63. data/unitsdb.gemspec +6 -3
  64. metadata +124 -20
  65. data/lib/unitsdb/dimensions/dimension.rb +0 -59
  66. data/lib/unitsdb/dimensions/quantity.rb +0 -32
  67. data/lib/unitsdb/dimensions/symbol.rb +0 -26
  68. data/lib/unitsdb/prefixes/prefix.rb +0 -35
  69. data/lib/unitsdb/prefixes/symbol.rb +0 -17
  70. data/lib/unitsdb/quantities/quantity.rb +0 -37
  71. data/lib/unitsdb/quantities/unit_reference.rb +0 -15
  72. data/lib/unitsdb/unit_systems/unit_system.rb +0 -19
  73. data/lib/unitsdb/units/quantity_reference.rb +0 -17
  74. data/lib/unitsdb/units/root_unit.rb +0 -21
  75. data/lib/unitsdb/units/root_units.rb +0 -18
  76. data/lib/unitsdb/units/si_derived_base.rb +0 -26
  77. data/lib/unitsdb/units/symbol.rb +0 -19
  78. data/lib/unitsdb/units/system.rb +0 -17
  79. data/lib/unitsdb/units/unit.rb +0 -73
  80. data/lib/unitsdb/unitsdb.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a036c803ba8da7f845b70007e7472b55cf85f7a9de544c7b685fe34801f5876
4
- data.tar.gz: 4f3911a631032c2fe688bbd33b49158f09feb88f2208106af5d022c9ecd57562
3
+ metadata.gz: cf88e0568f2d8ed9a4f8391750cb65cdcdfd07b889a96c9a852266aa29cc4117
4
+ data.tar.gz: a8abc084baecc459c46f4771bf1da41567604096d91f393a06e63c34e0250c27
5
5
  SHA512:
6
- metadata.gz: 446489baaa5df1b34402c43ca00354ec222cb4cd9e96aab1e5815c8716c2330ce37ad995a7f5f63d55e02c0eef7170a238928ef539c54a9bf426eeb58099e4ba
7
- data.tar.gz: 3be2b704e450eb09b37dec01d500ad4bfbaf1c669513bc31e1ad124c17252b9dd77ad42df2c3aa71b19b8a09aa656b47ce2f2ebe1b25c5146f1871e6afa9dee5
6
+ metadata.gz: c013906154918a42097de198a0e38373e6c6cd317390899c375bb81ec26b1446894bfd6260b85d69e32bcc6e1ebaea677c1c03f4d5553058d16c870e722ef7d8
7
+ data.tar.gz: d62bfc59d71ddf82571205fc513cc622ac1ddddf4afe8f66af3c3a1e078f4548ff9756ff2a7140a16b78b4030371a4d842e1ebefa406e2a58f631b18a0dd82ba
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "spec/fixtures/unitsdb"]
2
+ path = spec/fixtures/unitsdb
3
+ url = https://github.com/unitsml/unitsdb/
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
- --format documentation
2
1
  --color
3
2
  --require spec_helper
3
+ --backtrace
4
+ --exclude-pattern "spec/fixtures/**/*_spec.rb"
data/.rubocop_todo.yml CHANGED
@@ -1,35 +1,188 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-11 04:48:38 UTC using RuboCop version 1.70.0.
3
+ # on 2025-05-21 10:17:19 UTC using RuboCop version 1.75.6.
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
- # Configuration parameters: Severity, Include.
11
- # Include: **/*.gemspec
12
- Gemspec/DuplicatedAssignment:
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
12
+ # SupportedStyles: with_first_element, with_fixed_indentation
13
+ Layout/ArrayAlignment:
13
14
  Exclude:
14
- - 'unitsdb.gemspec'
15
+ - 'lib/unitsdb/commands/ucum/check.rb'
15
16
 
16
- # Offense count: 2
17
+ # Offense count: 1
17
18
  # This cop supports safe autocorrection (--autocorrect).
18
- # Configuration parameters: EnforcedStyle, IndentationWidth.
19
- # SupportedStyles: special_inside_parentheses, consistent, align_braces
20
- Layout/FirstHashElementIndentation:
19
+ # Configuration parameters: AutoCorrect, AllowBorderComment, AllowMarginComment.
20
+ Layout/EmptyComment:
21
+ Exclude:
22
+ - 'ucum-test.rb'
23
+
24
+ # Offense count: 1
25
+ # This cop supports safe autocorrection (--autocorrect).
26
+ Layout/EmptyLineAfterMagicComment:
27
+ Exclude:
28
+ - 'ucum-test.rb'
29
+
30
+ # Offense count: 4
31
+ # This cop supports safe autocorrection (--autocorrect).
32
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
33
+ # SupportedHashRocketStyles: key, separator, table
34
+ # SupportedColonStyles: key, separator, table
35
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
36
+ Layout/HashAlignment:
37
+ Exclude:
38
+ - 'spec/unitsdb/commands/ucum/update_spec.rb'
39
+
40
+ # Offense count: 5
41
+ # This cop supports safe autocorrection (--autocorrect).
42
+ # Configuration parameters: AllowInHeredoc.
43
+ Layout/TrailingWhitespace:
44
+ Exclude:
45
+ - 'lib/unitsdb/commands/ucum/check.rb'
46
+ - 'spec/unitsdb/commands/ucum/update_spec.rb'
47
+
48
+ # Offense count: 1
49
+ # This cop supports unsafe autocorrection (--autocorrect-all).
50
+ # Configuration parameters: AllowSafeAssignment.
51
+ Lint/AssignmentInCondition:
52
+ Exclude:
53
+ - 'lib/unitsdb/commands/ucum/updater.rb'
54
+
55
+ # Offense count: 2
56
+ Lint/ShadowingOuterLocalVariable:
57
+ Exclude:
58
+ - 'lib/unitsdb/commands/search.rb'
59
+ - 'lib/unitsdb/commands/validate/si_references.rb'
60
+
61
+ # Offense count: 47
62
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
63
+ Metrics/AbcSize:
64
+ Max: 169
65
+
66
+ # Offense count: 31
67
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
68
+ # AllowedMethods: refine
69
+ Metrics/BlockLength:
70
+ Max: 173
71
+
72
+ # Offense count: 3
73
+ # Configuration parameters: CountComments, CountAsOne.
74
+ Metrics/ClassLength:
75
+ Max: 442
76
+
77
+ # Offense count: 45
78
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
79
+ Metrics/CyclomaticComplexity:
80
+ Max: 50
81
+
82
+ # Offense count: 58
83
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
84
+ Metrics/MethodLength:
85
+ Max: 169
86
+
87
+ # Offense count: 5
88
+ # Configuration parameters: CountComments, CountAsOne.
89
+ Metrics/ModuleLength:
90
+ Max: 369
91
+
92
+ # Offense count: 2
93
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
94
+ Metrics/ParameterLists:
95
+ Max: 6
96
+
97
+ # Offense count: 39
98
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
99
+ Metrics/PerceivedComplexity:
100
+ Max: 56
101
+
102
+ # Offense count: 1
103
+ Naming/AccessorMethodName:
104
+ Exclude:
105
+ - 'lib/unitsdb/commands/si_formatter.rb'
106
+
107
+ # Offense count: 3
108
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
109
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
110
+ Naming/MethodParameterName:
21
111
  Exclude:
22
- - 'lib/unitsdb/units.rb'
112
+ - 'lib/unitsdb/commands/si_ttl_parser.rb'
113
+ - 'lib/unitsdb/utils.rb'
23
114
 
24
- # Offense count: 19
115
+ # Offense count: 1
116
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
117
+ # NamePrefix: is_, has_, have_, does_
118
+ # ForbiddenPrefixes: is_, has_, have_, does_
119
+ # AllowedMethods: is_a?
120
+ # MethodDefinitionMacros: define_method, define_singleton_method
121
+ Naming/PredicateName:
122
+ Exclude:
123
+ - 'spec/**/*'
124
+ - 'lib/unitsdb/commands/ucum/matcher.rb'
125
+
126
+ # Offense count: 1
127
+ # This cop supports unsafe autocorrection (--autocorrect-all).
128
+ Style/CombinableLoops:
129
+ Exclude:
130
+ - 'lib/unitsdb/commands/si_matcher.rb'
131
+
132
+ # Offense count: 48
25
133
  # Configuration parameters: AllowedConstants.
26
134
  Style/Documentation:
27
135
  Enabled: false
28
136
 
29
137
  # Offense count: 1
30
138
  # This cop supports safe autocorrection (--autocorrect).
31
- # Configuration parameters: EnforcedStyleForMultiline.
32
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
33
- Style/TrailingCommaInHashLiteral:
139
+ # Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
140
+ # SupportedStyles: empty, nil, both
141
+ Style/EmptyElse:
142
+ Exclude:
143
+ - 'lib/unitsdb/commands/ucum/updater.rb'
144
+
145
+ # Offense count: 1
146
+ # This cop supports unsafe autocorrection (--autocorrect-all).
147
+ # Configuration parameters: EnforcedStyle.
148
+ # SupportedStyles: always, always_true, never
149
+ Style/FrozenStringLiteralComment:
150
+ Exclude:
151
+ - '**/*.arb'
152
+ - 'ucum-test.rb'
153
+
154
+ # Offense count: 2
155
+ # This cop supports unsafe autocorrection (--autocorrect-all).
156
+ Style/IdenticalConditionalBranches:
157
+ Exclude:
158
+ - 'lib/unitsdb/commands/si_formatter.rb'
159
+
160
+ # Offense count: 1
161
+ Style/MultilineBlockChain:
162
+ Exclude:
163
+ - 'lib/unitsdb/commands/normalize.rb'
164
+
165
+ # Offense count: 9
166
+ # Configuration parameters: AllowedMethods.
167
+ # AllowedMethods: respond_to_missing?
168
+ Style/OptionalBooleanParameter:
34
169
  Exclude:
35
- - 'lib/unitsdb/units.rb'
170
+ - 'lib/unitsdb/commands/check_si.rb'
171
+ - 'lib/unitsdb/commands/si_updater.rb'
172
+ - 'lib/unitsdb/commands/ucum/check.rb'
173
+ - 'lib/unitsdb/commands/ucum/updater.rb'
174
+
175
+ # Offense count: 7
176
+ # This cop supports unsafe autocorrection (--autocorrect-all).
177
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
178
+ # AllowedMethods: present?, blank?, presence, try, try!
179
+ Style/SafeNavigation:
180
+ Exclude:
181
+ - 'lib/unitsdb/commands/ucum/matcher.rb'
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
data/Gemfile CHANGED
@@ -6,7 +6,8 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  gem "diffy"
9
- gem "rake", "~> 13.0"
10
- gem "rspec", "~> 3.0"
9
+ gem "nokogiri"
10
+ gem "rake"
11
+ gem "rspec"
11
12
  gem "rubocop"
12
13
  gem "rubocop-performance"