reqif 0.1.0 → 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 +7 -4
- data/.rubocop.yml +17 -6
- data/.rubocop_todo.yml +241 -0
- data/CLAUDE.md +73 -0
- data/Gemfile +5 -2
- data/README.adoc +61 -1
- data/lib/reqif/alternative_id.rb +2 -2
- data/lib/reqif/attribute_definition_boolean.rb +5 -4
- data/lib/reqif/attribute_definition_date.rb +5 -4
- data/lib/reqif/attribute_definition_enumeration.rb +5 -4
- data/lib/reqif/attribute_definition_integer.rb +5 -4
- data/lib/reqif/attribute_definition_real.rb +5 -4
- data/lib/reqif/attribute_definition_string.rb +5 -4
- data/lib/reqif/attribute_definition_xhtml.rb +5 -4
- data/lib/reqif/attribute_value_boolean.rb +3 -2
- data/lib/reqif/attribute_value_date.rb +4 -3
- data/lib/reqif/attribute_value_enumeration.rb +3 -2
- data/lib/reqif/attribute_value_integer.rb +4 -3
- data/lib/reqif/attribute_value_real.rb +4 -3
- data/lib/reqif/attribute_value_string.rb +3 -2
- data/lib/reqif/attribute_value_xhtml.rb +3 -2
- data/lib/reqif/children.rb +3 -2
- data/lib/reqif/core_content.rb +3 -2
- data/lib/reqif/datatype_definition_boolean.rb +5 -4
- data/lib/reqif/datatype_definition_date.rb +5 -4
- data/lib/reqif/datatype_definition_enumeration.rb +5 -4
- data/lib/reqif/datatype_definition_integer.rb +7 -6
- data/lib/reqif/datatype_definition_real.rb +7 -6
- data/lib/reqif/datatype_definition_string.rb +5 -4
- data/lib/reqif/datatype_definition_xhtml.rb +5 -4
- data/lib/reqif/datatypes.rb +23 -12
- data/lib/reqif/default_value.rb +4 -3
- data/lib/reqif/definition.rb +24 -16
- data/lib/reqif/doors/identifier.rb +15 -0
- data/lib/reqif/doors/module_definition.rb +23 -0
- data/lib/reqif/doors/namespace.rb +10 -0
- data/lib/reqif/doors/readonly_attributes.rb +48 -0
- data/lib/reqif/doors/rif_definition.rb +26 -0
- data/lib/reqif/doors/string_type.rb +12 -0
- data/lib/reqif/doors.rb +12 -0
- data/lib/reqif/editable_atts.rb +24 -16
- data/lib/reqif/embedded_value.rb +4 -3
- data/lib/reqif/enum_value.rb +4 -4
- data/lib/reqif/high_precision_date_time.rb +52 -0
- data/lib/reqif/namespace.rb +16 -0
- data/lib/reqif/object.rb +3 -3
- data/lib/reqif/properties.rb +2 -2
- data/lib/reqif/relation_group.rb +5 -4
- data/lib/reqif/relation_group_type.rb +5 -4
- data/lib/reqif/req_if.rb +7 -2
- data/lib/reqif/req_if_content.rb +3 -2
- data/lib/reqif/req_if_header.rb +4 -5
- data/lib/reqif/req_if_tool_extension.rb +48 -2
- data/lib/reqif/reqif_float.rb +97 -0
- data/lib/reqif/reqif_integer.rb +36 -0
- data/lib/reqif/source.rb +3 -3
- data/lib/reqif/source_specification.rb +3 -3
- data/lib/reqif/spec_attributes.rb +25 -13
- data/lib/reqif/spec_hierarchy.rb +5 -4
- data/lib/reqif/spec_object.rb +5 -4
- data/lib/reqif/spec_object_type.rb +5 -4
- data/lib/reqif/spec_objects.rb +3 -2
- data/lib/reqif/spec_relation.rb +5 -4
- data/lib/reqif/spec_relation_groups.rb +2 -2
- data/lib/reqif/spec_relation_type.rb +5 -4
- data/lib/reqif/spec_relations.rb +3 -3
- data/lib/reqif/spec_types.rb +3 -2
- data/lib/reqif/specification.rb +5 -4
- data/lib/reqif/specification_type.rb +5 -4
- data/lib/reqif/specifications.rb +3 -2
- data/lib/reqif/specified_values.rb +2 -2
- data/lib/reqif/string_type.rb +7 -0
- data/lib/reqif/target.rb +3 -3
- data/lib/reqif/target_specification.rb +3 -3
- data/lib/reqif/the_header.rb +3 -2
- data/lib/reqif/tool_extensions.rb +2 -2
- data/lib/reqif/type.rb +28 -20
- data/lib/reqif/values.rb +8 -5
- data/lib/reqif/version.rb +1 -1
- data/lib/reqif/xhtml/div.rb +18 -0
- data/lib/reqif/xhtml/namespace.rb +10 -0
- data/lib/reqif/xhtml/p.rb +18 -0
- data/lib/reqif/xhtml/span.rb +18 -0
- data/lib/reqif/xhtml.rb +12 -0
- data/lib/reqif/xhtml_content.rb +182 -2
- data/lib/reqif.rb +70 -14
- data/references/driver.xsd +270 -270
- data/references/reqif.xsd +892 -892
- data/reqif.gemspec +4 -3
- data/spec/fixtures/antcc_MAG8000-LTE-FeatureSpecReqBL4.reqif +4299 -0
- data/spec/fixtures/ea_example.reqif.xml +236 -0
- data/spec/fixtures/eclipse_capella_Sample.xml +177 -0
- data/spec/fixtures/eclipse_capella_Sample1.xml +239 -0
- data/spec/fixtures/eclipse_capella_Sample2.xml +239 -0
- data/spec/fixtures/eclipse_capella_Sample3.xml +304 -0
- data/spec/fixtures/eclipse_capella_model1.xml +4080 -0
- data/spec/fixtures/eclipse_rmf_sample.reqif +96 -0
- data/spec/fixtures/eclipse_rmf_specRelationTest.reqif +110 -0
- data/spec/fixtures/polarion_export.xml +70 -0
- data/spec/fixtures/strictdoc_01_minimal_reqif_sample.reqif +4 -0
- data/spec/fixtures/strictdoc_02_read_reqif_input.reqif +3996 -0
- data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample1_polarion.reqif +197 -0
- data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample2_sdoc.reqif +451 -0
- data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample3_eclipse_rmf.reqif +334 -0
- data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample_polarion_reqifz.reqifz +0 -0
- data/spec/reqif/data_types_spec.rb +29 -0
- data/spec/reqif/polarion_export_spec.rb +22 -0
- data/spec/reqif/req_if_header_spec.rb +31 -0
- data/spec/reqif/req_if_spec.rb +43 -0
- data/spec/reqif/spec_objects_spec.rb +35 -0
- data/spec/reqif/spec_relations_spec.rb +33 -0
- data/spec/reqif/spec_types_spec.rb +40 -0
- data/spec/reqif/specifications_spec.rb +35 -0
- data/spec/reqif/tool_extension_spec.rb +27 -0
- data/spec/reqif_spec.rb +56 -0
- data/spec/spec_helper.rb +70 -0
- metadata +58 -11
data/spec/reqif_spec.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require "pathname"
|
|
5
|
+
# require_relative "../lib/Reqif/ReqIf"
|
|
6
|
+
|
|
7
|
+
RSpec.describe Reqif do
|
|
8
|
+
fixtures_dir = Pathname.new(__dir__).join("fixtures")
|
|
9
|
+
|
|
10
|
+
describe "XML round-trip conversion" do
|
|
11
|
+
xml_files = Dir[fixtures_dir.join("**", "*.xml")] +
|
|
12
|
+
Dir[fixtures_dir.join("**", "*.reqif")]
|
|
13
|
+
|
|
14
|
+
# def check_parsed_content(parsed, reparsed)
|
|
15
|
+
# %i[
|
|
16
|
+
# schema_name
|
|
17
|
+
# schema_version
|
|
18
|
+
# short_name
|
|
19
|
+
# namespace
|
|
20
|
+
# json_base_uri
|
|
21
|
+
# ].each do |element|
|
|
22
|
+
# expect(reparsed.send(element)).to eq(parsed.send(element))
|
|
23
|
+
# end
|
|
24
|
+
# end
|
|
25
|
+
|
|
26
|
+
xml_files.each do |file_path|
|
|
27
|
+
context "with file #{Pathname.new(file_path).relative_path_from(fixtures_dir)}" do
|
|
28
|
+
# context "with file #{file_path}" do
|
|
29
|
+
let(:xml_string) { File.read(file_path) }
|
|
30
|
+
|
|
31
|
+
# it 'provides identical attribute access' do
|
|
32
|
+
# parsed = Reqif::ReqIf.from_xml(xml_string)
|
|
33
|
+
# generated = parsed.to_xml(
|
|
34
|
+
# pretty: true,
|
|
35
|
+
# declaration: true,
|
|
36
|
+
# encoding: 'utf-8'
|
|
37
|
+
# )
|
|
38
|
+
# reparsed = Reqif::ReqIf.from_xml(generated)
|
|
39
|
+
|
|
40
|
+
# check_parsed_content(parsed, reparsed)
|
|
41
|
+
# end
|
|
42
|
+
|
|
43
|
+
it "performs lossless round-trip conversion" do
|
|
44
|
+
parsed = Reqif::ReqIf.from_xml(xml_string)
|
|
45
|
+
generated = parsed.to_xml(
|
|
46
|
+
pretty: true,
|
|
47
|
+
declaration: true,
|
|
48
|
+
encoding: "utf-8",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
expect(generated).to be_xml_equivalent_to(xml_string)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "reqif"
|
|
4
|
+
require "nokogiri"
|
|
5
|
+
require "canon/rspec_matchers"
|
|
6
|
+
|
|
7
|
+
# Configure Canon to ignore XML comments (lutaml-model doesn't preserve them)
|
|
8
|
+
# and structural whitespace (input/output formatting may differ)
|
|
9
|
+
Canon::Config.configure do |config|
|
|
10
|
+
config.xml.match.options = {
|
|
11
|
+
comments: :ignore,
|
|
12
|
+
structural_whitespace: :ignore,
|
|
13
|
+
attribute_order: :ignore,
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Monkey-patch FormatPreservationRule to handle namespaces without prefix_default.
|
|
18
|
+
# When a namespace URI is declared with a prefix in the input (e.g., xmlns:reqif="..."),
|
|
19
|
+
# the preserved_input_format becomes :prefix. But if the Namespace class doesn't
|
|
20
|
+
# define prefix_default, we fall back to :default format to avoid an error.
|
|
21
|
+
module Lutaml
|
|
22
|
+
module Xml
|
|
23
|
+
module Decisions
|
|
24
|
+
module Rules
|
|
25
|
+
class FormatPreservationRule
|
|
26
|
+
alias_method :original_decide, :decide
|
|
27
|
+
def decide(context)
|
|
28
|
+
input_format = context.preserved_input_format
|
|
29
|
+
|
|
30
|
+
if input_format == :default
|
|
31
|
+
Decision.default(
|
|
32
|
+
namespace_class: context.namespace_class,
|
|
33
|
+
reason: "Priority 1: Input used default format - preserve it",
|
|
34
|
+
)
|
|
35
|
+
elsif context.namespace_class.prefix_default.nil?
|
|
36
|
+
# input_format is :prefix but prefix_default might be nil
|
|
37
|
+
# Fall back to default format to avoid ArgumentError
|
|
38
|
+
Decision.default(
|
|
39
|
+
namespace_class: context.namespace_class,
|
|
40
|
+
reason: "Priority 1: No prefix_default - use default format",
|
|
41
|
+
)
|
|
42
|
+
else
|
|
43
|
+
Decision.prefix(
|
|
44
|
+
prefix: context.namespace_class.prefix_default,
|
|
45
|
+
namespace_class: context.namespace_class,
|
|
46
|
+
reason: "Priority 1: Input used prefix format - preserve it",
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
RSpec.configure do |config|
|
|
57
|
+
# Enable flags like --only-failures and --next-failure
|
|
58
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
|
59
|
+
|
|
60
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
61
|
+
config.disable_monkey_patching!
|
|
62
|
+
|
|
63
|
+
config.expect_with :rspec do |c|
|
|
64
|
+
c.syntax = :expect
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Lutaml::Model::Config.configure do |config|
|
|
69
|
+
config.xml_adapter_type = :nokogiri
|
|
70
|
+
end
|
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: reqif
|
|
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 Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: hyperlang
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.1.1
|
|
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.1.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: lutaml-model
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 0.8.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 0.8.0
|
|
41
41
|
description: A Ruby library for parsing and generating ReqIF data
|
|
42
42
|
email:
|
|
43
43
|
- open.source@ribose.com'
|
|
@@ -50,6 +50,8 @@ files:
|
|
|
50
50
|
- ".gitignore"
|
|
51
51
|
- ".rspec"
|
|
52
52
|
- ".rubocop.yml"
|
|
53
|
+
- ".rubocop_todo.yml"
|
|
54
|
+
- CLAUDE.md
|
|
53
55
|
- Gemfile
|
|
54
56
|
- README.adoc
|
|
55
57
|
- Rakefile
|
|
@@ -83,9 +85,18 @@ files:
|
|
|
83
85
|
- lib/reqif/datatypes.rb
|
|
84
86
|
- lib/reqif/default_value.rb
|
|
85
87
|
- lib/reqif/definition.rb
|
|
88
|
+
- lib/reqif/doors.rb
|
|
89
|
+
- lib/reqif/doors/identifier.rb
|
|
90
|
+
- lib/reqif/doors/module_definition.rb
|
|
91
|
+
- lib/reqif/doors/namespace.rb
|
|
92
|
+
- lib/reqif/doors/readonly_attributes.rb
|
|
93
|
+
- lib/reqif/doors/rif_definition.rb
|
|
94
|
+
- lib/reqif/doors/string_type.rb
|
|
86
95
|
- lib/reqif/editable_atts.rb
|
|
87
96
|
- lib/reqif/embedded_value.rb
|
|
88
97
|
- lib/reqif/enum_value.rb
|
|
98
|
+
- lib/reqif/high_precision_date_time.rb
|
|
99
|
+
- lib/reqif/namespace.rb
|
|
89
100
|
- lib/reqif/object.rb
|
|
90
101
|
- lib/reqif/properties.rb
|
|
91
102
|
- lib/reqif/relation_group.rb
|
|
@@ -94,6 +105,8 @@ files:
|
|
|
94
105
|
- lib/reqif/req_if_content.rb
|
|
95
106
|
- lib/reqif/req_if_header.rb
|
|
96
107
|
- lib/reqif/req_if_tool_extension.rb
|
|
108
|
+
- lib/reqif/reqif_float.rb
|
|
109
|
+
- lib/reqif/reqif_integer.rb
|
|
97
110
|
- lib/reqif/source.rb
|
|
98
111
|
- lib/reqif/source_specification.rb
|
|
99
112
|
- lib/reqif/spec_attributes.rb
|
|
@@ -110,6 +123,7 @@ files:
|
|
|
110
123
|
- lib/reqif/specification_type.rb
|
|
111
124
|
- lib/reqif/specifications.rb
|
|
112
125
|
- lib/reqif/specified_values.rb
|
|
126
|
+
- lib/reqif/string_type.rb
|
|
113
127
|
- lib/reqif/target.rb
|
|
114
128
|
- lib/reqif/target_specification.rb
|
|
115
129
|
- lib/reqif/the_header.rb
|
|
@@ -117,11 +131,43 @@ files:
|
|
|
117
131
|
- lib/reqif/type.rb
|
|
118
132
|
- lib/reqif/values.rb
|
|
119
133
|
- lib/reqif/version.rb
|
|
134
|
+
- lib/reqif/xhtml.rb
|
|
135
|
+
- lib/reqif/xhtml/div.rb
|
|
136
|
+
- lib/reqif/xhtml/namespace.rb
|
|
137
|
+
- lib/reqif/xhtml/p.rb
|
|
138
|
+
- lib/reqif/xhtml/span.rb
|
|
120
139
|
- lib/reqif/xhtml_content.rb
|
|
121
140
|
- references/driver.xsd
|
|
122
141
|
- references/reqif.xsd
|
|
123
142
|
- reqif.gemspec
|
|
124
143
|
- sig/reqif.rbs
|
|
144
|
+
- spec/fixtures/antcc_MAG8000-LTE-FeatureSpecReqBL4.reqif
|
|
145
|
+
- spec/fixtures/ea_example.reqif.xml
|
|
146
|
+
- spec/fixtures/eclipse_capella_Sample.xml
|
|
147
|
+
- spec/fixtures/eclipse_capella_Sample1.xml
|
|
148
|
+
- spec/fixtures/eclipse_capella_Sample2.xml
|
|
149
|
+
- spec/fixtures/eclipse_capella_Sample3.xml
|
|
150
|
+
- spec/fixtures/eclipse_capella_model1.xml
|
|
151
|
+
- spec/fixtures/eclipse_rmf_sample.reqif
|
|
152
|
+
- spec/fixtures/eclipse_rmf_specRelationTest.reqif
|
|
153
|
+
- spec/fixtures/polarion_export.xml
|
|
154
|
+
- spec/fixtures/strictdoc_01_minimal_reqif_sample.reqif
|
|
155
|
+
- spec/fixtures/strictdoc_02_read_reqif_input.reqif
|
|
156
|
+
- spec/fixtures/strictdoc_04_convert_reqif_to_json_sample1_polarion.reqif
|
|
157
|
+
- spec/fixtures/strictdoc_04_convert_reqif_to_json_sample2_sdoc.reqif
|
|
158
|
+
- spec/fixtures/strictdoc_04_convert_reqif_to_json_sample3_eclipse_rmf.reqif
|
|
159
|
+
- spec/fixtures/strictdoc_04_convert_reqif_to_json_sample_polarion_reqifz.reqifz
|
|
160
|
+
- spec/reqif/data_types_spec.rb
|
|
161
|
+
- spec/reqif/polarion_export_spec.rb
|
|
162
|
+
- spec/reqif/req_if_header_spec.rb
|
|
163
|
+
- spec/reqif/req_if_spec.rb
|
|
164
|
+
- spec/reqif/spec_objects_spec.rb
|
|
165
|
+
- spec/reqif/spec_relations_spec.rb
|
|
166
|
+
- spec/reqif/spec_types_spec.rb
|
|
167
|
+
- spec/reqif/specifications_spec.rb
|
|
168
|
+
- spec/reqif/tool_extension_spec.rb
|
|
169
|
+
- spec/reqif_spec.rb
|
|
170
|
+
- spec/spec_helper.rb
|
|
125
171
|
homepage: https://github.com/lutaml/reqif
|
|
126
172
|
licenses:
|
|
127
173
|
- MIT
|
|
@@ -129,6 +175,7 @@ metadata:
|
|
|
129
175
|
homepage_uri: https://github.com/lutaml/reqif
|
|
130
176
|
source_code_uri: https://github.com/lutaml/reqif
|
|
131
177
|
changelog_uri: https://github.com/lutaml/reqif/releases
|
|
178
|
+
rubygems_mfa_required: 'true'
|
|
132
179
|
post_install_message:
|
|
133
180
|
rdoc_options: []
|
|
134
181
|
require_paths:
|
|
@@ -144,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
191
|
- !ruby/object:Gem::Version
|
|
145
192
|
version: '0'
|
|
146
193
|
requirements: []
|
|
147
|
-
rubygems_version: 3.5.
|
|
194
|
+
rubygems_version: 3.5.22
|
|
148
195
|
signing_key:
|
|
149
196
|
specification_version: 4
|
|
150
197
|
summary: ReqIF (Requirements Interchange Format) library
|