Class: DeployRubygem::InspecTestor
- Inherits:
-
Object
- Object
- DeployRubygem::InspecTestor
- Defined in:
- lib/deploy_rubygem/inspectestor.rb
Overview
Using Inspec to deploy and manage Inspec
Instance Attribute Summary collapse
-
#input_file ⇒ Object
readonly
Returns the value of attribute input_file.
-
#inspec_path ⇒ Object
readonly
Returns the value of attribute inspec_path.
-
#waiver_file ⇒ Object
readonly
Returns the value of attribute waiver_file.
Instance Method Summary collapse
- #apply ⇒ Object
- #clean ⇒ Object
-
#initialize(inspec_path, input_file = nil, waiver_file = nil) ⇒ InspecTestor
constructor
A new instance of InspecTestor.
- #inspec_name ⇒ Object
- #save_as_html(html_file) ⇒ Object
- #test_json ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(inspec_path, input_file = nil, waiver_file = nil) ⇒ InspecTestor
Returns a new instance of InspecTestor.
14 15 16 17 18 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 14 def initialize(inspec_path, input_file = nil, waiver_file = nil) @inspec_path = inspec_path @input_file = input_file @waiver_file = waiver_file end |
Instance Attribute Details
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
12 13 14 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 12 def input_file @input_file end |
#inspec_path ⇒ Object (readonly)
Returns the value of attribute inspec_path.
12 13 14 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 12 def inspec_path @inspec_path end |
#waiver_file ⇒ Object (readonly)
Returns the value of attribute waiver_file.
12 13 14 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 12 def waiver_file @waiver_file end |
Instance Method Details
#apply ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 24 def apply puts "ActuaL Dir #{Dir.pwd}" puts "inspec_name = #{inspec_name}" puts "input_file = #{input_file}" puts "waiver_file = #{waiver_file}" check system("chef exec inspec exec #{inspec_path} #{.join(' ')}") end |
#clean ⇒ Object
48 49 50 51 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 48 def clean FileUtils.rm_rf(vendor_folder) FileUtils.rm_f(lock_file) end |
#inspec_name ⇒ Object
20 21 22 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 20 def inspec_name File.basename(inspec_path) end |
#save_as_html(html_file) ⇒ Object
39 40 41 42 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 39 def save_as_html(html_file) check system("chef exec inspec exec #{inspec_path} #{.join(' ')} --reporter html:#{html_file}") end |
#test_json ⇒ Object
44 45 46 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 44 def test_json @test_json ||= InspecTestorResult.new(as_json) end |
#update ⇒ Object
34 35 36 37 |
# File 'lib/deploy_rubygem/inspectestor.rb', line 34 def update clean system("chef exec inspec vendor #{inspec_path} ") end |