# File lib/foreman_maintain/concerns/metadata.rb, line 107 def self.eval_dsl(metadata, &block) new(metadata).tap do |dsl| dsl.instance_eval(&block) end.data end
# File lib/foreman_maintain/concerns/metadata.rb, line 15 def initialize(data = {}) @data = data end
# File lib/foreman_maintain/concerns/metadata.rb, line 99 def advanced_run(advanced_run) @data[:advanced_run] = advanced_run end
# File lib/foreman_maintain/concerns/metadata.rb, line 40 def after(*step_labels) @data[:after].concat(step_labels) end
# File lib/foreman_maintain/concerns/metadata.rb, line 35 def before(*step_labels) raise Error::MultipleBeforeDetected, step_labels if step_labels.count > 1 @data[:before].concat(step_labels) end
# File lib/foreman_maintain/concerns/metadata.rb, line 31 def confine(&block) @data[:confine_blocks] << block end
# File lib/foreman_maintain/concerns/metadata.rb, line 27 def description(description) @data[:description] = description end
# File lib/foreman_maintain/concerns/metadata.rb, line 103 def do_not_whitelist @data[:do_not_whitelist] = true end
Specify what feature the definition related to.
# File lib/foreman_maintain/concerns/metadata.rb, line 86 def for_feature(feature_label) @data[:for_feature] = feature_label confine do feature(feature_label) end end
# File lib/foreman_maintain/concerns/metadata.rb, line 19 def label(label) @data[:label] = label end
Mark the class as manual: this means the instance of class will not be initialized by detector to check the confine block to determine if it's valid on the system or not. The classes marked for manual detect need to be initialized in from other places (such as `additional_features` in Feature)
# File lib/foreman_maintain/concerns/metadata.rb, line 75 def manual_detection @data[:autodetect] = false end
Parametrize the definition.
+name+: Name (Symbol) of the attribute +description_or_options+: Description string or a Hash with options +options+: Hash with options (unless specified in +descriptions_or_options+) +&block+: block to be called when processing the data: can be used for validation and type-casing of the value: expected to return the value to be used
+:description+: String describing the parameter +:required+: true if required +:flag+: param is just a true/false value: not expecting other values
# File lib/foreman_maintain/concerns/metadata.rb, line 60 def param(name, descripiton_or_options = {}, options = {}, &block) case descripiton_or_options when String description = descripiton_or_options when Hash options = options.merge(descripiton_or_options) if descripiton_or_options.is_a?(Hash) end @data[:params][name] = Param.new(name, description, options, &block) end
in the block, define one or more preparation steps needed before executing this definition
# File lib/foreman_maintain/concerns/metadata.rb, line 81 def preparation_steps(&block) @data[:preparation_steps_blocks] << block end
Ensure to not run the step twice: expects the scenario to be persisted between runs to work properly
# File lib/foreman_maintain/concerns/metadata.rb, line 95 def run_once @data[:run_once] = true end