Class: ExceptionHunter::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_initializerObject



10
11
12
13
14
# File 'lib/generators/exception_hunter/install/install_generator.rb', line 10

def copy_initializer
  @underscored_user_name = name.underscore.gsub('/', '_')
  @use_authentication_method = options[:users].present?
  template 'exception_hunter.rb.erb', 'config/initializers/exception_hunter.rb'
end

#create_migrationsObject



26
27
28
29
30
# File 'lib/generators/exception_hunter/install/install_generator.rb', line 26

def create_migrations
  migration_template 'create_exception_hunter_error_groups.rb.erb',
                     'db/migrate/create_exception_hunter_error_groups.rb'
  migration_template 'create_exception_hunter_errors.rb.erb', 'db/migrate/create_exception_hunter_errors.rb'
end

#setup_routesObject



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

def setup_routes
  if options[:users]
    gsub_file 'config/routes.rb',
              "\n  devise_for :#{plural_table_name}, skip: :all",
              "\n  ExceptionHunter.routes(self)"
  else
    route 'ExceptionHunter.routes(self)'
  end
end