oscal 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.docker/Dockerfile +19 -0
- data/.docker/Makefile +43 -0
- data/.docker/docker-compose.yml +14 -0
- data/.docker/readme.md +61 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/.hound.yml +5 -0
- data/.rspec +0 -1
- data/.rubocop.yml +10 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE +25 -0
- data/Makefile +1 -0
- data/README.adoc +66 -0
- data/Rakefile +13 -6
- data/bin/console +30 -0
- data/bin/rspec +27 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +1 -0
- data/exe/convert2oscalyaml.rb +560 -0
- data/lib/oscal/add.rb +26 -0
- data/lib/oscal/address.rb +22 -0
- data/lib/oscal/address_line.rb +11 -0
- data/lib/oscal/alter.rb +22 -0
- data/lib/oscal/assembly.rb +119 -0
- data/lib/oscal/assessment_plan.rb +28 -0
- data/lib/oscal/assessment_result.rb +230 -0
- data/lib/oscal/attribute_type_hash.rb +80 -0
- data/lib/oscal/back_matter.rb +20 -0
- data/lib/oscal/base64_object.rb +11 -0
- data/lib/oscal/base_class.rb +50 -0
- data/lib/oscal/catalog.rb +51 -10
- data/lib/oscal/choice.rb +11 -0
- data/lib/oscal/citation.rb +22 -0
- data/lib/oscal/combine.rb +11 -0
- data/lib/oscal/common_utils.rb +35 -0
- data/lib/oscal/constraint.rb +20 -0
- data/lib/oscal/control.rb +20 -30
- data/lib/oscal/custom.rb +22 -0
- data/lib/oscal/datatypes.rb +50 -0
- data/lib/oscal/document_id.rb +11 -0
- data/lib/oscal/email_address.rb +11 -0
- data/lib/oscal/exclude_control.rb +22 -0
- data/lib/oscal/external_id.rb +11 -0
- data/lib/oscal/group.rb +26 -34
- data/lib/oscal/guideline.rb +11 -0
- data/lib/oscal/hash_object.rb +11 -0
- data/lib/oscal/import_object.rb +22 -0
- data/lib/oscal/include_control.rb +22 -0
- data/lib/oscal/insert_control.rb +22 -0
- data/lib/oscal/link.rb +11 -0
- data/lib/oscal/list.rb +160 -0
- data/lib/oscal/location.rb +31 -0
- data/lib/oscal/location_uuid.rb +11 -0
- data/lib/oscal/logger.rb +8 -0
- data/lib/oscal/matching.rb +11 -0
- data/lib/oscal/member_of_organization.rb +11 -0
- data/lib/oscal/merge.rb +20 -0
- data/lib/oscal/metadata_block.rb +28 -13
- data/lib/oscal/modify.rb +22 -0
- data/lib/oscal/parameter.rb +22 -19
- data/lib/oscal/parsing_functions.rb +19 -0
- data/lib/oscal/part.rb +14 -22
- data/lib/oscal/party.rb +36 -0
- data/lib/oscal/party_uuid.rb +11 -0
- data/lib/oscal/profile.rb +33 -7
- data/lib/oscal/property.rb +4 -25
- data/lib/oscal/remove.rb +11 -0
- data/lib/oscal/resource.rb +29 -0
- data/lib/oscal/responsible_party.rb +24 -0
- data/lib/oscal/revision.rb +23 -0
- data/lib/oscal/rlink.rb +20 -0
- data/lib/oscal/role.rb +22 -0
- data/lib/oscal/select.rb +20 -0
- data/lib/oscal/serializer.rb +17 -4
- data/lib/oscal/set_parameter.rb +31 -0
- data/lib/oscal/telephone_number.rb +11 -0
- data/lib/oscal/test.rb +11 -0
- data/lib/oscal/url.rb +11 -0
- data/lib/oscal/value.rb +37 -0
- data/lib/oscal/version.rb +1 -1
- data/lib/oscal/with_id.rb +40 -0
- data/lib/oscal.rb +1 -13
- data/oscal.gemspec +9 -11
- data/spec/oscal/catalog_spec.rb +40 -0
- data/spec/oscal_spec.rb +7 -0
- data/spec/sample_inputs/import-ap.json +4 -0
- data/spec/spec_helper.rb +15 -0
- metadata +84 -10
- data/lib/oscal/component.rb +0 -14
- data/lib/oscal/prose.rb +0 -13
- data/lib/oscal/statement.rb +0 -12
data/lib/oscal.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative "oscal/serializer"
|
5
|
-
require_relative "oscal/catalog"
|
6
|
-
require_relative "oscal/component"
|
7
|
-
require_relative "oscal/control"
|
8
|
-
require_relative "oscal/group"
|
9
|
-
require_relative "oscal/part"
|
10
|
-
require_relative "oscal/parameter"
|
11
|
-
require_relative "oscal/metadata_block"
|
12
|
-
require_relative "oscal/profile"
|
13
|
-
require_relative "oscal/property"
|
14
|
-
require_relative "oscal/prose"
|
15
|
-
require_relative "oscal/statement"
|
3
|
+
Dir[File.join(__dir__, "oscal", "*.rb")].each { |file| require file }
|
16
4
|
|
17
5
|
module Oscal
|
18
6
|
class Error < StandardError; end
|
data/oscal.gemspec
CHANGED
@@ -5,28 +5,26 @@ require_relative "lib/oscal/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "oscal"
|
7
7
|
spec.version = Oscal::VERSION
|
8
|
-
spec.authors = ["
|
9
|
-
spec.email = ["
|
8
|
+
spec.authors = ["Ribose Inc."]
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
11
|
spec.summary = "Interact with OSCAL models"
|
12
12
|
spec.description = "Ruby library and parser for OSCAL models"
|
13
13
|
spec.homepage = "https://github.com/metanorma/oscal-ruby/"
|
14
|
-
spec.
|
14
|
+
spec.license = "BSD-2-Clause"
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/metanorma/oscal-ruby/"
|
18
18
|
spec.metadata["changelog_uri"] = "https://github.com/metanorma/oscal-ruby/CHANGELOG"
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
-
end
|
20
|
+
spec.files = `git ls-files`.split("\n")
|
21
|
+
spec.executables = `git ls-files -- exe/*`.split("\n").map do |f|
|
22
|
+
File.basename(f)
|
26
23
|
end
|
27
|
-
spec.bindir
|
28
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
24
|
+
spec.bindir = "exe"
|
29
25
|
spec.require_paths = ["lib"]
|
26
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
30
27
|
|
31
28
|
spec.add_dependency "yaml"
|
29
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
32
30
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Oscal::Catalog do
|
4
|
+
let(:subject) do
|
5
|
+
Oscal::Catalog.load_from_yaml(
|
6
|
+
"spec/oscal-content/examples/catalog/yaml/basic-catalog.yaml",
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "parses oscal-content YAML" do
|
11
|
+
expect(subject.class).to be Oscal::Catalog
|
12
|
+
expect(subject.groups.first.groups.first.controls.first.parts.first.prose).to eq(
|
13
|
+
"To establish a management framework to initiate and " \
|
14
|
+
"control the implementation and operation of information security " \
|
15
|
+
"within the organization.",
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "gets all controls" do
|
20
|
+
expect(subject.class).to be Oscal::Catalog
|
21
|
+
expect(subject.get_all_controls.count).to eq(4)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "find object by id" do
|
25
|
+
obj = subject.find_object_by_id("s2.1_smt")
|
26
|
+
expect(obj.to_s).to match(/Oscal::Part/)
|
27
|
+
expect(obj.prose).to eq(
|
28
|
+
"To limit access to information and information processing facilities.",
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "find object by uuid" do
|
33
|
+
uuid = "74c8ba1e-5cd4-4ad1-bbfd-d888e2f6c724"
|
34
|
+
obj = subject.find_object_by_id(
|
35
|
+
uuid, subject, :uuid
|
36
|
+
)
|
37
|
+
expect(obj.to_s).to match(/Oscal::Catalog/)
|
38
|
+
expect(obj.uuid).to eq(uuid)
|
39
|
+
end
|
40
|
+
end
|
data/spec/oscal_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "oscal"
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
# Enable flags like --only-failures and --next-failure
|
7
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
8
|
+
|
9
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
10
|
+
config.disable_monkey_patching!
|
11
|
+
|
12
|
+
config.expect_with :rspec do |c|
|
13
|
+
c.syntax = :expect
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oscal
|
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: 2024-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|
@@ -26,38 +26,112 @@ dependencies:
|
|
26
26
|
version: '0'
|
27
27
|
description: Ruby library and parser for OSCAL models
|
28
28
|
email:
|
29
|
-
-
|
30
|
-
executables:
|
29
|
+
- open.source@ribose.com
|
30
|
+
executables:
|
31
|
+
- convert2oscalyaml.rb
|
31
32
|
extensions: []
|
32
33
|
extra_rdoc_files: []
|
33
34
|
files:
|
35
|
+
- ".docker/Dockerfile"
|
36
|
+
- ".docker/Makefile"
|
37
|
+
- ".docker/docker-compose.yml"
|
38
|
+
- ".docker/readme.md"
|
39
|
+
- ".github/workflows/rake.yml"
|
40
|
+
- ".github/workflows/release.yml"
|
41
|
+
- ".gitignore"
|
42
|
+
- ".gitmodules"
|
43
|
+
- ".hound.yml"
|
34
44
|
- ".rspec"
|
45
|
+
- ".rubocop.yml"
|
46
|
+
- ".ruby-version"
|
35
47
|
- CODE_OF_CONDUCT.md
|
36
48
|
- Gemfile
|
49
|
+
- LICENSE
|
50
|
+
- Makefile
|
37
51
|
- README.adoc
|
38
52
|
- Rakefile
|
53
|
+
- bin/console
|
54
|
+
- bin/rspec
|
55
|
+
- bin/setup
|
56
|
+
- docker-compose.yml
|
57
|
+
- exe/convert2oscalyaml.rb
|
39
58
|
- lib/oscal.rb
|
59
|
+
- lib/oscal/add.rb
|
60
|
+
- lib/oscal/address.rb
|
61
|
+
- lib/oscal/address_line.rb
|
62
|
+
- lib/oscal/alter.rb
|
63
|
+
- lib/oscal/assembly.rb
|
64
|
+
- lib/oscal/assessment_plan.rb
|
65
|
+
- lib/oscal/assessment_result.rb
|
66
|
+
- lib/oscal/attribute_type_hash.rb
|
67
|
+
- lib/oscal/back_matter.rb
|
68
|
+
- lib/oscal/base64_object.rb
|
69
|
+
- lib/oscal/base_class.rb
|
40
70
|
- lib/oscal/catalog.rb
|
41
|
-
- lib/oscal/
|
71
|
+
- lib/oscal/choice.rb
|
72
|
+
- lib/oscal/citation.rb
|
73
|
+
- lib/oscal/combine.rb
|
74
|
+
- lib/oscal/common_utils.rb
|
75
|
+
- lib/oscal/constraint.rb
|
42
76
|
- lib/oscal/control.rb
|
77
|
+
- lib/oscal/custom.rb
|
78
|
+
- lib/oscal/datatypes.rb
|
79
|
+
- lib/oscal/document_id.rb
|
80
|
+
- lib/oscal/email_address.rb
|
81
|
+
- lib/oscal/exclude_control.rb
|
82
|
+
- lib/oscal/external_id.rb
|
43
83
|
- lib/oscal/group.rb
|
84
|
+
- lib/oscal/guideline.rb
|
85
|
+
- lib/oscal/hash_object.rb
|
86
|
+
- lib/oscal/import_object.rb
|
87
|
+
- lib/oscal/include_control.rb
|
88
|
+
- lib/oscal/insert_control.rb
|
89
|
+
- lib/oscal/link.rb
|
90
|
+
- lib/oscal/list.rb
|
91
|
+
- lib/oscal/location.rb
|
92
|
+
- lib/oscal/location_uuid.rb
|
93
|
+
- lib/oscal/logger.rb
|
94
|
+
- lib/oscal/matching.rb
|
95
|
+
- lib/oscal/member_of_organization.rb
|
96
|
+
- lib/oscal/merge.rb
|
44
97
|
- lib/oscal/metadata_block.rb
|
98
|
+
- lib/oscal/modify.rb
|
45
99
|
- lib/oscal/parameter.rb
|
100
|
+
- lib/oscal/parsing_functions.rb
|
46
101
|
- lib/oscal/part.rb
|
102
|
+
- lib/oscal/party.rb
|
103
|
+
- lib/oscal/party_uuid.rb
|
47
104
|
- lib/oscal/profile.rb
|
48
105
|
- lib/oscal/property.rb
|
49
|
-
- lib/oscal/
|
106
|
+
- lib/oscal/remove.rb
|
107
|
+
- lib/oscal/resource.rb
|
108
|
+
- lib/oscal/responsible_party.rb
|
109
|
+
- lib/oscal/revision.rb
|
110
|
+
- lib/oscal/rlink.rb
|
111
|
+
- lib/oscal/role.rb
|
112
|
+
- lib/oscal/select.rb
|
50
113
|
- lib/oscal/serializer.rb
|
51
|
-
- lib/oscal/
|
114
|
+
- lib/oscal/set_parameter.rb
|
115
|
+
- lib/oscal/telephone_number.rb
|
116
|
+
- lib/oscal/test.rb
|
117
|
+
- lib/oscal/url.rb
|
118
|
+
- lib/oscal/value.rb
|
52
119
|
- lib/oscal/version.rb
|
120
|
+
- lib/oscal/with_id.rb
|
53
121
|
- oscal.gemspec
|
54
122
|
- sig/oscal.rbs
|
123
|
+
- spec/oscal/catalog_spec.rb
|
124
|
+
- spec/oscal_spec.rb
|
125
|
+
- spec/sample_inputs/import-ap.json
|
126
|
+
- spec/spec_helper.rb
|
55
127
|
homepage: https://github.com/metanorma/oscal-ruby/
|
56
|
-
licenses:
|
128
|
+
licenses:
|
129
|
+
- BSD-2-Clause
|
57
130
|
metadata:
|
58
131
|
homepage_uri: https://github.com/metanorma/oscal-ruby/
|
59
132
|
source_code_uri: https://github.com/metanorma/oscal-ruby/
|
60
133
|
changelog_uri: https://github.com/metanorma/oscal-ruby/CHANGELOG
|
134
|
+
rubygems_mfa_required: 'true'
|
61
135
|
post_install_message:
|
62
136
|
rdoc_options: []
|
63
137
|
require_paths:
|
@@ -73,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
147
|
- !ruby/object:Gem::Version
|
74
148
|
version: '0'
|
75
149
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
150
|
+
rubygems_version: 3.4.10
|
77
151
|
signing_key:
|
78
152
|
specification_version: 4
|
79
153
|
summary: Interact with OSCAL models
|
data/lib/oscal/component.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module Oscal
|
2
|
-
class Component
|
3
|
-
attr_accessor :id, :name, :type, :description, :properties
|
4
|
-
|
5
|
-
def initialize(id, name, type, description, properties)
|
6
|
-
@id = id
|
7
|
-
@name = name
|
8
|
-
@type = type
|
9
|
-
@description = description
|
10
|
-
@properties = properties
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/lib/oscal/prose.rb
DELETED
data/lib/oscal/statement.rb
DELETED