Class: Retrospec::Puppet::Generators::AcceptanceGenerator
- Inherits:
-
ResourceBaseGenerator
- Object
- Retrospec::Plugins::V1::Plugin
- BaseGenerator
- ResourceBaseGenerator
- Retrospec::Puppet::Generators::AcceptanceGenerator
- Defined in:
- lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb
Instance Attribute Summary
Attributes inherited from BaseGenerator
#context, #generator_template_dir_name, #plural_name, #singular_name, #template_dir
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(module_path, spec_object = {}) ⇒ AcceptanceGenerator
constructor
retrospec will initilalize this class so its up to you to set any additional variables you need to get the job done.
- #spec_path ⇒ Object
- #spec_template_file ⇒ Object
Methods inherited from ResourceBaseGenerator
#ast, #dumper, #find_all_resources, #generate_content, #generate_spec_file, #item_path, #item_spec_path, #lib_path, #load_context_data, #manifest_body, #manifest_file, manifest_files, #parameters, #plural_name, #resource_type, #resource_type_name, #resources, #run, run_cli, #singular_name, #type_name
Methods inherited from BaseGenerator
#generate_file_name, #generate_lib_files, #generate_path, #generate_spec_files, #get_binding, #item_name, #item_path, #item_spec_path, #lib_path, #logger, #run, run_cli
Constructor Details
#initialize(module_path, spec_object = {}) ⇒ AcceptanceGenerator
retrospec will initilalize this class so its up to you to set any additional variables you need to get the job done.
12 13 14 15 16 |
# File 'lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb', line 12 def initialize(module_path, spec_object = {}) super @singular_name = 'acceptance' @plural_name = 'acceptance' end |
Class Method Details
.generate_spec_files(module_path, config_data) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb', line 37 def self.generate_spec_files(module_path, config_data) files = [] manifest_files(module_path).each do |file| acceptance = new(module_path, config_data.merge({:manifest_file => file})) next unless supported_types.include?(acceptance.resource_type) files << acceptance.generate_spec_file end files end |
.supported_types ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb', line 26 def self.supported_types unless @supported_types @supported_types = [ ::Puppet::Pops::Model::HostClassDefinition, ::Puppet::Pops::Model::ResourceTypeDefinition ] end @supported_types end |
Instance Method Details
#spec_path ⇒ Object
22 23 24 |
# File 'lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb', line 22 def spec_path File.join(module_path, 'spec', plural_name, 'classes') end |
#spec_template_file ⇒ Object
18 19 20 |
# File 'lib/retrospec/plugins/v1/plugin/generators/acceptance_generator.rb', line 18 def spec_template_file File.join('acceptance_spec_test.rb.retrospec.erb') end |