revix 0.1.2 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87b01a288660fafa362821adc5398cc03106ee405f7b498bc0a710743f20a391
4
- data.tar.gz: 6edb6c0f3bf9fb5eb14226d618e304bc7947fa014e195a7831a689453bab188a
3
+ metadata.gz: ce81cd0a055d46f3aea30d283dc46a2fabadf34ad24e646f93836afb060a488e
4
+ data.tar.gz: 2b12dad49a3ecc0cfb5fd46448da9acf7a4a73373ee81eb3c301ef5d8df6e536
5
5
  SHA512:
6
- metadata.gz: 4711bbaa8a09eb2dbfbf2e3b8c035be1d6747deb95717251aea9db5de944c1e103ec027fef4b7274b86fb59b5522304024ecfb25a2501e0dead175f352249177
7
- data.tar.gz: 8559da1d577a9f52ed83b411467336c4e46359df8f47b74c4bb1a10a6b2c456b56c0cfb44cf678d02220c4776d38810fc88f7954d88d142d657dcf2a0be10856
6
+ metadata.gz: c84f99c5882f210673c8d3dbcaf6b33f5a3967e030324814d7505b30acdb1957717eb41f5dcea7c31c93a497770f8fd9e55496f39896b1141c44901df50b1114
7
+ data.tar.gz: fbbf942c3fac7d3300ad1761e344eae1b9e12603ffbd86876782efcf299adaae2d794ec8cc1b345cff6a7b5cdfb0b5647605bbb59ab9b41eab8c23f3592dce25
@@ -2,6 +2,11 @@
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:
@@ -22,4 +27,3 @@ jobs:
22
27
  secrets:
23
28
  rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
24
29
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
25
-
data/.rubocop.yml ADDED
@@ -0,0 +1,19 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ - .rubocop_todo.yml
6
+
7
+ inherit_mode:
8
+ merge:
9
+ - Exclude
10
+
11
+ # local repo-specific modifications
12
+ # ...
13
+ plugins:
14
+ - rubocop-rspec
15
+ - rubocop-performance
16
+ - rubocop-rake
17
+
18
+ AllCops:
19
+ TargetRubyVersion: 3.0
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,183 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-03-24 03:56:08 UTC using RuboCop version 1.86.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 9
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
+ Bundler/OrderedGems:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ Gemspec/RequireMFA:
19
+ Exclude:
20
+ - 'revix.gemspec'
21
+
22
+ # Offense count: 1
23
+ Gemspec/RequiredRubyVersion:
24
+ Exclude:
25
+ - 'revix.gemspec'
26
+
27
+ # Offense count: 2
28
+ # This cop supports safe autocorrection (--autocorrect).
29
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
30
+ # SupportedStyles: with_first_argument, with_fixed_indentation
31
+ Layout/ArgumentAlignment:
32
+ Exclude:
33
+ - 'spec/models/revision_spec.rb'
34
+
35
+ # Offense count: 2
36
+ # This cop supports safe autocorrection (--autocorrect).
37
+ # Configuration parameters: EnforcedStyleAlignWith.
38
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
39
+ Layout/BlockAlignment:
40
+ Exclude:
41
+ - 'spec/models/revision_history_spec.rb'
42
+
43
+ # Offense count: 2
44
+ # This cop supports safe autocorrection (--autocorrect).
45
+ Layout/BlockEndNewline:
46
+ Exclude:
47
+ - 'spec/models/revision_history_spec.rb'
48
+
49
+ # Offense count: 2
50
+ # This cop supports safe autocorrection (--autocorrect).
51
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
52
+ # SupportedHashRocketStyles: key, separator, table
53
+ # SupportedColonStyles: key, separator, table
54
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
55
+ Layout/HashAlignment:
56
+ Exclude:
57
+ - 'spec/models/revision_spec.rb'
58
+
59
+ # Offense count: 1
60
+ # This cop supports safe autocorrection (--autocorrect).
61
+ # Configuration parameters: EnforcedStyle.
62
+ # SupportedStyles: normal, indented_internal_methods
63
+ Layout/IndentationConsistency:
64
+ Exclude:
65
+ - 'revix.gemspec'
66
+
67
+ # Offense count: 4
68
+ # This cop supports safe autocorrection (--autocorrect).
69
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
70
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
71
+ Layout/IndentationWidth:
72
+ Exclude:
73
+ - 'spec/models/revision_history_spec.rb'
74
+
75
+ # Offense count: 7
76
+ # This cop supports safe autocorrection (--autocorrect).
77
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
78
+ # URISchemes: http, https
79
+ Layout/LineLength:
80
+ Exclude:
81
+ - 'spec/models/amendment_spec.rb'
82
+ - 'spec/models/revision_history_spec.rb'
83
+ - 'spec/models/revision_spec.rb'
84
+
85
+ # Offense count: 1
86
+ # This cop supports safe autocorrection (--autocorrect).
87
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
88
+ # SupportedStyles: aligned, indented, indented_relative_to_receiver
89
+ Layout/MultilineMethodCallIndentation:
90
+ Exclude:
91
+ - 'revix.gemspec'
92
+
93
+ # Offense count: 1
94
+ # This cop supports safe autocorrection (--autocorrect).
95
+ # Configuration parameters: EnforcedStyle.
96
+ # SupportedStyles: final_newline, final_blank_line
97
+ Layout/TrailingEmptyLines:
98
+ Exclude:
99
+ - 'spec/revix_spec.rb'
100
+
101
+ # Offense count: 1
102
+ # This cop supports safe autocorrection (--autocorrect).
103
+ # Configuration parameters: AllowInHeredoc.
104
+ Layout/TrailingWhitespace:
105
+ Exclude:
106
+ - 'spec/models/revision_spec.rb'
107
+
108
+ # Offense count: 19
109
+ # This cop supports unsafe autocorrection (--autocorrect-all).
110
+ # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
111
+ # SupportedStyles: described_class, explicit
112
+ RSpec/DescribedClass:
113
+ Exclude:
114
+ - 'spec/models/amendment_spec.rb'
115
+ - 'spec/models/revision_history_spec.rb'
116
+ - 'spec/models/revision_spec.rb'
117
+
118
+ # Offense count: 1
119
+ # This cop supports unsafe autocorrection (--autocorrect-all).
120
+ RSpec/EmptyExampleGroup:
121
+ Exclude:
122
+ - 'spec/revix_spec.rb'
123
+
124
+ # Offense count: 4
125
+ # Configuration parameters: CountAsOne.
126
+ RSpec/ExampleLength:
127
+ Max: 14
128
+
129
+ # Offense count: 1
130
+ RSpec/LeakyLocalVariable:
131
+ Exclude:
132
+ - 'spec/models/revision_history_spec.rb'
133
+
134
+ # Offense count: 9
135
+ RSpec/MultipleExpectations:
136
+ Max: 12
137
+
138
+ # Offense count: 3
139
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
140
+ # SupportedInflectors: default, active_support
141
+ RSpec/SpecFilePathFormat:
142
+ Exclude:
143
+ - 'spec/models/amendment_spec.rb'
144
+ - 'spec/models/revision_history_spec.rb'
145
+ - 'spec/models/revision_spec.rb'
146
+
147
+ # Offense count: 3
148
+ # This cop supports safe autocorrection (--autocorrect).
149
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
150
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
151
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
152
+ # FunctionalMethods: let, let!, subject, watch
153
+ # AllowedMethods: lambda, proc, it
154
+ Style/BlockDelimiters:
155
+ Exclude:
156
+ - 'spec/models/revision_history_spec.rb'
157
+
158
+ # Offense count: 36
159
+ # This cop supports safe autocorrection (--autocorrect).
160
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
161
+ # SupportedStyles: single_quotes, double_quotes
162
+ Style/StringLiterals:
163
+ Exclude:
164
+ - 'revix.gemspec'
165
+ - 'spec/models/amendment_spec.rb'
166
+
167
+ # Offense count: 2
168
+ # This cop supports safe autocorrection (--autocorrect).
169
+ # Configuration parameters: EnforcedStyleForMultiline.
170
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
171
+ Style/TrailingCommaInArguments:
172
+ Exclude:
173
+ - 'spec/models/amendment_spec.rb'
174
+ - 'spec/models/revision_spec.rb'
175
+
176
+ # Offense count: 3
177
+ # This cop supports safe autocorrection (--autocorrect).
178
+ # Configuration parameters: EnforcedStyleForMultiline.
179
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
180
+ Style/TrailingCommaInArrayLiteral:
181
+ Exclude:
182
+ - 'spec/models/amendment_spec.rb'
183
+ - 'spec/models/revision_spec.rb'
data/Gemfile CHANGED
@@ -5,9 +5,11 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in revix.gemspec
6
6
  gemspec
7
7
 
8
- gem "nokogiri"
8
+ gem "canon"
9
+ gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
9
10
  gem "rake"
10
11
  gem "rspec"
11
12
  gem "rubocop"
12
- gem "xml-c14n"
13
- gem "lutaml-model", github: "lutaml/lutaml-model"
13
+ gem "rubocop-performance"
14
+ gem "rubocop-rake"
15
+ gem "rubocop-rspec"
@@ -10,7 +10,7 @@ module Revix
10
10
  attribute :change, :string, default: -> { "modify" }
11
11
 
12
12
  xml do
13
- root "amend"
13
+ element "amend"
14
14
  map_element "description", to: :description
15
15
  map_element "location", to: :location
16
16
  map_element "classification", to: :classification
@@ -8,7 +8,7 @@ module Revix
8
8
  attribute :value, :string
9
9
 
10
10
  xml do
11
- root "classification"
11
+ element "classification"
12
12
  map_element "tag", to: :tag
13
13
  map_element "value", to: :value
14
14
  end
@@ -8,7 +8,7 @@ module Revix
8
8
  attribute :organization, Organization
9
9
 
10
10
  xml do
11
- root "contributor"
11
+ element "contributor"
12
12
  map_element "person", to: :person
13
13
  map_element "organization", to: :organization
14
14
  end
@@ -8,7 +8,7 @@ module Revix
8
8
  attribute :value, :string
9
9
 
10
10
  xml do
11
- root "date"
11
+ element "date"
12
12
  map_element "type", to: :type
13
13
  map_element "value", to: :value
14
14
  end
@@ -13,7 +13,7 @@ module Revix
13
13
  attribute :type, :string, values: VALID_TYPES
14
14
 
15
15
  xml do
16
- root "location"
16
+ element "location"
17
17
  map_content to: :value, value_map: { to: { nil: :empty } }
18
18
  map_attribute "type", to: :type
19
19
  end
data/lib/revix/name.rb CHANGED
@@ -8,7 +8,7 @@ module Revix
8
8
  attribute :completename, :string
9
9
 
10
10
  xml do
11
- root "name"
11
+ element "name"
12
12
  map_element "abbreviation", to: :abbreviation
13
13
  map_element "completename", to: :completename
14
14
  end
@@ -9,7 +9,7 @@ module Revix
9
9
  attribute :abbreviation, :string
10
10
 
11
11
  xml do
12
- root "organization"
12
+ element "organization"
13
13
  map_element "name", to: :name
14
14
  map_element "subdivision", to: :subdivision
15
15
  map_element "abbreviation", to: :abbreviation
data/lib/revix/person.rb CHANGED
@@ -7,7 +7,7 @@ module Revix
7
7
  attribute :name, Name
8
8
 
9
9
  xml do
10
- root "person"
10
+ element "person"
11
11
  map_element "name", to: :name
12
12
  end
13
13
 
@@ -11,7 +11,7 @@ module Revix
11
11
  attribute :relation_type, Amendment, collection: true
12
12
 
13
13
  xml do
14
- root "revision"
14
+ element "revision"
15
15
  map_element "date", to: :date
16
16
  map_element "edition", to: :edition
17
17
  map_element "contributor", to: :contributor
@@ -7,7 +7,7 @@ module Revix
7
7
  attribute :revisions, Revix::Revision, collection: true
8
8
 
9
9
  xml do
10
- root "revision-history"
10
+ element "revision-history"
11
11
  map_element "revision", to: :revisions
12
12
  end
13
13
 
data/lib/revix/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Revix
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/revix.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "revix/version"
4
+ require "nokogiri"
4
5
  require "lutaml/model"
5
6
 
6
7
  module Revix
@@ -17,13 +18,3 @@ require_relative "revix/location"
17
18
  require_relative "revix/amendment"
18
19
  require_relative "revix/revision"
19
20
  require_relative "revix/revision_history"
20
-
21
- require "lutaml/model/xml_adapter/nokogiri_adapter"
22
- require "lutaml/model/json_adapter/standard_json_adapter"
23
- require "lutaml/model/yaml_adapter/standard_yaml_adapter"
24
-
25
- Lutaml::Model::Config.configure do |config|
26
- config.xml_adapter = Lutaml::Model::XmlAdapter::NokogiriAdapter
27
- config.yaml_adapter = Lutaml::Model::YamlAdapter::StandardYamlAdapter
28
- config.json_adapter = Lutaml::Model::JsonAdapter::StandardJsonAdapter
29
- end
data/revix.gemspec CHANGED
@@ -20,14 +20,16 @@ Gem::Specification.new do |spec|
20
20
  spec.metadata["homepage_uri"] = spec.homepage
21
21
  spec.metadata["source_code_uri"] = spec.homepage
22
22
  spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
23
+ spec.metadata["rubygems_mfa_required"] = "true"
23
24
 
24
25
  # Specify which files should be added to the gem when it is released.
25
26
  spec.files = all_files_in_git
26
- .reject { |f| f.match(%r{\A(?:test|features|bin|\.)/}) }
27
+ .reject { |f| f.match(%r{\A(?:test|features|bin|\.)/}) }
27
28
 
28
29
  spec.bindir = "exe"
29
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
31
  spec.require_paths = ["lib"]
31
32
 
32
- spec.add_dependency "lutaml-model", "~> 0.7"
33
+ spec.add_dependency "lutaml-model", "~> 0.8.0"
34
+ spec.add_dependency "nokogiri"
33
35
  end
@@ -1,91 +1,87 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  RSpec.describe Revix::Amendment do
6
6
  let(:simple_amendment_data) do
7
- Revix::Amendment.new(description: 'Approved edition of S-102')
7
+ described_class.new(description: "Approved edition of S-102")
8
8
  end
9
9
 
10
10
  let(:complex_amendment_data) do
11
11
  locations = [
12
- Revix::Location.new(type: 'clause', value: '4.0'),
13
- Revix::Location.new(type: 'clause', value: '12.0'),
14
- Revix::Location.new(type: 'clause', value: '9.0'),
15
- Revix::Location.new(type: 'whole', value: nil)
12
+ Revix::Location.new(type: "clause", value: "4.0"),
13
+ Revix::Location.new(type: "clause", value: "12.0"),
14
+ Revix::Location.new(type: "clause", value: "9.0"),
15
+ Revix::Location.new(type: "whole", value: nil),
16
16
  ]
17
17
 
18
18
  classifications = [
19
- Revix::Classification.new(tag: 'severity', value: 'major'),
20
- Revix::Classification.new(tag: 'type', value: 'editorial')
19
+ Revix::Classification.new(tag: "severity", value: "major"),
20
+ Revix::Classification.new(tag: "type", value: "editorial"),
21
21
  ]
22
22
 
23
- Revix::Amendment.new(
23
+ described_class.new(
24
24
  description: "Updated clause 4.0 and 12.0.\n\nPopulated clause 9.0.",
25
25
  location: locations,
26
26
  classification: classifications,
27
- change: 'modify'
27
+ change: "modify",
28
28
  )
29
29
  end
30
30
 
31
- describe '.new' do
32
- it 'creates a simple Amendment object' do
31
+ describe ".new" do
32
+ it "creates a simple Amendment object" do
33
33
  amendment = simple_amendment_data
34
- expect(amendment).to be_a(Revix::Amendment)
35
- expect(amendment.description).to eq('Approved edition of S-102')
34
+ expect(amendment).to be_a(described_class)
35
+ expect(amendment.description).to eq("Approved edition of S-102")
36
36
  expect(amendment.location).to be_nil
37
37
  expect(amendment.classification).to be_nil
38
- expect(amendment.change).to eq('modify') # Default value
38
+ expect(amendment.change).to eq("modify") # Default value
39
39
  end
40
40
 
41
- it 'creates a complex Amendment object' do
41
+ it "creates a complex Amendment object" do
42
42
  amendment = complex_amendment_data
43
- expect(amendment).to be_a(Revix::Amendment)
43
+ expect(amendment).to be_a(described_class)
44
44
  expect(amendment.description).to eq("Updated clause 4.0 and 12.0.\n\nPopulated clause 9.0.")
45
45
  expect(amendment.location.size).to eq(4)
46
- expect(amendment.location.first.type).to eq('clause')
47
- expect(amendment.location.first.value).to eq('4.0')
48
- expect(amendment.location.last.type).to eq('whole')
46
+ expect(amendment.location.first.type).to eq("clause")
47
+ expect(amendment.location.first.value).to eq("4.0")
48
+ expect(amendment.location.last.type).to eq("whole")
49
49
  expect(amendment.location.last.value).to be_nil
50
50
  expect(amendment.classification.size).to eq(2)
51
- expect(amendment.classification.first.tag).to eq('severity')
52
- expect(amendment.classification.first.value).to eq('major')
53
- expect(amendment.change).to eq('modify')
51
+ expect(amendment.classification.first.tag).to eq("severity")
52
+ expect(amendment.classification.first.value).to eq("major")
53
+ expect(amendment.change).to eq("modify")
54
54
  end
55
55
  end
56
56
 
57
- describe '#to_xml' do
58
- it 'converts a complex Amendment object to XML' do
57
+ describe "#to_xml" do
58
+ it "converts a complex Amendment object to XML" do
59
59
  amendment = complex_amendment_data
60
60
  xml = amendment.to_xml
61
61
  expect(xml).to be_a(String)
62
- expect(xml).to include('<amend>')
62
+ expect(xml).to include("<amend>")
63
63
  expect(xml).to include("<description>Updated clause 4.0 and 12.0.\n\nPopulated clause 9.0.</description>")
64
64
  expect(xml).to include('<location type="clause">4.0</location>')
65
65
  expect(xml).to include('<location type="clause">12.0</location>')
66
66
  expect(xml).to include('<location type="clause">9.0</location>')
67
- expect(xml).to include('<location type="whole"></location>')
68
- expect(xml).to include('<tag>severity</tag>')
69
- expect(xml).to include('<value>major</value>')
70
- expect(xml).to include('<tag>type</tag>')
71
- expect(xml).to include('<value>editorial</value>')
72
- expect(xml).to include('<change>modify</change>')
67
+ expect(xml).to include('<location type="whole"/>')
68
+ expect(xml).to include("<tag>severity</tag>")
69
+ expect(xml).to include("<value>major</value>")
70
+ expect(xml).to include("<tag>type</tag>")
71
+ expect(xml).to include("<value>editorial</value>")
72
+ expect(xml).to include("<change>modify</change>")
73
73
  end
74
74
 
75
- it 'performs round-trip conversion from XML to object and back' do
75
+ it "performs round-trip conversion from XML to object and back" do
76
76
  original = complex_amendment_data
77
77
  xml1 = original.to_xml
78
78
 
79
79
  # Parse back to object and generate XML again
80
- parsed = Revix::Amendment.from_xml(xml1)
80
+ parsed = described_class.from_xml(xml1)
81
81
  xml2 = parsed.to_xml
82
82
 
83
- # Canonicalize both XMLs and compare using xml-c14n
84
- c14n1 = Xml::C14n.format(xml1)
85
- c14n2 = Xml::C14n.format(xml2)
86
-
87
- expect(c14n2).to eq(c14n1)
88
- expect(c14n2).to be_analogous_with(c14n1)
83
+ # Compare the original and generated XML
84
+ expect(xml2).to be_xml_equivalent_to(xml1)
89
85
  end
90
86
  end
91
87
  end
@@ -6,40 +6,44 @@ RSpec.describe Revix::RevisionHistory do
6
6
  fixture_path = File.join(__dir__, "..", "fixtures")
7
7
  let(:yaml_content) { File.read(File.join(fixture_path, "sample.yaml")) }
8
8
  let(:xml_content) { File.read(File.join(fixture_path, "sample.xml")) }
9
- let(:iho_yaml_content) { File.read(File.join(fixture_path, "iho_sample.yaml")) }
10
- let(:ogc_yaml_content) { File.read(File.join(fixture_path, "ogc_sample.yaml")) }
9
+ let(:iho_yaml_content) do
10
+ File.read(File.join(fixture_path, "iho_sample.yaml"))
11
+ end
12
+ let(:ogc_yaml_content) do
13
+ File.read(File.join(fixture_path, "ogc_sample.yaml"))
14
+ end
11
15
 
12
16
  describe ".from_yaml" do
13
17
  it "parses YAML content into a RevisionHistory object" do
14
- history = Revix::RevisionHistory.from_yaml(yaml_content)
15
- expect(history).to be_a(Revix::RevisionHistory)
18
+ history = described_class.from_yaml(yaml_content)
19
+ expect(history).to be_a(described_class)
16
20
  expect(history.revisions.size).to eq(2)
17
21
  end
18
22
 
19
23
  it "parses IHO YAML content into a RevisionHistory object" do
20
- history = Revix::RevisionHistory.from_yaml(iho_yaml_content)
21
- expect(history).to be_a(Revix::RevisionHistory)
24
+ history = described_class.from_yaml(iho_yaml_content)
25
+ expect(history).to be_a(described_class)
22
26
  expect(history.revisions.size).to eq(4)
23
27
  end
24
28
 
25
29
  it "parses OGC YAML content into a RevisionHistory object" do
26
- history = Revix::RevisionHistory.from_yaml(ogc_yaml_content)
27
- expect(history).to be_a(Revix::RevisionHistory)
30
+ history = described_class.from_yaml(ogc_yaml_content)
31
+ expect(history).to be_a(described_class)
28
32
  expect(history.revisions.size).to eq(2)
29
33
  end
30
34
  end
31
35
 
32
36
  describe ".from_xml" do
33
37
  it "parses XML content into a RevisionHistory object" do
34
- history = Revix::RevisionHistory.from_xml(xml_content)
35
- expect(history).to be_a(Revix::RevisionHistory)
38
+ history = described_class.from_xml(xml_content)
39
+ expect(history).to be_a(described_class)
36
40
  expect(history.revisions.size).to eq(2)
37
41
  end
38
42
  end
39
43
 
40
44
  describe "#to_yaml" do
41
45
  it "converts a RevisionHistory object to YAML" do
42
- history = Revix::RevisionHistory.from_yaml(yaml_content)
46
+ history = described_class.from_yaml(yaml_content)
43
47
  yaml = history.to_yaml
44
48
  expect(yaml).to be_a(String)
45
49
  end
@@ -47,7 +51,7 @@ RSpec.describe Revix::RevisionHistory do
47
51
 
48
52
  describe "#to_xml" do
49
53
  it "converts a RevisionHistory object to XML" do
50
- history = Revix::RevisionHistory.from_yaml(yaml_content)
54
+ history = described_class.from_yaml(yaml_content)
51
55
  xml = history.to_xml
52
56
  expect(xml).to be_a(String)
53
57
  expect(xml).to include("<revision-history>")
@@ -59,17 +63,13 @@ RSpec.describe Revix::RevisionHistory do
59
63
  original_xml = xml_content
60
64
 
61
65
  # Parse to object
62
- history = Revix::RevisionHistory.from_xml(original_xml)
66
+ history = described_class.from_xml(original_xml)
63
67
 
64
68
  # Convert back to XML
65
69
  generated_xml = history.to_xml
66
70
 
67
- # Canonicalize both XMLs and compare using xml-c14n
68
- c14n_original = Xml::C14n.format(original_xml)
69
- c14n_generated = Xml::C14n.format(generated_xml)
70
-
71
- expect(c14n_generated).to eq(c14n_original)
72
- expect(c14n_generated).to be_analogous_with(c14n_original)
71
+ # Compare the original and generated XML
72
+ expect(generated_xml).to be_xml_equivalent_to(original_xml)
73
73
  end
74
74
  end
75
75
  end
@@ -5,25 +5,26 @@ require "spec_helper"
5
5
  RSpec.describe Revix::Revision do
6
6
  let(:revision_data) do
7
7
  date = [
8
- Revix::DateInfo.new(type: "published", value: "2012-04")
8
+ Revix::DateInfo.new(type: "published", value: "2012-04"),
9
9
  ]
10
- name = Revix::Name.new(abbreviation: "JMS", completename: "J. Michael Straczynski")
10
+ name = Revix::Name.new(abbreviation: "JMS",
11
+ completename: "J. Michael Straczynski")
11
12
  person = Revix::Person.new(name: name)
12
13
  contributor = Revix::Contributor.new(person: person)
13
14
  amendment = Revix::Amendment.new(description: "Approved edition of S-102")
14
15
 
15
- Revix::Revision.new(
16
+ described_class.new(
16
17
  date: date,
17
18
  edition: "1.0.0",
18
19
  contributor: [contributor],
19
- amend: [amendment]
20
+ amend: [amendment],
20
21
  )
21
22
  end
22
23
 
23
24
  describe ".new" do
24
25
  it "creates a new Revision object" do
25
26
  revision = revision_data
26
- expect(revision).to be_a(Revix::Revision)
27
+ expect(revision).to be_a(described_class)
27
28
  expect(revision.edition).to eq("1.0.0")
28
29
  expect(revision.date.size).to eq(1)
29
30
  expect(revision.date.first.type).to eq("published")
@@ -43,15 +44,11 @@ RSpec.describe Revix::Revision do
43
44
  xml1 = original.to_xml
44
45
 
45
46
  # Parse back to object and generate XML again
46
- parsed = Revix::Revision.from_xml(xml1)
47
+ parsed = described_class.from_xml(xml1)
47
48
  xml2 = parsed.to_xml
48
49
 
49
- # Canonicalize both XMLs and compare using xml-c14n
50
- c14n1 = Xml::C14n.format(xml1)
51
- c14n2 = Xml::C14n.format(xml2)
52
-
53
- expect(c14n2).to eq(c14n1)
54
- expect(c14n2).to be_analogous_with(c14n1)
50
+ # Compare the original and generated XML
51
+ expect(xml2).to be_xml_equivalent_to(xml1)
55
52
  end
56
53
  end
57
54
  end
data/spec/revix_spec.rb CHANGED
@@ -1,6 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "spec_helper"
4
-
5
- RSpec.describe Revix do
6
- end
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "revix"
5
- require "xml/c14n"
5
+ require "canon"
6
6
 
7
7
  RSpec.configure do |config|
8
8
  # Enable flags like --only-failures and --next-failure
@@ -15,3 +15,8 @@ RSpec.configure do |config|
15
15
  c.syntax = :expect
16
16
  end
17
17
  end
18
+
19
+ require "lutaml/model"
20
+ Lutaml::Model::Config.configure do |config|
21
+ config.xml_adapter_type = :nokogiri
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-19 00:00:00.000000000 Z
11
+ date: 2026-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: 0.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.7'
26
+ version: 0.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description:
28
42
  email:
29
43
  - open.source@ribose.com
@@ -34,6 +48,8 @@ files:
34
48
  - ".github/workflows/rake.yml"
35
49
  - ".github/workflows/release.yml"
36
50
  - ".gitignore"
51
+ - ".rubocop.yml"
52
+ - ".rubocop_todo.yml"
37
53
  - Gemfile
38
54
  - LICENSE
39
55
  - README.adoc
@@ -67,6 +83,7 @@ metadata:
67
83
  homepage_uri: https://github.com/metanorma/revix
68
84
  source_code_uri: https://github.com/metanorma/revix
69
85
  bug_tracker_uri: https://github.com/metanorma/revix/issues
86
+ rubygems_mfa_required: 'true'
70
87
  post_install_message:
71
88
  rdoc_options: []
72
89
  require_paths: