4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/inspec/feature/runner.rb', line 4
def self.with_feature(feature_name, opts = {}, &feature_implementation)
config = opts[:config] || Inspec::Feature::Config.new
logger = opts[:logger] || Inspec::Log
logger.debug("Prepping to run feature '#{feature_name}'")
feature = config[feature_name]
unless feature
user_plugins = Inspec::Plugin::V2::Registry.instance.plugin_statuses.select { |status| status.installation_type == :user_gem }
user_plugin_names = user_plugins.collect { |a| a.name.to_s }
logger.warn "Unrecognized feature name '#{feature_name}'" unless user_plugin_names.include?(feature_name)
end
if feature.nil? || feature&.no_preview? || feature&.previewable?
yield feature_implementation
end
end
|