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 +4 -4
- data/.github/workflows/release.yml +5 -1
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +183 -0
- data/Gemfile +5 -3
- data/lib/revix/amendment.rb +1 -1
- data/lib/revix/classification.rb +1 -1
- data/lib/revix/contributor.rb +1 -1
- data/lib/revix/date_info.rb +1 -1
- data/lib/revix/location.rb +1 -1
- data/lib/revix/name.rb +1 -1
- data/lib/revix/organization.rb +1 -1
- data/lib/revix/person.rb +1 -1
- data/lib/revix/revision.rb +1 -1
- data/lib/revix/revision_history.rb +1 -1
- data/lib/revix/version.rb +1 -1
- data/lib/revix.rb +1 -10
- data/revix.gemspec +4 -2
- data/spec/models/amendment_spec.rb +36 -40
- data/spec/models/revision_history_spec.rb +19 -19
- data/spec/models/revision_spec.rb +9 -12
- data/spec/revix_spec.rb +0 -3
- data/spec/spec_helper.rb +6 -1
- metadata +21 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce81cd0a055d46f3aea30d283dc46a2fabadf34ad24e646f93836afb060a488e
|
|
4
|
+
data.tar.gz: 2b12dad49a3ecc0cfb5fd46448da9acf7a4a73373ee81eb3c301ef5d8df6e536
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 "
|
|
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 "
|
|
13
|
-
gem "
|
|
13
|
+
gem "rubocop-performance"
|
|
14
|
+
gem "rubocop-rake"
|
|
15
|
+
gem "rubocop-rspec"
|
data/lib/revix/amendment.rb
CHANGED
data/lib/revix/classification.rb
CHANGED
data/lib/revix/contributor.rb
CHANGED
data/lib/revix/date_info.rb
CHANGED
data/lib/revix/location.rb
CHANGED
data/lib/revix/name.rb
CHANGED
data/lib/revix/organization.rb
CHANGED
data/lib/revix/person.rb
CHANGED
data/lib/revix/revision.rb
CHANGED
data/lib/revix/version.rb
CHANGED
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
|
-
|
|
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.
|
|
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
|
|
3
|
+
require "spec_helper"
|
|
4
4
|
|
|
5
5
|
RSpec.describe Revix::Amendment do
|
|
6
6
|
let(:simple_amendment_data) do
|
|
7
|
-
|
|
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:
|
|
13
|
-
Revix::Location.new(type:
|
|
14
|
-
Revix::Location.new(type:
|
|
15
|
-
Revix::Location.new(type:
|
|
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:
|
|
20
|
-
Revix::Classification.new(tag:
|
|
19
|
+
Revix::Classification.new(tag: "severity", value: "major"),
|
|
20
|
+
Revix::Classification.new(tag: "type", value: "editorial"),
|
|
21
21
|
]
|
|
22
22
|
|
|
23
|
-
|
|
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:
|
|
27
|
+
change: "modify",
|
|
28
28
|
)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
describe
|
|
32
|
-
it
|
|
31
|
+
describe ".new" do
|
|
32
|
+
it "creates a simple Amendment object" do
|
|
33
33
|
amendment = simple_amendment_data
|
|
34
|
-
expect(amendment).to be_a(
|
|
35
|
-
expect(amendment.description).to eq(
|
|
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(
|
|
38
|
+
expect(amendment.change).to eq("modify") # Default value
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
it
|
|
41
|
+
it "creates a complex Amendment object" do
|
|
42
42
|
amendment = complex_amendment_data
|
|
43
|
-
expect(amendment).to be_a(
|
|
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(
|
|
47
|
-
expect(amendment.location.first.value).to eq(
|
|
48
|
-
expect(amendment.location.last.type).to eq(
|
|
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(
|
|
52
|
-
expect(amendment.classification.first.value).to eq(
|
|
53
|
-
expect(amendment.change).to eq(
|
|
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
|
|
58
|
-
it
|
|
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(
|
|
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"
|
|
68
|
-
expect(xml).to include(
|
|
69
|
-
expect(xml).to include(
|
|
70
|
-
expect(xml).to include(
|
|
71
|
-
expect(xml).to include(
|
|
72
|
-
expect(xml).to include(
|
|
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
|
|
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 =
|
|
80
|
+
parsed = described_class.from_xml(xml1)
|
|
81
81
|
xml2 = parsed.to_xml
|
|
82
82
|
|
|
83
|
-
#
|
|
84
|
-
|
|
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)
|
|
10
|
-
|
|
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 =
|
|
15
|
-
expect(history).to be_a(
|
|
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 =
|
|
21
|
-
expect(history).to be_a(
|
|
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 =
|
|
27
|
-
expect(history).to be_a(
|
|
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 =
|
|
35
|
-
expect(history).to be_a(
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
#
|
|
68
|
-
|
|
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",
|
|
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
|
-
|
|
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(
|
|
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 =
|
|
47
|
+
parsed = described_class.from_xml(xml1)
|
|
47
48
|
xml2 = parsed.to_xml
|
|
48
49
|
|
|
49
|
-
#
|
|
50
|
-
|
|
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
data/spec/spec_helper.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "bundler/setup"
|
|
4
4
|
require "revix"
|
|
5
|
-
require "
|
|
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.
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|