compliance 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a2110ea9974434c5b79c50bc636450cf082c3c82342ff46fd5629679200f2c4
4
- data.tar.gz: bdaa976134de96fa62ed8c0ddec64eb5ce9c1ba34c85aa35559675346ba9ae23
3
+ metadata.gz: a8f7ad92baa85021ad2f6d1fc1f38fe8b0661cbcfdc1a186d57a786fe66314a0
4
+ data.tar.gz: e72c020cae731fe2d6352e0eb994417ff5cfafe98f016b0ac9b87ab3fd0fc235
5
5
  SHA512:
6
- metadata.gz: fd17d4f694c83c0f066b534e714b14fb490dd80dde7536a34944d149929ffb1b9521ae98111b69c979101f7c1ddd2095b0b131d9988a20beb84e428e2a0da8e6
7
- data.tar.gz: a9a41edfd6662fc2767fa0414d6218512543430f37758313040f281dc3f8e8bc9200bf7cc76cf6b3849b8fa0688fdae61bc9f85ff2413d75e7fe3c44db377b73
6
+ metadata.gz: d1e1049191d15e7ab231a33350099e5367ab4fd2a97028a86f39bd16586147c11272083020b9b754288736b3927a9a71555cd91c7e303afadaf1b01bb2a7c4f7
7
+ data.tar.gz: 03a598d1cf4378bf12d8c5469dd3421165d3c220a1261ee63219281325990df8b4ed270ab4005fbd98086e32d2a1c8a2135a8fe03a76623f9a517acef8260bd5
checksums.yaml.gz.sig CHANGED
Binary file
data/bake/compliance.rb CHANGED
@@ -3,6 +3,12 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2024, by Samuel Williams.
5
5
 
6
+ def initialize(...)
7
+ super
8
+
9
+ require 'compliance'
10
+ end
11
+
6
12
  def document
7
13
  document = Compliance::Document.new
8
14
 
@@ -21,15 +27,15 @@ def check(input:)
21
27
  policy = Compliance::Policy.new
22
28
  document = input || self.document
23
29
 
24
- unsatisfied = {}
30
+ failed_requirements = {}
25
31
 
26
32
  document.check(policy) do |requirement, satisfied, unsatisfied|
27
33
  Console.debug(self) {"Requirement #{requirement.id} is #{satisfied.any? ? "satisfied." : "not satisfied!"}"}
28
34
 
29
35
  if satisfied.empty?
30
- unsatisfied[requirement.id] = requirement
36
+ failed_requirements[requirement.id] = requirement
31
37
  end
32
38
  end
33
39
 
34
- raise Compliance::Error.new(unsatisfied) unless unsatisfied.empty?
40
+ raise Compliance::Error.new(failed_requirements) unless failed_requirements.empty?
35
41
  end
@@ -12,7 +12,7 @@ module Compliance
12
12
  # Load compliance data from JSON files.
13
13
  module Loader
14
14
  def self.add(compliance, document)
15
- compliance[:requirements].each do |metadata|
15
+ compliance[:requirements]&.each do |metadata|
16
16
  document.add_requirement(Requirement.new(metadata))
17
17
  end
18
18
 
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2024, by Samuel Williams.
5
5
 
6
6
  module Compliance
7
- VERSION = "0.0.1"
7
+ VERSION = "0.0.2"
8
8
  end
data/lib/compliance.rb CHANGED
@@ -7,3 +7,4 @@ require_relative 'compliance/version'
7
7
  require_relative 'compliance/document'
8
8
  require_relative 'compliance/loader'
9
9
  require_relative 'compliance/policy'
10
+ require_relative 'compliance/error'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compliance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file