Module: Inspec::DSL
- Defined in:
- lib/inspec/dsl.rb
Overview
copyright: 2015, Dominik Richter license: All rights reserved author: Dominik Richter author: Christoph Hartmann
Class Method Summary collapse
-
.execute_rule(r, profile_id) ⇒ Object
Register a given rule with RSpec and let it run.
Instance Method Summary collapse
- #include_controls(id, &block) ⇒ Object (also: #include_rules)
- #require_controls(id, &block) ⇒ Object (also: #require_rules)
Class Method Details
.execute_rule(r, profile_id) ⇒ Object
Register a given rule with RSpec and let it run. This happens after everything else is merged in.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/inspec/dsl.rb', line 22 def self.execute_rule(r, profile_id) checks = r.instance_variable_get(:@checks) fid = InspecBaseRule.full_id(r, profile_id) checks.each do |m, a, b| # check if the resource is skippable and skipped if a.is_a?(Array) && !a.empty? && a[0].respond_to?(:resource_skipped) && !a[0].resource_skipped.nil? cres = ::Inspec::Rule.__send__(m, *a) do it a[0].resource_skipped end else # execute the method cres = ::Inspec::Rule.__send__(m, *a, &b) end if m == 'describe' set_rspec_ids(cres, fid) end end end |
Instance Method Details
#include_controls(id, &block) ⇒ Object Also known as: include_rules
12 13 14 |
# File 'lib/inspec/dsl.rb', line 12 def include_controls(id, &block) ::Inspec::DSL.load_spec_files_for_profile self, id, true, &block end |
#require_controls(id, &block) ⇒ Object Also known as: require_rules
8 9 10 |
# File 'lib/inspec/dsl.rb', line 8 def require_controls(id, &block) ::Inspec::DSL.load_spec_files_for_profile self, id, false, &block end |