Class: BotChallengePage::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_controller_mixinObject



16
17
18
# File 'lib/generators/bot_challenge_page/install_generator.rb', line 16

def add_controller_mixin
  inject_into_class "app/controllers/application_controller.rb", "ApplicationController", "  include BotChallengePage::Controller\n"
end

#copy_initializer_fileObject



20
21
22
# File 'lib/generators/bot_challenge_page/install_generator.rb', line 20

def copy_initializer_file
  template "initializer.rb.erb", "config/initializers/bot_challenge_page.rb"
end

#generate_routesObject



8
9
10
11
12
13
14
# File 'lib/generators/bot_challenge_page/install_generator.rb', line 8

def generate_routes
  route 'post "/challenge", to: "bot_challenge_page/bot_challenge_page#verify_challenge", as: :bot_detect_challenge'

  if options[:redirect_for_challenge]
    route 'get "/challenge", to: "bot_challenge_page/bot_challenge_page#challenge"'
  end
end