modspec 0.1.3 → 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/rake.yml +4 -0
- data/.github/workflows/release.yml +5 -0
- data/.rubocop.yml +16 -7
- data/.rubocop_todo.yml +67 -80
- data/CLAUDE.md +61 -0
- data/Gemfile +5 -3
- data/lib/modspec/conformance_class.rb +4 -4
- data/lib/modspec/conformance_test.rb +21 -6
- data/lib/modspec/normative_statement.rb +10 -3
- data/lib/modspec/normative_statements_class.rb +7 -5
- data/lib/modspec/suite.rb +86 -34
- data/lib/modspec/version.rb +1 -1
- data/lib/modspec.rb +1 -12
- data/modspec.gemspec +3 -2
- data/spec/conformance_class.liquid +2 -2
- data/spec/fixtures/advanced-json-rc.yaml +5 -7
- data/spec/fixtures/advanced-rc.yaml +12 -14
- data/spec/fixtures/basic-quaternion-json-rc.yaml +5 -7
- data/spec/fixtures/basic-quaternion-json-strict-rc.yaml +4 -5
- data/spec/fixtures/basic-quaternion-rc.yaml +7 -8
- data/spec/fixtures/basic-ypr-json-rc.yaml +5 -8
- data/spec/fixtures/basic-ypr-rc.yaml +7 -7
- data/spec/fixtures/chain-json-rc.yaml +5 -7
- data/spec/fixtures/chain-rc.yaml +11 -13
- data/spec/fixtures/frame-spec-rc.yaml +10 -10
- data/spec/fixtures/global-rc.yaml +7 -4
- data/spec/fixtures/graph-json-rc.yaml +5 -7
- data/spec/fixtures/graph-rc.yaml +11 -13
- data/spec/fixtures/series-irregular-json-rc.yaml +5 -7
- data/spec/fixtures/series-irregular-rc.yaml +13 -15
- data/spec/fixtures/series-regular-json-rc.yaml +5 -7
- data/spec/fixtures/series-regular-rc.yaml +15 -17
- data/spec/fixtures/stream-json-rc.yaml +9 -11
- data/spec/fixtures/stream-rc.yaml +10 -12
- data/spec/fixtures/tangent-point-rc.yaml +10 -11
- data/spec/fixtures/time-rc.yaml +6 -8
- data/spec/modspec/conformance_class_spec.rb +29 -27
- data/spec/modspec/conformance_test_spec.rb +6 -5
- data/spec/modspec/normative_statement_spec.rb +16 -12
- data/spec/modspec/normative_statements_class_spec.rb +4 -4
- data/spec/modspec/suite_spec.rb +26 -22
- data/spec/modspec_spec.rb +7 -7
- data/spec/spec_helper.rb +1 -0
- metadata +7 -5
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
RSpec.describe Modspec::NormativeStatement do
|
|
4
4
|
let(:global_sdu_statement) do
|
|
5
|
-
|
|
5
|
+
described_class.new(
|
|
6
6
|
identifier: "/req/global/sdu",
|
|
7
7
|
name: "SDU conforms to the 'Structural Data Unit - SDU' stereotype",
|
|
8
|
-
statement: "Implementations using encoded SDUs SHALL conform to the logical description of the Logical Model elements with the 'Structural Data Unit - SDU' stereotype."
|
|
8
|
+
statement: "Implementations using encoded SDUs SHALL conform to the logical description of the Logical Model elements with the 'Structural Data Unit - SDU' stereotype.",
|
|
9
9
|
)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
let(:tangent_point_statement) do
|
|
13
|
-
|
|
13
|
+
described_class.new(
|
|
14
14
|
identifier: "/req/tangent-point",
|
|
15
15
|
name: "Tangent point requirements",
|
|
16
|
-
statement: "Common tangent point requirements for SDUs that include tangent points."
|
|
16
|
+
statement: "Common tangent point requirements for SDUs that include tangent points.",
|
|
17
17
|
)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
let(:normative_statement) do
|
|
21
|
-
|
|
21
|
+
described_class.new(
|
|
22
22
|
identifier: "/req/basic-ypr/position",
|
|
23
23
|
name: "Expression of outer frame",
|
|
24
24
|
statement: "The `Basic_YPR.position` attribute shall represent the outer frame, specified by an implicit WGS-84 CRS and an implicit EPSG 4461-CS (LTP-ENU) coordinate system and explicit parameters to define the tangent point.",
|
|
@@ -26,7 +26,7 @@ RSpec.describe Modspec::NormativeStatement do
|
|
|
26
26
|
subject: "Basic_YPR.position",
|
|
27
27
|
inherit: ["/req/global/sdu"],
|
|
28
28
|
dependencies: ["/req/tangent-point"],
|
|
29
|
-
guidance: ["Ensure the coordinate system is correctly specified."]
|
|
29
|
+
guidance: ["Ensure the coordinate system is correctly specified."],
|
|
30
30
|
)
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -34,17 +34,18 @@ RSpec.describe Modspec::NormativeStatement do
|
|
|
34
34
|
suite = Modspec::Suite.new
|
|
35
35
|
global_class = Modspec::NormativeStatementsClass.new(
|
|
36
36
|
identifier: "/req/global",
|
|
37
|
-
normative_statements: [global_sdu_statement]
|
|
37
|
+
normative_statements: [global_sdu_statement],
|
|
38
38
|
)
|
|
39
39
|
tangent_point_class = Modspec::NormativeStatementsClass.new(
|
|
40
40
|
identifier: "/req/tangent-point",
|
|
41
|
-
normative_statements: [tangent_point_statement]
|
|
41
|
+
normative_statements: [tangent_point_statement],
|
|
42
42
|
)
|
|
43
43
|
basic_ypr_class = Modspec::NormativeStatementsClass.new(
|
|
44
44
|
identifier: "/req/basic-ypr",
|
|
45
|
-
normative_statements: [normative_statement]
|
|
45
|
+
normative_statements: [normative_statement],
|
|
46
46
|
)
|
|
47
|
-
suite.normative_statements_classes = [global_class, tangent_point_class,
|
|
47
|
+
suite.normative_statements_classes = [global_class, tangent_point_class,
|
|
48
|
+
basic_ypr_class]
|
|
48
49
|
suite
|
|
49
50
|
end
|
|
50
51
|
|
|
@@ -61,7 +62,8 @@ RSpec.describe Modspec::NormativeStatement do
|
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
it "has a valid obligation" do
|
|
64
|
-
expect(%w[requirement recommendation
|
|
65
|
+
expect(%w[requirement recommendation
|
|
66
|
+
permission]).to include(normative_statement.obligation)
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
describe "#validate" do
|
|
@@ -72,7 +74,9 @@ RSpec.describe Modspec::NormativeStatement do
|
|
|
72
74
|
|
|
73
75
|
it "returns errors for an invalid obligation" do
|
|
74
76
|
normative_statement.obligation = "invalid"
|
|
75
|
-
expect
|
|
77
|
+
expect do
|
|
78
|
+
normative_statement.validate!
|
|
79
|
+
end.to raise_error(Lutaml::Model::ValidationError) do |error|
|
|
76
80
|
expect(error).to include(Lutaml::Model::InvalidValueError)
|
|
77
81
|
expect(error.error_messages).to include("obligation is `invalid`, must be one of the following [recommendation, permission, requirement]")
|
|
78
82
|
end
|
|
@@ -5,7 +5,7 @@ RSpec.describe Modspec::NormativeStatementsClass do
|
|
|
5
5
|
Modspec::NormativeStatement.new(
|
|
6
6
|
identifier: "/req/basic-ypr/position",
|
|
7
7
|
name: "Expression of outer frame",
|
|
8
|
-
statement: "The `Basic_YPR.position` attribute shall represent the outer frame, specified by an implicit WGS-84 CRS and an implicit EPSG 4461-CS (LTP-ENU) coordinate system and explicit parameters to define the tangent point."
|
|
8
|
+
statement: "The `Basic_YPR.position` attribute shall represent the outer frame, specified by an implicit WGS-84 CRS and an implicit EPSG 4461-CS (LTP-ENU) coordinate system and explicit parameters to define the tangent point.",
|
|
9
9
|
)
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -13,17 +13,17 @@ RSpec.describe Modspec::NormativeStatementsClass do
|
|
|
13
13
|
Modspec::NormativeStatement.new(
|
|
14
14
|
identifier: "/req/basic-ypr/angles",
|
|
15
15
|
name: "Expression of inner frame",
|
|
16
|
-
statement: "The `Basic_YPR.angles` attribute shall represent the inner frame, which is a rotation-only transformation with Yaw, Pitch, and Roll (YPR) angles."
|
|
16
|
+
statement: "The `Basic_YPR.angles` attribute shall represent the inner frame, which is a rotation-only transformation with Yaw, Pitch, and Roll (YPR) angles.",
|
|
17
17
|
)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
let(:normative_statements_class) do
|
|
21
|
-
|
|
21
|
+
described_class.new(
|
|
22
22
|
identifier: "/req/basic-ypr",
|
|
23
23
|
name: "Basic-YPR logical model SDU",
|
|
24
24
|
description: "The Basic-YPR Target has a simple structure with no options. Position is specified as a point in an LTP-ENU frame and rotation is specified by yaw, pitch, and roll angles specified in decimal degrees.",
|
|
25
25
|
dependencies: ["/req/global", "/req/tangent-point"],
|
|
26
|
-
normative_statements: [normative_statement1, normative_statement2]
|
|
26
|
+
normative_statements: [normative_statement1, normative_statement2],
|
|
27
27
|
)
|
|
28
28
|
end
|
|
29
29
|
|
data/spec/modspec/suite_spec.rb
CHANGED
|
@@ -9,10 +9,10 @@ RSpec.describe Modspec::Suite do
|
|
|
9
9
|
let(:time_rc) { File.read("spec/fixtures/time-rc.yaml") }
|
|
10
10
|
let(:frame_spec_rc) { File.read("spec/fixtures/frame-spec-rc.yaml") }
|
|
11
11
|
|
|
12
|
-
let(:global_suite) {
|
|
13
|
-
let(:tangent_point_suite) {
|
|
14
|
-
let(:time_suite) {
|
|
15
|
-
let(:frame_spec_suite) {
|
|
12
|
+
let(:global_suite) { described_class.from_yaml(global_rc) }
|
|
13
|
+
let(:tangent_point_suite) { described_class.from_yaml(tangent_point_rc) }
|
|
14
|
+
let(:time_suite) { described_class.from_yaml(time_rc) }
|
|
15
|
+
let(:frame_spec_suite) { described_class.from_yaml(frame_spec_rc) }
|
|
16
16
|
|
|
17
17
|
describe ".from_yaml" do
|
|
18
18
|
it "parses a requirements class YAML file" do
|
|
@@ -32,45 +32,49 @@ RSpec.describe Modspec::Suite do
|
|
|
32
32
|
it "returns no errors for a valid combined suite" do
|
|
33
33
|
base_suite = described_class.from_yaml(rc_yaml)
|
|
34
34
|
combined_suite = base_suite
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
.combine(global_suite)
|
|
36
|
+
.combine(tangent_point_suite)
|
|
37
|
+
.combine(time_suite)
|
|
38
|
+
.combine(frame_spec_suite)
|
|
39
39
|
|
|
40
40
|
errors = combined_suite.validate
|
|
41
41
|
if errors.any?
|
|
42
|
-
|
|
43
|
-
errors.each { |error|
|
|
42
|
+
|
|
43
|
+
errors.each { |error| }
|
|
44
44
|
end
|
|
45
45
|
expect(errors).to be_empty
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
describe "#combine" do
|
|
50
|
-
let(:suite1)
|
|
51
|
-
|
|
50
|
+
let(:suite1) do
|
|
51
|
+
described_class.from_yaml(File.read("spec/fixtures/basic-ypr-rc.yaml"))
|
|
52
|
+
end
|
|
53
|
+
let(:suite2) do
|
|
54
|
+
described_class.from_yaml(File.read("spec/fixtures/basic-quaternion-rc.yaml"))
|
|
55
|
+
end
|
|
52
56
|
|
|
53
57
|
it "combines two suites" do
|
|
54
58
|
combined_suite = suite1.combine(suite2)
|
|
55
59
|
expect(combined_suite.name).to eq("#{suite1.name} + #{suite2.name}")
|
|
56
60
|
expect(combined_suite.normative_statements_classes.count).to eq(
|
|
57
61
|
suite1.normative_statements_classes.count +
|
|
58
|
-
suite2.normative_statements_classes.count
|
|
62
|
+
suite2.normative_statements_classes.count,
|
|
59
63
|
)
|
|
60
64
|
end
|
|
61
65
|
|
|
62
66
|
it "resolves conflicts when combining suites" do
|
|
63
67
|
combined_suite = suite1
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
.combine(suite2)
|
|
69
|
+
.combine(global_suite)
|
|
70
|
+
.combine(tangent_point_suite)
|
|
71
|
+
.combine(time_suite)
|
|
72
|
+
.combine(frame_spec_suite)
|
|
69
73
|
|
|
70
74
|
errors = combined_suite.validate
|
|
71
75
|
if errors.any?
|
|
72
|
-
|
|
73
|
-
errors.each { |error|
|
|
76
|
+
|
|
77
|
+
errors.each { |error| }
|
|
74
78
|
end
|
|
75
79
|
expect(errors).to be_empty
|
|
76
80
|
end
|
|
@@ -93,8 +97,8 @@ RSpec.describe Modspec::Suite do
|
|
|
93
97
|
errors = combined_suite.validate
|
|
94
98
|
|
|
95
99
|
if errors.any?
|
|
96
|
-
|
|
97
|
-
errors.each { |error|
|
|
100
|
+
|
|
101
|
+
errors.each { |error| }
|
|
98
102
|
end
|
|
99
103
|
|
|
100
104
|
# Check for specific error types
|
data/spec/modspec_spec.rb
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
RSpec.describe Modspec do
|
|
4
4
|
it "has a version number" do
|
|
5
|
-
expect(Modspec::VERSION).not_to
|
|
5
|
+
expect(Modspec::VERSION).not_to be_nil
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
Dir.glob("spec/fixtures/*-rc.yaml").each do |file|
|
|
9
9
|
it "parses normative statements class #{file}" do
|
|
10
|
-
|
|
11
|
-
Modspec::Suite.from_yaml(
|
|
10
|
+
source_yaml = File.read(file)
|
|
11
|
+
output_yaml = Modspec::Suite.from_yaml(source_yaml).to_yaml
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
expect(output_yaml).to be_yaml_equivalent_to(source_yaml)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
Dir.glob("spec/fixtures/*-cc.yaml").each do |file|
|
|
18
18
|
it "parses conformance class #{file}" do
|
|
19
|
-
|
|
20
|
-
Modspec::Suite.from_yaml(
|
|
19
|
+
source_yaml = File.read(file)
|
|
20
|
+
output_yaml = Modspec::Suite.from_yaml(source_yaml).to_yaml
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
expect(output_yaml).to be_yaml_equivalent_to(source_yaml)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: modspec
|
|
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-05-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: lutaml-model
|
|
@@ -16,14 +16,14 @@ 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
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: nokogiri
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,6 +65,7 @@ files:
|
|
|
65
65
|
- ".rspec"
|
|
66
66
|
- ".rubocop.yml"
|
|
67
67
|
- ".rubocop_todo.yml"
|
|
68
|
+
- CLAUDE.md
|
|
68
69
|
- CODE_OF_CONDUCT.md
|
|
69
70
|
- Gemfile
|
|
70
71
|
- README.adoc
|
|
@@ -137,6 +138,7 @@ metadata:
|
|
|
137
138
|
homepage_uri: https://github.com/metanorma/modspec-ruby
|
|
138
139
|
source_code_uri: https://github.com/metanorma/modspec-ruby
|
|
139
140
|
bug_tracker_uri: https://github.com/metanorma/modspec-ruby/issues
|
|
141
|
+
rubygems_mfa_required: 'true'
|
|
140
142
|
post_install_message:
|
|
141
143
|
rdoc_options: []
|
|
142
144
|
require_paths:
|
|
@@ -152,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
152
154
|
- !ruby/object:Gem::Version
|
|
153
155
|
version: '0'
|
|
154
156
|
requirements: []
|
|
155
|
-
rubygems_version: 3.
|
|
157
|
+
rubygems_version: 3.5.22
|
|
156
158
|
signing_key:
|
|
157
159
|
specification_version: 4
|
|
158
160
|
summary: Library to work with OGC ModSpec.
|