oscal 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +11 -0
- data/.gitmodules +3 -0
- data/.hound.yml +5 -0
- data/.rubocop.yml +10 -0
- data/Gemfile +2 -0
- data/README.adoc +63 -0
- data/bin/console +30 -0
- data/bin/setup +8 -0
- data/exe/convert2oscalyaml.rb +560 -0
- data/lib/oscal/add.rb +25 -0
- data/lib/oscal/address.rb +21 -0
- data/lib/oscal/address_line.rb +10 -0
- data/lib/oscal/alter.rb +21 -0
- data/lib/oscal/back_matter.rb +19 -0
- data/lib/oscal/base64_object.rb +10 -0
- data/lib/oscal/base_class.rb +49 -0
- data/lib/oscal/catalog.rb +50 -10
- data/lib/oscal/choice.rb +10 -0
- data/lib/oscal/citation.rb +21 -0
- data/lib/oscal/combine.rb +10 -0
- data/lib/oscal/common_utils.rb +35 -0
- data/lib/oscal/constraint.rb +19 -0
- data/lib/oscal/control.rb +20 -31
- data/lib/oscal/custom.rb +21 -0
- data/lib/oscal/document_id.rb +10 -0
- data/lib/oscal/email_address.rb +10 -0
- data/lib/oscal/exclude_control.rb +21 -0
- data/lib/oscal/external_id.rb +10 -0
- data/lib/oscal/group.rb +26 -35
- data/lib/oscal/guideline.rb +10 -0
- data/lib/oscal/hash_object.rb +10 -0
- data/lib/oscal/import_object.rb +21 -0
- data/lib/oscal/include_control.rb +21 -0
- data/lib/oscal/insert_control.rb +21 -0
- data/lib/oscal/link.rb +10 -0
- data/lib/oscal/location.rb +30 -0
- data/lib/oscal/location_uuid.rb +10 -0
- data/lib/oscal/matching.rb +10 -0
- data/lib/oscal/member_of_organization.rb +10 -0
- data/lib/oscal/merge.rb +19 -0
- data/lib/oscal/metadata_block.rb +28 -14
- data/lib/oscal/modify.rb +21 -0
- data/lib/oscal/parameter.rb +22 -20
- data/lib/oscal/part.rb +13 -22
- data/lib/oscal/party.rb +35 -0
- data/lib/oscal/party_uuid.rb +10 -0
- data/lib/oscal/profile.rb +32 -7
- data/lib/oscal/property.rb +3 -25
- data/lib/oscal/remove.rb +10 -0
- data/lib/oscal/resource.rb +28 -0
- data/lib/oscal/responsible_party.rb +23 -0
- data/lib/oscal/revision.rb +22 -0
- data/lib/oscal/rlink.rb +19 -0
- data/lib/oscal/role.rb +21 -0
- data/lib/oscal/select.rb +19 -0
- data/lib/oscal/serializer.rb +17 -4
- data/lib/oscal/set_parameter.rb +30 -0
- data/lib/oscal/telephone_number.rb +10 -0
- data/lib/oscal/test.rb +10 -0
- data/lib/oscal/url.rb +10 -0
- data/lib/oscal/value.rb +36 -0
- data/lib/oscal/version.rb +1 -1
- data/lib/oscal/with_id.rb +39 -0
- data/lib/oscal.rb +1 -13
- data/oscal.gemspec +9 -11
- data/spec/oscal/catalog_spec.rb +39 -0
- data/spec/oscal_spec.rb +7 -0
- data/spec/spec_helper.rb +15 -0
- metadata +65 -9
- data/lib/oscal/component.rb +0 -14
- data/lib/oscal/prose.rb +0 -13
- data/lib/oscal/statement.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3d2839d5707adc52e720080828918e04373d2399cbd138edd403055b1712cc0
|
4
|
+
data.tar.gz: 0fc05ead23c4745d188f9bf359c2594463867fd1cce5256a271cf93befef287e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91233436e998fe98ae7d84873ac7d8b68f9fc84ec6f7a7775533ee45922beaeb507c031ed88da4fe0ed71f34e76064861e6e3b0cb340acac23d25b3134cc323f
|
7
|
+
data.tar.gz: 957a56d62c3c43b5d22f4659b993acbd6e85ad344fe042fda702a3e07dda5fed576caf6ad0b742eb783597ac0e1165020af957a8d6c9699b0aad977910a910aa
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: release
|
4
|
+
|
5
|
+
on:
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
next_version:
|
9
|
+
description: |
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
11
|
+
required: true
|
12
|
+
default: 'skip'
|
13
|
+
repository_dispatch:
|
14
|
+
types: [ do-release ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
release:
|
18
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
19
|
+
with:
|
20
|
+
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
secrets:
|
22
|
+
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
23
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
24
|
+
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,10 @@
|
|
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/master/ci/rubocop.yml
|
5
|
+
|
6
|
+
# local repo-specific modifications
|
7
|
+
# ...
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 2.5
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= OSCAL in Ruby
|
2
2
|
|
3
|
+
== Purpose
|
4
|
+
|
5
|
+
This is an implementation of the OSCAL models, allowing the manipulation of
|
6
|
+
these models, as well as reading and writing of OSCAL serialization formats
|
7
|
+
(YAML, JSON, XML).
|
8
|
+
|
9
|
+
NOTE: This gem is used by the
|
10
|
+
https://github.com/metanorma/metanorma-plugin-oscal[Metanorma plugin for OSCAL].
|
11
|
+
|
12
|
+
|
3
13
|
== Installation
|
4
14
|
|
5
15
|
Install the gem:
|
@@ -20,6 +30,59 @@ gem 'oscal'
|
|
20
30
|
|
21
31
|
TODO: Write usage instructions here
|
22
32
|
|
33
|
+
[source,ruby]
|
34
|
+
----
|
35
|
+
> require 'oscal'
|
36
|
+
> x = Oscal::Catalog.load_from_yaml('spec/oscal-content/examples/catalog/yaml/basic-catalog.yaml')
|
37
|
+
=>
|
38
|
+
#<Oscal::Catalog:0x000000010b817e08
|
39
|
+
...
|
40
|
+
> x.groups.first.groups.first.parts.first.prose
|
41
|
+
=> "To establish a management framework to initiate and control the implementation and operation of information security within the organization."
|
42
|
+
----
|
43
|
+
|
44
|
+
Get all controls
|
45
|
+
|
46
|
+
[source,ruby]
|
47
|
+
----
|
48
|
+
> require 'oscal'
|
49
|
+
> x = Oscal::Catalog.load_from_yaml('spec/oscal-content/examples/catalog/yaml/basic-catalog.yaml')
|
50
|
+
=>
|
51
|
+
#<Oscal::Catalog:0x000000010b817e08
|
52
|
+
...
|
53
|
+
> o = x.get_all_controls
|
54
|
+
> o.count
|
55
|
+
=> 4
|
56
|
+
----
|
57
|
+
|
58
|
+
Find object by id
|
59
|
+
|
60
|
+
[source,ruby]
|
61
|
+
----
|
62
|
+
> require 'oscal'
|
63
|
+
> x = Oscal::Catalog.load_from_yaml('spec/oscal-content/examples/catalog/yaml/basic-catalog.yaml')
|
64
|
+
=>
|
65
|
+
#<Oscal::Catalog:0x000000010b817e08
|
66
|
+
...
|
67
|
+
> p = x.find_object_by_id('s1.1_smt')
|
68
|
+
=>
|
69
|
+
#<Oscal::Part:0x000000014c0c4070 @id="s1.1_smt", ...>
|
70
|
+
----
|
71
|
+
|
72
|
+
Find object by uuid
|
73
|
+
|
74
|
+
[source,ruby]
|
75
|
+
----
|
76
|
+
> require 'oscal'
|
77
|
+
> x = Oscal::Catalog.load_from_yaml('spec/oscal-content/examples/catalog/yaml/basic-catalog.yaml')
|
78
|
+
=>
|
79
|
+
#<Oscal::Catalog:0x000000010b817e08
|
80
|
+
...
|
81
|
+
> p = x.find_object_by_id('74c8ba1e-5cd4-4ad1-bbfd-d888e2f6c724', x, :uuid)
|
82
|
+
=>
|
83
|
+
#<Oscal::Catalog:0x000000014c0c5f38 @uuid="74c8ba1e-5cd4-4ad1-bbfd-d888e2f6c724", ...>
|
84
|
+
----
|
85
|
+
|
23
86
|
== Ruby library usage
|
24
87
|
|
25
88
|
TODO: Write usage instructions here
|
data/bin/console
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "oscal"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
|
16
|
+
def reload!(print = true)
|
17
|
+
puts 'Reloading ...' if print
|
18
|
+
# Main project directory.
|
19
|
+
root_dir = File.expand_path('..', __dir__)
|
20
|
+
# Directories within the project that should be reloaded.
|
21
|
+
reload_dirs = %w{lib}
|
22
|
+
# Loop through and reload every file in all relevant project directories.
|
23
|
+
reload_dirs.each do |dir|
|
24
|
+
Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
|
25
|
+
end
|
26
|
+
# Return true when complete.
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
IRB.start(__FILE__)
|