Class: Rerout::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Rerout::Generators::InstallGenerator
- Defined in:
- lib/generators/rerout/install_generator.rb
Overview
‘rails generate rerout:install`
Drops a ‘config/initializers/rerout.rb` initializer and appends the webhook route to `config/routes.rb` so a fresh app is wired up in one command.
Instance Method Summary collapse
-
#add_webhook_route ⇒ void
Append the webhook receiver route to ‘config/routes.rb`.
-
#create_initializer ⇒ void
Copy the commented initializer into the host application.
-
#print_post_install ⇒ void
Print next steps.
Instance Method Details
#add_webhook_route ⇒ void
This method returns an undefined value.
Append the webhook receiver route to ‘config/routes.rb`.
28 29 30 31 32 |
# File 'lib/generators/rerout/install_generator.rb', line 28 def add_webhook_route route_line = "post '/rerout/webhooks', " \ "to: 'rerout/rails/webhook#receive', as: :rerout_webhook" route(route_line) end |
#create_initializer ⇒ void
This method returns an undefined value.
Copy the commented initializer into the host application.
21 22 23 |
# File 'lib/generators/rerout/install_generator.rb', line 21 def create_initializer template 'rerout.rb', 'config/initializers/rerout.rb' end |
#print_post_install ⇒ void
This method returns an undefined value.
Print next steps.
37 38 39 |
# File 'lib/generators/rerout/install_generator.rb', line 37 def print_post_install readme 'POST_INSTALL' if behavior == :invoke end |