Class: Solidstats::Generators::InstallGenerator

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

Overview

This generator installs Solidstats routes in the host application

This will:

  1. Add the Solidstats routes to the host application’s config/routes.rb

  2. Show a helpful README with next steps

Examples:

$ rails generate solidstats:install

Instance Method Summary collapse

Instance Method Details

#add_routesObject



17
18
19
20
21
22
23
24
25
# File 'lib/generators/solidstats/install/install_generator.rb', line 17

def add_routes
  route_code = <<-RUBY
  # Solidstats Routes (development only)
  mount Solidstats::Engine => "/solidstats" if Rails.env.development?
  RUBY

  route route_code
  say_status :routes, "Mounting Solidstats engine at /solidstats (development environment only)", :green
end

#show_readmeObject



27
28
29
# File 'lib/generators/solidstats/install/install_generator.rb', line 27

def show_readme
  readme "README" if behavior == :invoke
end