unitsdb 2.2.14 → 2.2.15
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/data/units.yaml +7 -1
- data/lib/unitsdb/database/loader.rb +1 -0
- data/lib/unitsdb/database.rb +1 -0
- data/lib/unitsdb/version.rb +2 -2
- data/unitsdb.gemspec +1 -1
- metadata +2 -3
- data/CLAUDE.md +0 -55
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55e391b1db0e3521dcf36db024b126f85b3c6bcc02119aa48ef8ce5bbfb48870
|
|
4
|
+
data.tar.gz: 3d4d7e953cc747bf13221262560e4b154a93b4e316ee6ee8a81c57217f6040da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a3600232a5b3dc822ab6a58f1a9670ff126237c282220ac3d521c1e5a711fcf4e3754bcc3db7aed4324438e8a85c6daeca769a108eff5b75ce897d74a300e24
|
|
7
|
+
data.tar.gz: 213c67af95062fa9cbef20d6663b26a55b3f072e803b3d0d3b15d30c9857d5dc2c68cbcd980edbdd238a5cb0317862e237f02e4ace7559678f0e88ad1684d02c
|
data/data/units.yaml
CHANGED
|
@@ -6692,9 +6692,12 @@ units:
|
|
|
6692
6692
|
root: false
|
|
6693
6693
|
root_units:
|
|
6694
6694
|
- power: 1
|
|
6695
|
+
prefix_reference:
|
|
6696
|
+
type: nist
|
|
6697
|
+
id: NISTp10_2
|
|
6695
6698
|
unit_reference:
|
|
6696
6699
|
type: nist
|
|
6697
|
-
id:
|
|
6700
|
+
id: NISTu201
|
|
6698
6701
|
short: hundredweight
|
|
6699
6702
|
symbols:
|
|
6700
6703
|
- latex: "\\ensuremath{\\mathrm{cwt (US)}}"
|
|
@@ -14494,6 +14497,9 @@ units:
|
|
|
14494
14497
|
root: false
|
|
14495
14498
|
root_units:
|
|
14496
14499
|
- power: 1
|
|
14500
|
+
prefix_reference:
|
|
14501
|
+
type: nist
|
|
14502
|
+
id: NISTp10_3
|
|
14497
14503
|
unit_reference:
|
|
14498
14504
|
type: nist
|
|
14499
14505
|
id: NISTu196
|
|
@@ -23,6 +23,7 @@ module Unitsdb
|
|
|
23
23
|
# participates in all validation like a required file.
|
|
24
24
|
OPTIONAL_DATABASE_FILES = {
|
|
25
25
|
"currencies" => "currencies.yaml",
|
|
26
|
+
"scales" => "scales.yaml",
|
|
26
27
|
}.freeze
|
|
27
28
|
|
|
28
29
|
DATABASE_FILES = REQUIRED_DATABASE_FILES.merge(OPTIONAL_DATABASE_FILES).freeze
|
data/lib/unitsdb/database.rb
CHANGED
|
@@ -21,6 +21,7 @@ module Unitsdb
|
|
|
21
21
|
attribute :dimensions, Dimension, collection: true
|
|
22
22
|
attribute :unit_systems, UnitSystem, collection: true
|
|
23
23
|
attribute :currencies, Currency, collection: true
|
|
24
|
+
attribute :scales, Scale, collection: true
|
|
24
25
|
|
|
25
26
|
# Resolve a collection name (String or Symbol) to its typed Array.
|
|
26
27
|
# Validates against COLLECTIONS so caller-supplied names can never
|
data/lib/unitsdb/version.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Unitsdb
|
|
4
|
-
VERSION = "2.2.
|
|
4
|
+
VERSION = "2.2.15"
|
|
5
5
|
|
|
6
6
|
# The version of the bundled UnitsDB data (from the data/ submodule).
|
|
7
7
|
# This version corresponds to a tag/commit in https://github.com/unitsml/unitsdb.
|
|
8
|
-
UNITS_DATA_VERSION = "2.2.
|
|
8
|
+
UNITS_DATA_VERSION = "2.2.2"
|
|
9
9
|
end
|
data/unitsdb.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
25
25
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
26
26
|
`git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
-
f.match(%r{^(test|spec|features)
|
|
27
|
+
f.match(%r{^(?:(?:test|spec|features)/|(?:AGENTS|CLAUDE)\.md$)})
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
# Include YAML data files in the gem
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unitsdb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fuzzy_match
|
|
@@ -141,7 +141,6 @@ files:
|
|
|
141
141
|
- ".rspec"
|
|
142
142
|
- ".rubocop.yml"
|
|
143
143
|
- ".rubocop_todo.yml"
|
|
144
|
-
- CLAUDE.md
|
|
145
144
|
- CODE_OF_CONDUCT.md
|
|
146
145
|
- Gemfile
|
|
147
146
|
- LICENSE.txt
|
data/CLAUDE.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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.
|