unitsdb 0.1.1 → 2.1.0

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos.json +5 -0
  3. data/.github/workflows/depenedent-gems.yml +16 -0
  4. data/.gitmodules +3 -0
  5. data/.rspec +2 -1
  6. data/.rubocop_todo.yml +88 -12
  7. data/Gemfile +2 -2
  8. data/README.adoc +697 -1
  9. data/exe/unitsdb +7 -0
  10. data/lib/unitsdb/cli.rb +81 -0
  11. data/lib/unitsdb/commands/_modify.rb +22 -0
  12. data/lib/unitsdb/commands/base.rb +52 -0
  13. data/lib/unitsdb/commands/check_si.rb +124 -0
  14. data/lib/unitsdb/commands/get.rb +133 -0
  15. data/lib/unitsdb/commands/normalize.rb +81 -0
  16. data/lib/unitsdb/commands/release.rb +112 -0
  17. data/lib/unitsdb/commands/search.rb +219 -0
  18. data/lib/unitsdb/commands/si_formatter.rb +485 -0
  19. data/lib/unitsdb/commands/si_matcher.rb +470 -0
  20. data/lib/unitsdb/commands/si_ttl_parser.rb +100 -0
  21. data/lib/unitsdb/commands/si_updater.rb +212 -0
  22. data/lib/unitsdb/commands/validate/identifiers.rb +40 -0
  23. data/lib/unitsdb/commands/validate/references.rb +316 -0
  24. data/lib/unitsdb/commands/validate/si_references.rb +115 -0
  25. data/lib/unitsdb/commands/validate.rb +40 -0
  26. data/lib/unitsdb/config.rb +19 -0
  27. data/lib/unitsdb/database.rb +661 -0
  28. data/lib/unitsdb/dimension.rb +19 -25
  29. data/lib/unitsdb/dimension_details.rb +20 -0
  30. data/lib/unitsdb/dimension_reference.rb +8 -0
  31. data/lib/unitsdb/dimensions.rb +3 -6
  32. data/lib/unitsdb/errors.rb +13 -0
  33. data/lib/unitsdb/external_reference.rb +14 -0
  34. data/lib/unitsdb/identifier.rb +8 -0
  35. data/lib/unitsdb/localized_string.rb +17 -0
  36. data/lib/unitsdb/prefix.rb +11 -12
  37. data/lib/unitsdb/prefix_reference.rb +10 -0
  38. data/lib/unitsdb/prefixes.rb +3 -6
  39. data/lib/unitsdb/quantities.rb +3 -27
  40. data/lib/unitsdb/quantity.rb +12 -24
  41. data/lib/unitsdb/quantity_reference.rb +4 -7
  42. data/lib/unitsdb/root_unit_reference.rb +14 -0
  43. data/lib/unitsdb/scale.rb +17 -0
  44. data/lib/unitsdb/scale_properties.rb +12 -0
  45. data/lib/unitsdb/scale_reference.rb +10 -0
  46. data/lib/unitsdb/scales.rb +11 -0
  47. data/lib/unitsdb/si_derived_base.rb +13 -14
  48. data/lib/unitsdb/symbol_presentations.rb +14 -0
  49. data/lib/unitsdb/unit.rb +20 -26
  50. data/lib/unitsdb/unit_reference.rb +5 -8
  51. data/lib/unitsdb/unit_system.rb +8 -10
  52. data/lib/unitsdb/unit_system_reference.rb +10 -0
  53. data/lib/unitsdb/unit_systems.rb +3 -16
  54. data/lib/unitsdb/units.rb +3 -6
  55. data/lib/unitsdb/utils.rb +84 -0
  56. data/lib/unitsdb/version.rb +1 -1
  57. data/lib/unitsdb.rb +13 -10
  58. data/unitsdb.gemspec +6 -1
  59. metadata +112 -12
  60. data/lib/unitsdb/dimension_quantity.rb +0 -28
  61. data/lib/unitsdb/dimension_symbol.rb +0 -22
  62. data/lib/unitsdb/prefix_symbol.rb +0 -12
  63. data/lib/unitsdb/root_unit.rb +0 -17
  64. data/lib/unitsdb/root_units.rb +0 -20
  65. data/lib/unitsdb/symbol.rb +0 -17
  66. data/lib/unitsdb/unit_symbol.rb +0 -15
  67. data/lib/unitsdb/unitsdb.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 520380cf306ea06253c1d4e07b879bfac7b49e69f58514eb9cc5bc19b9c39b86
4
- data.tar.gz: f37a0ad8ac751a634ae851d018b3a3cdcaf8e6f866743bd93f84d5a36b7aba42
3
+ metadata.gz: 4b92f561a56f8cdd59a905cf7827c6ffda47acae64f1e31256f2c5efebfd81f2
4
+ data.tar.gz: 218a47cf5fb2c178f787f05e186c09f5b40d0f4914b81d6de5884759011621ef
5
5
  SHA512:
6
- metadata.gz: d6188d494f447dc5893805555b0e7d0b9ae88e1728770215f98e41c7890b0cd183fcec7818705c4d23705eca895e83c9f8e11a21a95f2b9266baf26c9e0ef9e0
7
- data.tar.gz: b99151aa57387c0b60374a5d6cc657fec74c6f3a7c4d21887a7053910bf45912a578ff75380c9e612960d11f4a4535bcfdb24389fd22816815c654c8fc903ad8
6
+ metadata.gz: 82bd1ac58073379426b3378bda8b94e0bcdf46f954148d082b6008931d0c49c0c50d35b53ac64661a75e0f58bfedf46a5f53e0e948e5520584711a0260ebe638
7
+ data.tar.gz: ff4538f70410cc9572f7a7719bf32aa1324f6e2cdaf7fe95acbd6426b31168b9c4ba72271d81fe8a76dd1339aa0d3d3307424a878b4cb11e96be5af9897078b0
@@ -0,0 +1,5 @@
1
+ {
2
+ "repo": [
3
+ "unitsml/unitsml-ruby"
4
+ ]
5
+ }
@@ -0,0 +1,16 @@
1
+ name: dependent-gems-test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ tags: [ v* ]
7
+ pull_request:
8
+ workflow_dispatch:
9
+ repository_dispatch:
10
+ types: [ release-passed ]
11
+
12
+ jobs:
13
+ rake:
14
+ uses: metanorma/ci/.github/workflows/dependent-rake.yml@main
15
+ with:
16
+ command: bundle exec rspec
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,6 +1,6 @@
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-20 11:22:36 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
@@ -14,22 +14,98 @@ Gemspec/DuplicatedAssignment:
14
14
  - 'unitsdb.gemspec'
15
15
 
16
16
  # Offense count: 2
17
- # This cop supports safe autocorrection (--autocorrect).
18
- # Configuration parameters: EnforcedStyle, IndentationWidth.
19
- # SupportedStyles: special_inside_parentheses, consistent, align_braces
20
- Layout/FirstHashElementIndentation:
17
+ Lint/ShadowingOuterLocalVariable:
18
+ Exclude:
19
+ - 'lib/unitsdb/commands/search.rb'
20
+ - 'lib/unitsdb/commands/validate/si_references.rb'
21
+
22
+ # Offense count: 37
23
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
24
+ Metrics/AbcSize:
25
+ Max: 169
26
+
27
+ # Offense count: 27
28
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
29
+ # AllowedMethods: refine
30
+ Metrics/BlockLength:
31
+ Max: 173
32
+
33
+ # Offense count: 3
34
+ # Configuration parameters: CountComments, CountAsOne.
35
+ Metrics/ClassLength:
36
+ Max: 441
37
+
38
+ # Offense count: 38
39
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
40
+ Metrics/CyclomaticComplexity:
41
+ Max: 50
42
+
43
+ # Offense count: 47
44
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
45
+ Metrics/MethodLength:
46
+ Max: 169
47
+
48
+ # Offense count: 3
49
+ # Configuration parameters: CountComments, CountAsOne.
50
+ Metrics/ModuleLength:
51
+ Max: 369
52
+
53
+ # Offense count: 2
54
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
55
+ Metrics/ParameterLists:
56
+ Max: 6
57
+
58
+ # Offense count: 33
59
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
60
+ Metrics/PerceivedComplexity:
61
+ Max: 56
62
+
63
+ # Offense count: 1
64
+ Naming/AccessorMethodName:
21
65
  Exclude:
22
- - 'lib/unitsdb/units.rb'
66
+ - 'lib/unitsdb/commands/si_formatter.rb'
23
67
 
24
- # Offense count: 19
68
+ # Offense count: 3
69
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
70
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
71
+ Naming/MethodParameterName:
72
+ Exclude:
73
+ - 'lib/unitsdb/commands/si_ttl_parser.rb'
74
+ - 'lib/unitsdb/utils.rb'
75
+
76
+ # Offense count: 1
77
+ # This cop supports unsafe autocorrection (--autocorrect-all).
78
+ Style/CombinableLoops:
79
+ Exclude:
80
+ - 'lib/unitsdb/commands/si_matcher.rb'
81
+
82
+ # Offense count: 40
25
83
  # Configuration parameters: AllowedConstants.
26
84
  Style/Documentation:
27
85
  Enabled: false
28
86
 
87
+ # Offense count: 2
88
+ # This cop supports unsafe autocorrection (--autocorrect-all).
89
+ Style/IdenticalConditionalBranches:
90
+ Exclude:
91
+ - 'lib/unitsdb/commands/si_formatter.rb'
92
+
29
93
  # Offense count: 1
30
- # This cop supports safe autocorrection (--autocorrect).
31
- # Configuration parameters: EnforcedStyleForMultiline.
32
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
33
- Style/TrailingCommaInHashLiteral:
94
+ Style/MultilineBlockChain:
95
+ Exclude:
96
+ - 'lib/unitsdb/commands/normalize.rb'
97
+
98
+ # Offense count: 5
99
+ # Configuration parameters: AllowedMethods.
100
+ # AllowedMethods: respond_to_missing?
101
+ Style/OptionalBooleanParameter:
34
102
  Exclude:
35
- - 'lib/unitsdb/units.rb'
103
+ - 'lib/unitsdb/commands/check_si.rb'
104
+ - 'lib/unitsdb/commands/si_updater.rb'
105
+
106
+ # Offense count: 6
107
+ # This cop supports safe autocorrection (--autocorrect).
108
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
109
+ # URISchemes: http, https
110
+ Layout/LineLength:
111
+ Max: 140
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ 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 "rake"
10
+ gem "rspec"
11
11
  gem "rubocop"
12
12
  gem "rubocop-performance"