Class: BugReportsClient::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/bug_reports_client/install/install_generator.rb

Overview

Sets a host app up to use the engine:

bin/rails g bug_reports_client:install

Creates the initializer, mounts the engine, copies the default form schema (ready to customise) and an example issue template, then prints the remaining manual checklist.

Instance Method Summary collapse

Instance Method Details

#copy_form_schemaObject

The copied schema is identical to the engine default - editing it (or deleting it to fall back to the default) is the customisation point.



24
25
26
# File 'lib/generators/bug_reports_client/install/install_generator.rb', line 24

def copy_form_schema
  copy_file BugReportsClient::Engine.root.join("config/form_schema.yml"), "config/bug_report_form.yml"
end

#copy_issue_template_exampleObject

Copied with an .example suffix because the presence of config/bug_report_issue.md switches issue rendering to template mode.



30
31
32
# File 'lib/generators/bug_reports_client/install/install_generator.rb', line 30

def copy_issue_template_example
  copy_file "bug_report_issue.md.example", "config/bug_report_issue.md.example"
end

#create_initializerObject



14
15
16
# File 'lib/generators/bug_reports_client/install/install_generator.rb', line 14

def create_initializer
  template "initializer.rb", "config/initializers/bug_reports_client.rb"
end

#mount_engineObject



18
19
20
# File 'lib/generators/bug_reports_client/install/install_generator.rb', line 18

def mount_engine
  route 'mount BugReportsClient::Engine => "/bug_reports"'
end


34
35
36
# File 'lib/generators/bug_reports_client/install/install_generator.rb', line 34

def print_checklist
  readme "AFTER_INSTALL" if behavior == :invoke
end