Class: Bible270::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Bible270::Generators::InstallGenerator
- Defined in:
- lib/generators/bible270/install/install_generator.rb
Overview
rails generate bible270:install [--mount-at=/reading-plan] [--providers=github]
Writes the engine initializer and an OmniAuth initializer whose path_prefix matches the mount point (the one detail that is easy to get wrong).
Instance Method Summary collapse
Instance Method Details
#add_route ⇒ Object
23 24 25 26 |
# File 'lib/generators/bible270/install/install_generator.rb', line 23 def add_route # Driven by config.mount_at so the path is defined in exactly one place. route "mount Bible270::Engine, at: Bible270.config.mount_at" end |
#create_initializers ⇒ Object
18 19 20 21 |
# File 'lib/generators/bible270/install/install_generator.rb', line 18 def create_initializers template "bible270.rb.tt", "config/initializers/bible270.rb" template "omniauth.rb.tt", "config/initializers/omniauth.rb" end |
#show_next_steps ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/generators/bible270/install/install_generator.rb', line 28 def show_next_steps say "" say "bible270 installed.", :green say "" say "Next steps:" say " 1. Add the strategy gems to your Gemfile, e.g.:" provider_list.each { |p| say " gem \"omniauth-#{p.tr('_', '-')}\"" } say " plus: gem \"omniauth\" and gem \"omniauth-rails_csrf_protection\"" say " 2. bundle install" say " 3. bin/rails bible270:install:migrations && bin/rails db:migrate" say " 4. Set the provider credentials in your environment / credentials store." say " 5. Set config.mailer_from and make sure Action Mailer can deliver" say " (email sign-in is what lets readers without a social account join)." say " 6. Register the callback URL with each provider:" provider_list.each { |p| say " https://YOUR-HOST#{mount_at}/auth/#{p}/callback" } say "" end |