Class: Testimonials::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Testimonials::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration, MigrationHelpers
- Defined in:
- lib/generators/testimonials/install/install_generator.rb
Instance Method Summary collapse
- #create_initializer ⇒ Object
- #create_migration_file ⇒ Object
- #mount_engine ⇒ Object
- #post_install ⇒ Object
Instance Method Details
#create_initializer ⇒ Object
33 34 35 |
# File 'lib/generators/testimonials/install/install_generator.rb', line 33 def create_initializer template 'initializer.rb.tt', 'config/initializers/testimonials.rb' end |
#create_migration_file ⇒ Object
37 38 39 40 |
# File 'lib/generators/testimonials/install/install_generator.rb', line 37 def create_migration_file migration_template 'create_testimonials_tables.rb.tt', 'db/migrate/create_testimonials_tables.rb' end |
#mount_engine ⇒ Object
42 43 44 |
# File 'lib/generators/testimonials/install/install_generator.rb', line 42 def mount_engine route %(mount_testimonials at: "/testimonials") end |
#post_install ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/generators/testimonials/install/install_generator.rb', line 46 def post_install say "\ntestimonials installed. Run `rails db:migrate`, then add", :green say '`<%= testimonials_tag %>` before </body> in your layout.' say 'Triage testimonials at /testimonials (development only until you set config.authorize_admin).' samples = [:skip_nps] ? 'testimonials' : 'testimonials and NPS' say "Optional: run `bin/rails testimonials:seed_demo` for sample #{samples}." say "Collect from outside the app via /testimonials/new.\n" if [:skip_nps] say 'Installed without NPS. Add it later with `bin/rails generate testimonials:nps`.', :yellow end return unless [:skip_prompt_events] say 'Installed without prompt history, so testimonial_prompt! will not auto-open the ' \ 'widget — open it from your own button. Add it later with ' \ '`bin/rails generate testimonials:prompt_events`.', :yellow end |