deploy_rubygem 0.60.19 → 0.60.20
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
- checksums.yaml.gz.sig +0 -0
- data/lib/deploy_rubygem/inspec_result.rb +67 -0
- data/lib/deploy_rubygem/inspectestor.rb +28 -20
- data/lib/deploy_rubygem/rspec.rb +14 -8
- data/lib/deploy_rubygem/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f61e704844f1f80fc9da968ad0e9ad34f2961f1c97f31c6ed329ffdd21d4a17
|
4
|
+
data.tar.gz: 7028f7729663bdff4748c01959c227865ef70fd506cc869bd0ef8e097c42a8fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a4e9293b7af8c0a4335aee4ba6aae09f5e8495da15055bebddd2187f9ba9fe620bb89f4b7ef3c46b16fd326d3cab518bced7ba096a8f96eb2aa0a8d35da3d88
|
7
|
+
data.tar.gz: 29678da2f8a7096a239fed59503ad356d3171778ce19db1a8994a66714ec4874b47a993ff804b02917f7eb2783376a97abff823debce4dd2c0789685c6d55dcd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# DeployRubygem - deploy a gem using rake
|
4
|
+
# Containing a class
|
5
|
+
module DeployRubygem
|
6
|
+
# Using Inspec to deploy and manage Inspec
|
7
|
+
class InspecTestorResult
|
8
|
+
attr_reader :success_control, :success_result, :failed_control, :failed_result, :pending_control, :pending_result
|
9
|
+
|
10
|
+
def initialize(as_json)
|
11
|
+
@as_json = as_json
|
12
|
+
@success_control = 0
|
13
|
+
@success_result = 0
|
14
|
+
@failed_control = 0
|
15
|
+
@failed_result = 0
|
16
|
+
@pending_control = 0
|
17
|
+
@pending_result = 0
|
18
|
+
results
|
19
|
+
end
|
20
|
+
|
21
|
+
def profile
|
22
|
+
@as_json['profiles'].first
|
23
|
+
end
|
24
|
+
|
25
|
+
def status
|
26
|
+
profile['status']
|
27
|
+
end
|
28
|
+
|
29
|
+
def controls
|
30
|
+
profile['controls']
|
31
|
+
end
|
32
|
+
|
33
|
+
def result_summary
|
34
|
+
{
|
35
|
+
success_control: success_control,
|
36
|
+
success_result: success_result,
|
37
|
+
failed_control: failed_control,
|
38
|
+
failed_result: failed_result,
|
39
|
+
pending_control: pending_control,
|
40
|
+
pending_result: pending_result
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def results
|
47
|
+
controls.each do |control_result|
|
48
|
+
control_as_fail = false
|
49
|
+
control_result['results'].each do |item_result|
|
50
|
+
case item_result['status']
|
51
|
+
when 'passed'
|
52
|
+
@success_result += 1
|
53
|
+
when 'failed'
|
54
|
+
@failed_result += 1
|
55
|
+
@failed_control += 1
|
56
|
+
control_as_fail = true
|
57
|
+
else
|
58
|
+
@pending_result += 1
|
59
|
+
@pending_control += 1
|
60
|
+
control_as_fail = true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
@success_control += 1 unless control_as_fail
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'json'
|
4
4
|
|
5
|
+
require_relative 'inspec_result'
|
6
|
+
|
5
7
|
# DeployRubygem - deploy a gem using rake
|
6
8
|
# Containing a class
|
7
9
|
module DeployRubygem
|
@@ -19,26 +21,6 @@ module DeployRubygem
|
|
19
21
|
File.basename(inspec_path)
|
20
22
|
end
|
21
23
|
|
22
|
-
def inspec_options
|
23
|
-
cmd_opt = []
|
24
|
-
|
25
|
-
unless input_file.nil?
|
26
|
-
cmd_opt << '--input-file'
|
27
|
-
cmd_opt << input_file
|
28
|
-
end
|
29
|
-
|
30
|
-
unless waiver_file.nil?
|
31
|
-
cmd_opt << '--waiver-file'
|
32
|
-
cmd_opt << waiver_file
|
33
|
-
end
|
34
|
-
cmd_opt
|
35
|
-
end
|
36
|
-
|
37
|
-
def check
|
38
|
-
update
|
39
|
-
system("inspec check #{inspec_path}")
|
40
|
-
end
|
41
|
-
|
42
24
|
def apply
|
43
25
|
puts "ActuaL Dir #{Dir.pwd}"
|
44
26
|
puts "inspec_name = #{inspec_name}"
|
@@ -60,6 +42,32 @@ module DeployRubygem
|
|
60
42
|
system("inspec exec #{inspec_path} #{inspec_options.join(' ')} --reporter html:#{html_file}")
|
61
43
|
end
|
62
44
|
|
45
|
+
def test_json
|
46
|
+
@test_json ||= InspecTestorResult.new(as_json)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def inspec_options
|
52
|
+
cmd_opt = []
|
53
|
+
|
54
|
+
unless input_file.nil?
|
55
|
+
cmd_opt << '--input-file'
|
56
|
+
cmd_opt << input_file
|
57
|
+
end
|
58
|
+
|
59
|
+
unless waiver_file.nil?
|
60
|
+
cmd_opt << '--waiver-file'
|
61
|
+
cmd_opt << waiver_file
|
62
|
+
end
|
63
|
+
cmd_opt
|
64
|
+
end
|
65
|
+
|
66
|
+
def check
|
67
|
+
update
|
68
|
+
system("inspec check #{inspec_path}")
|
69
|
+
end
|
70
|
+
|
63
71
|
def as_json
|
64
72
|
check
|
65
73
|
request_str = `inspec exec #{inspec_path} #{inspec_options.join(' ')} --reporter json`
|
data/lib/deploy_rubygem/rspec.rb
CHANGED
@@ -96,18 +96,24 @@ module DeployRubygem
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def testing_inspec(
|
100
|
-
inspect_test = InspecTestor.new(inspec_path, input_file, waiver_file)
|
99
|
+
def testing_inspec(inspector)
|
100
|
+
inspect_test = InspecTestor.new(inspector[:inspec_path], inspector[:input_file], inspector[:waiver_file])
|
101
101
|
RSpec.describe "Testing #{inspect_test} at #{Dir.pwd}" do
|
102
102
|
it 'Should be a kind of Html' do
|
103
|
-
|
104
|
-
expect(
|
105
|
-
expect(test_json).to be true
|
103
|
+
test_html = inspect_test.save_as_html('/tmp/html/deploy_rubygem_kind_of_html.html')
|
104
|
+
expect(test_html).to be true
|
106
105
|
end
|
107
106
|
it 'Should be a kind of Json' do
|
108
|
-
test_json
|
109
|
-
expect(test_json).
|
110
|
-
|
107
|
+
expect(inspect_test.test_json).to be_kind_of(InspecTestorResult)
|
108
|
+
expect(inspect_test.test_json.status).to eq 'loaded'
|
109
|
+
end
|
110
|
+
it 'Should be successfull' do
|
111
|
+
expect(inspect_test.test_json.success_result).to eq inspector[:success_result]
|
112
|
+
expect(inspect_test.test_json.success_control).to eq inspector[:success_control]
|
113
|
+
expect(inspect_test.test_json.failed_result).to eq inspector[:failed_result]
|
114
|
+
expect(inspect_test.test_json.failed_control).to eq inspector[:failed_control]
|
115
|
+
expect(inspect_test.test_json.pending_result).to eq inspector[:pending_result]
|
116
|
+
expect(inspect_test.test_json.pending_control).to eq inspector[:pending_control]
|
111
117
|
end
|
112
118
|
end
|
113
119
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy_rubygem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.60.
|
4
|
+
version: 0.60.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Provencher
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/deploy_rubygem.rb
|
139
139
|
- lib/deploy_rubygem/cookbook.rb
|
140
140
|
- lib/deploy_rubygem/deploy_rubygem_options.rb
|
141
|
+
- lib/deploy_rubygem/inspec_result.rb
|
141
142
|
- lib/deploy_rubygem/inspectestor.rb
|
142
143
|
- lib/deploy_rubygem/kitchen.rb
|
143
144
|
- lib/deploy_rubygem/project.rb
|
metadata.gz.sig
CHANGED
Binary file
|