uddf 0.1.0 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c183d9405ff7a1e3b9b30b07f1d212fee2e28c65f5142e5c9d9fccc68e76955
4
- data.tar.gz: bfc297bf0f18ae7b014570390ca6947bb5f3dd0a2e60f19753c518927934bb19
3
+ metadata.gz: 2940685ef35816892c65ed029b230a73674018fa36801b53b4923d36da744c61
4
+ data.tar.gz: b750a7bd240203df8aa939d73405c6fa003cc4f857612074edf0b6e84d5b1e63
5
5
  SHA512:
6
- metadata.gz: db3181cbe9e0e08a94648d614f953c5b444ad0f1da5c0705f532d642126077076fb2940e14944b9c82291dd35a9ad6fdf7cdf4ffbf788e2a4a4d2f5c90ef3c4f
7
- data.tar.gz: 89376df069f290d30e767437a7b176e7905d092f7d57a6a8f66451a27ffcae7962d112532f4085b06f3ef14377423df90cb9e47d399039cef07f88f1b4e22551
6
+ metadata.gz: b9afdce2237a0fb1c4ac923b6ef881a936f7d352f2f18f8d603b32b76a112fadfcf0a7ba8ce33023ea1d4144bc78446fdee4e1ba4a02fa9b3c39bb9bbe20138e
7
+ data.tar.gz: cfc3637fdb8cb46dba294f36328c3952494ddf26c21558ada177accc57239f5b630424c4e1d6352bb3b91f086e468de11f26d9990f6bdf41763b647101d7b001
@@ -1,16 +1,16 @@
1
1
  name: Ruby
2
2
 
3
- on: [push,pull_request]
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v2
10
- - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
- with:
13
- ruby-version: 3.0.0
14
- bundler-cache: true
15
- - name: Run the default task
16
- run: bundle exec rake
9
+ - uses: actions/checkout@v5
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.4
14
+ bundler-cache: true
15
+ - name: Run the default task
16
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,6 +1,12 @@
1
+ plugins: rubocop-rake
2
+
1
3
  AllCops:
4
+ NewCops: enable
2
5
  TargetRubyVersion: 2.4
3
6
 
7
+ Gemspec/DevelopmentDependencies:
8
+ EnforcedStyle: gemspec
9
+
4
10
  Style/StringLiterals:
5
11
  Enabled: true
6
12
  EnforcedStyle: double_quotes
@@ -11,3 +17,12 @@ Style/StringLiteralsInInterpolation:
11
17
 
12
18
  Layout/LineLength:
13
19
  Max: 120
20
+
21
+ Metrics/ModuleLength:
22
+ Enabled: false
23
+
24
+ Style/Documentation:
25
+ Exclude:
26
+ - "spec/**/*"
27
+ - "test/**/*"
28
+ - "lib/uddf/v323/models.rb"
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.4
data/Gemfile CHANGED
@@ -2,9 +2,4 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in uddf.gemspec
6
5
  gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rubocop", "~> 1.7"
data/Gemfile.lock ADDED
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uddf (0.2.0)
5
+ nokogiri (~> 1.18)
6
+ nokogiri-happymapper
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.3)
12
+ cgi (0.5.0)
13
+ date (3.4.1)
14
+ erb (4.0.4)
15
+ cgi (>= 0.3.3)
16
+ io-console (0.8.1)
17
+ irb (1.15.2)
18
+ pp (>= 0.6.0)
19
+ rdoc (>= 4.0.0)
20
+ reline (>= 0.4.2)
21
+ json (2.13.2)
22
+ language_server-protocol (3.17.0.5)
23
+ lint_roller (1.1.0)
24
+ nokogiri (1.18.9-arm64-darwin)
25
+ racc (~> 1.4)
26
+ nokogiri (1.18.9-x86_64-linux-gnu)
27
+ racc (~> 1.4)
28
+ nokogiri-happymapper (0.10.0)
29
+ nokogiri (~> 1.5)
30
+ parallel (1.27.0)
31
+ parser (3.3.9.0)
32
+ ast (~> 2.4.1)
33
+ racc
34
+ pp (0.6.2)
35
+ prettyprint
36
+ prettyprint (0.2.0)
37
+ prism (1.4.0)
38
+ psych (5.2.6)
39
+ date
40
+ stringio
41
+ racc (1.8.1)
42
+ rainbow (3.1.1)
43
+ rake (13.3.0)
44
+ rdoc (6.14.2)
45
+ erb
46
+ psych (>= 4.0.0)
47
+ regexp_parser (2.11.2)
48
+ reline (0.6.2)
49
+ io-console (~> 0.5)
50
+ rubocop (1.80.0)
51
+ json (~> 2.3)
52
+ language_server-protocol (~> 3.17.0.2)
53
+ lint_roller (~> 1.1.0)
54
+ parallel (~> 1.10)
55
+ parser (>= 3.3.0.2)
56
+ rainbow (>= 2.2.2, < 4.0)
57
+ regexp_parser (>= 2.9.3, < 3.0)
58
+ rubocop-ast (>= 1.46.0, < 2.0)
59
+ ruby-progressbar (~> 1.7)
60
+ unicode-display_width (>= 2.4.0, < 4.0)
61
+ rubocop-ast (1.46.0)
62
+ parser (>= 3.3.7.2)
63
+ prism (~> 1.4)
64
+ rubocop-rake (0.7.1)
65
+ lint_roller (~> 1.1)
66
+ rubocop (>= 1.72.1)
67
+ ruby-progressbar (1.13.0)
68
+ stringio (3.1.7)
69
+ unicode-display_width (3.1.5)
70
+ unicode-emoji (~> 4.0, >= 4.0.4)
71
+ unicode-emoji (4.0.4)
72
+
73
+ PLATFORMS
74
+ arm64-darwin-24
75
+ x86_64-linux
76
+
77
+ DEPENDENCIES
78
+ irb
79
+ rake (~> 13.0)
80
+ rubocop (~> 1.7)
81
+ rubocop-rake (~> 0.7)
82
+ uddf!
83
+
84
+ BUNDLED WITH
85
+ 2.7.1
data/README.md CHANGED
@@ -1,35 +1,72 @@
1
- # Uddf
1
+ [![Gem Version](https://badge.fury.io/rb/uddf.svg)](https://badge.fury.io/rb/uddf)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/uddf`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ # UDDF
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Ruby parser and validator for Universal Dive Data Format (UDDF) files. Supports multiple UDDF versions with version-specific model loading.
6
6
 
7
- ## Installation
7
+ ## Features
8
+
9
+ - Parse UDDF XML files into Ruby objects using HappyMapper
10
+ - Automatic version detection from UDDF files
11
+ - Version-specific model loading
12
+ - XML schema validation
13
+ - Extensible architecture for multiple UDDF versions
14
+
15
+ ### Supported Versions
16
+
17
+ | UDDF Version | Parser | Validator |
18
+ |--------------|--------|-----------|
19
+ | 3.0.0 | ✗ | ✓ |
20
+ | 3.0.1 | ✗ | ✓ |
21
+ | 3.1.0 | ✗ | ✓ |
22
+ | 3.2.0 | ✗ | ✓ |
23
+ | 3.2.1 | ✗ | ✓ |
24
+ | 3.2.2 | ✗ | ✓ |
25
+ | 3.2.3 | ✓ | ✓ |
26
+ | 3.3.0 | ✗ | ✓ |
27
+ | 3.3.1 | ✗ | ✓ |
8
28
 
9
- Add this line to your application's Gemfile:
29
+ > **Note**: The UDDF 3.3.0 and 3.3.1 schema files included in this gem have been locally modified to fix XML Schema validation errors that prevented them from loading with Nokogiri. These fixes address syntax issues in the original schemas but may not represent the upstream maintainers' intentions. The modifications ensure compatibility with standard XML Schema validators while preserving the core schema structure and validation rules.
30
+
31
+ ## Usage
10
32
 
11
33
  ```ruby
12
- gem 'uddf'
13
- ```
34
+ require 'uddf'
14
35
 
15
- And then execute:
36
+ # Load and parse a UDDF file (auto-detects version)
37
+ dive_data = UDDF.load('path/to/dive.uddf')
16
38
 
17
- $ bundle install
39
+ # Parse UDDF XML string directly
40
+ dive_data = UDDF.parse(xml_string)
18
41
 
19
- Or install it yourself as:
42
+ # Force a specific version (bypasses auto-detection)
43
+ dive_data = UDDF.load('path/to/dive.uddf', force_version: '3.2.3')
44
+ dive_data = UDDF.parse(xml_string, force_version: '3.2.3')
20
45
 
21
- $ gem install uddf
46
+ # Validate UDDF XML against schema
47
+ errors = UDDF.validate(xml_string)
48
+ errors = UDDF.validate(xml_string, force_version: '3.2.3')
22
49
 
23
- ## Usage
50
+ # Access parsed data
51
+ puts dive_data.generator.name
52
+ dive_data.profile_data.repetition_groups.each do |group|
53
+ group.dives.each do |dive|
54
+ puts "Depth: #{dive.information_after_dive&.greatest_depth}m"
55
+ end
56
+ end
57
+ ```
24
58
 
25
- TODO: Write usage instructions here
59
+ ## Installation
26
60
 
27
- ## Development
61
+ ```ruby
62
+ gem 'uddf'
63
+ ```
28
64
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
65
+ ## Architecture
30
66
 
31
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
67
+ The gem uses a modular architecture with version-specific models:
32
68
 
33
- ## Contributing
69
+ - `UDDF::Models::Base` - Shared base models across versions
70
+ - `UDDF::Models::V323` - UDDF 3.2.3 specific models
71
+ - Automatic model loading based on file version attribute
34
72
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/uddf.