deploy_rubygem 0.60.17 → 0.60.19

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: 7297b217dc970f4c1c07c2820d1073420b8e31154b371551306bbed62d2893fa
4
- data.tar.gz: c4540e278101511b18e4eee740d9c646aa111ce4db0ca9ae3c15ba7bf792887e
3
+ metadata.gz: ee7c9d9e75a9bb9a640edffb6d267bb28385677078e28dfaca96cf17edba4a24
4
+ data.tar.gz: 103b0f1bd56705075451e8ce3f72759b25b5f5d60067ddc1bf93dbd31c0ca3a6
5
5
  SHA512:
6
- metadata.gz: 6ef147a37dcc8fbe818eefe67a06f582a38d8212cf388926cb63ebc2f3472938ee0af21eff8e2eab01219bd704106adf2858e21ce27945dcec5e2785610a34ab
7
- data.tar.gz: b0142f5b13de78cf70b403e650de62850758387f4959b02f3e9170a60aef2418e6205a678657ebf37a4521069fa19edc8375a2bf7ad2f732a21d05245562701a
6
+ metadata.gz: c5cbaf614cc2b00d6d22f514a818592d8f2201d2808d6adb6c6e142c1e98ff3dd2327275fc73bea627b2c565b83529f80e9d29eb6c50149d17b942e202eeda5a
7
+ data.tar.gz: d2f6ad82f811b76618d10d0af44f8109e3457f103ed41a6e8c48b1a419a130621c9db5f2356645f26ec03d5cef6ef8c306c7409e545745c7b2d8a30afba0bcbd
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative 'project'
4
4
  require_relative 'kitchen'
5
- require_relative 'inspec'
5
+ require_relative 'inspectestor'
6
6
  require_relative 'rubygem'
7
7
 
8
8
  # DeployRubygem - deploy a gem using rake
@@ -17,13 +17,13 @@ module DeployRubygem
17
17
  @profiles = cookbook_info[:compliance_profiles].map do |profile_name|
18
18
  input_file = File.join(%w[compliance inputs] + ["#{cookbook_name}.yml"])
19
19
  waiver_file = File.join(%w[compliance waivers] + ["#{cookbook_name}.yml"])
20
- Inspec.new(profile_name, input_file, waiver_file)
20
+ InspecTestor.new(profile_name, input_file, waiver_file)
21
21
  end
22
22
  @kitchens = cookbook_info[:kitchens].map do |kitchen_name|
23
23
  Kitchen.new(kitchen_name, self)
24
24
  end
25
25
  @execute_profiles = cookbook_info[:execute_profiles].map do |profile_name|
26
- Inspec.new(profile_name)
26
+ InspecTestor.new(profile_name)
27
27
  end
28
28
  end
29
29
 
@@ -1,18 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json'
4
+
3
5
  # DeployRubygem - deploy a gem using rake
4
6
  # Containing a class
5
7
  module DeployRubygem
6
8
  # Using Inspec to deploy and manage Inspec
7
- class Inspec
8
- attr_reader :inspec_name, :input_file, :waiver_file
9
+ class InspecTestor
10
+ attr_reader :inspec_path, :input_file, :waiver_file
9
11
 
10
- def initialize(inspec_name, input_file = nil, waiver_file = nil)
11
- @inspec_name = inspec_name
12
+ def initialize(inspec_path, input_file = nil, waiver_file = nil)
13
+ @inspec_path = inspec_path
12
14
  @input_file = input_file
13
15
  @waiver_file = waiver_file
14
16
  end
15
17
 
18
+ def inspect_name
19
+ File.basename(inspec_path)
20
+ end
21
+
16
22
  def inspec_options
17
23
  cmd_opt = []
18
24
 
@@ -29,7 +35,8 @@ module DeployRubygem
29
35
  end
30
36
 
31
37
  def check
32
- system("inspec check compliance/profiles/#{inspec_name}")
38
+ update
39
+ system("inspec check #{inspec_path}")
33
40
  end
34
41
 
35
42
  def apply
@@ -39,23 +46,24 @@ module DeployRubygem
39
46
  puts "waiver_file = #{waiver_file}"
40
47
 
41
48
  check
42
- system("inspec exec compliance/profiles/#{inspec_name} #{inspec_options.join(' ')}")
49
+ system("inspec exec #{inspec_path} #{inspec_options.join(' ')}")
43
50
  end
44
51
 
45
52
  def update
46
- system("rm -rf compliance/profiles/#{inspec_name}/vendor")
47
- system("rm compliance/profiles/#{inspec_name}/inspec.lock")
48
- system("inspec vendor compliance/profiles/#{inspec_name}")
53
+ system("rm -rf #{inspec_path}/vendor")
54
+ system("rm #{inspec_path}/inspec.lock")
55
+ system("inspec vendor #{inspec_path}")
49
56
  end
50
57
 
51
58
  def save_as_html(html_file)
52
59
  check
53
- system("inspec exec compliance/profiles/#{inspec_name} #{cmd_opt.join(' ')} --reporter html:#{html_file}")
60
+ system("inspec exec #{inspec_path} #{inspec_options.join(' ')} --reporter html:#{html_file}")
54
61
  end
55
62
 
56
63
  def as_json
57
64
  check
58
- `inspec exec compliance/profiles/#{inspec_name} #{cmd_opt.join(' ')} --reporter json")`
65
+ request_str = `inspec exec #{inspec_path} #{inspec_options.join(' ')} --reporter json`
66
+ JSON.parse(request_str)
59
67
  end
60
68
  end
61
69
  end
@@ -19,7 +19,7 @@ module DeployRubygem
19
19
  new_cookbook_option[:chefrepo_path] = chefrepo_path
20
20
  Cookbook.new(new_cookbook_option)
21
21
  end
22
- @compliance_profile = Inspec.new(project_options[:compliance_profile])
22
+ @compliance_profile = InspecTestor.new(project_options[:compliance_profile])
23
23
  end
24
24
 
25
25
  def project_name
@@ -95,5 +95,21 @@ module DeployRubygem
95
95
  end
96
96
  end
97
97
  end
98
+
99
+ def testing_inspec(inspec_path, input_file = nil, waiver_file = nil)
100
+ inspect_test = InspecTestor.new(inspec_path, input_file, waiver_file)
101
+ RSpec.describe "Testing #{inspect_test} at #{Dir.pwd}" do
102
+ it 'Should be a kind of Html' do
103
+ test_json = inspect_test.save_as_html('/tmp/html/deploy_rubygem_kind_of_html.html')
104
+ expect(test_json).not_to be nil
105
+ expect(test_json).to be true
106
+ end
107
+ it 'Should be a kind of Json' do
108
+ test_json = inspect_test.as_json
109
+ expect(test_json).not_to be nil
110
+ expect(test_json).to be_kind_of(Hash)
111
+ end
112
+ end
113
+ end
98
114
  end
99
115
  end
@@ -17,5 +17,5 @@ module DeployRubygem
17
17
  end
18
18
 
19
19
  # VERSION = new_deploy_rubygem.gvb_version.short_version
20
- VERSION = '0.60.17'
20
+ VERSION = '0.60.19'
21
21
  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.17
4
+ version: 0.60.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Provencher
@@ -138,7 +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.rb
141
+ - lib/deploy_rubygem/inspectestor.rb
142
142
  - lib/deploy_rubygem/kitchen.rb
143
143
  - lib/deploy_rubygem/project.rb
144
144
  - lib/deploy_rubygem/rspec.rb
metadata.gz.sig CHANGED
Binary file