Class: Retrospec::Puppet::Generators::ReportGenerator
- Inherits:
-
BaseGenerator
- Object
- Retrospec::Plugins::V1::Plugin
- BaseGenerator
- Retrospec::Puppet::Generators::ReportGenerator
- Defined in:
- lib/retrospec/plugins/v1/plugin/generators/report_generator.rb
Instance Attribute Summary
Attributes inherited from BaseGenerator
#context, #generator_template_dir_name, #plural_name, #singular_name, #template_dir
Class Method Summary collapse
-
.run_cli(global_opts, args = ARGV) ⇒ Object
used to display subcommand options to the cli the global options are passed in for your usage http://optimist.rubyforge.org all options here are available in the config passed into config object returns the parameters.
Instance Method Summary collapse
- #generate_lib_files ⇒ Object
- #generate_spec_files ⇒ Object
-
#initialize(module_path, spec_object = {}) ⇒ ReportGenerator
constructor
retrospec will initilalize this class so its up to you to set any additional variables you need to get the job done.
- #run ⇒ Object
Methods inherited from BaseGenerator
#generate_file_name, #generate_path, #get_binding, #item_name, #item_path, #item_spec_path, #lib_path, #logger, #spec_path
Constructor Details
#initialize(module_path, spec_object = {}) ⇒ ReportGenerator
retrospec will initilalize this class so its up to you to set any additional variables you need to get the job done.
9 10 11 12 13 |
# 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 |
Class Method Details
.run_cli(global_opts, args = ARGV) ⇒ Object
used to display subcommand options to the cli the global options are passed in for your usage http://optimist.rubyforge.org all options here are available in the config passed into config object returns the parameters
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/retrospec/plugins/v1/plugin/generators/report_generator.rb', line 39 def self.run_cli(global_opts, args=ARGV) sub_command_opts = Optimist.(args) do "Creates a new puppet report\n EOS\n opt :name, \"The name of the report you wish to create\", :type => :string, :required => true, :short => '-n'\n end\n unless sub_command_opts[:name]\n Optimist.educate\n exit 1\n end\n plugin_data = global_opts.merge(sub_command_opts)\n plugin_data\nend\n" |
Instance Method Details
#generate_lib_files ⇒ Object
22 23 24 25 26 |
# 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 ⇒ Object
28 29 30 31 32 |
# 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 ⇒ Object
15 16 17 18 19 20 |
# 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 |