class Retrospec::Puppet::Generators::ReportGenerator
Public Class Methods
new(module_path, spec_object = {})
click to toggle source
retrospec will initilalize this class so its up to you to set any additional variables you need to get the job done.
Calls superclass method
Retrospec::Puppet::Generators::BaseGenerator::new
# File lib/retrospec/plugins/v1/plugin/generators/report_generator.rb, line 9 def initialize(module_path, spec_object = {}) super @plural_name = 'reports' @singular_name = 'report' end
run_cli(global_opts, args=ARGV)
click to toggle source
used to display subcommand options to the cli the global options are passed in for your usage optimist.rubyforge.org all options here are available in the config passed into config object returns the parameters
# File lib/retrospec/plugins/v1/plugin/generators/report_generator.rb, line 39 def self.run_cli(global_opts, args=ARGV) sub_command_opts = Optimist.options(args) do banner <<-EOS Creates a new puppet report EOS opt :name, "The name of the report you wish to create", :type => :string, :required => true, :short => '-n' end unless sub_command_opts[:name] Optimist.educate exit 1 end plugin_data = global_opts.merge(sub_command_opts) plugin_data end
Public Instance Methods
generate_lib_files()
click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/report_generator.rb, line 22 def generate_lib_files template_file = File.join(template_dir, 'report.rb.retrospec.erb') safe_create_template_file(item_path, template_file, context) item_path end
generate_spec_files()
click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/report_generator.rb, line 28 def generate_spec_files template_file = File.join(template_dir, 'report_spec.rb.retrospec.erb') safe_create_template_file(item_spec_path, template_file, context) item_spec_path end
run()
click to toggle source
# File lib/retrospec/plugins/v1/plugin/generators/report_generator.rb, line 15 def run files = [] files << generate_lib_files files << generate_spec_files files end