Class: RailsAppGenerator::AddOns::Devise

Inherits:
RailsAppGenerator::Addon show all
Defined in:
lib/rails_app_generator/addons/devise.rb

Overview

Add Devise to rails application

Instance Attribute Summary

Attributes inherited from RailsAppGenerator::Addon

#context, #dependencies, #gem_entries

Instance Method Summary collapse

Methods inherited from RailsAppGenerator::Addon

addon_name, dependencies, depends_on, gem, gem_entries, #initialize, required_gem, reset_gem_entries

Constructor Details

This class inherits a constructor from RailsAppGenerator::Addon

Instance Method Details

#applyObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rails_app_generator/addons/devise.rb', line 12

def apply
  bundle_install

  generate('devise:install', capture: true)

  setup_db

  add_trackable       if option?(:devise_has_trackable)
  add_confirmable     if option?(:devise_has_confirmable)
  add_lockable        if option?(:devise_has_lockable)

  add_turbo_support

  generate('devise:views', capture: true)
  generate('devise:controllers', 'users', capture: true)

  update_routes_with_devise_controllers

  copy_file('app/controllers/users/registrations_controller.rb', 'app/controllers/users/registrations_controller.rb', force: true)

  enable_devise_mailer

  directory('app/views', force: true)
end

#before_bundleObject



37
38
39
# File 'lib/rails_app_generator/addons/devise.rb', line 37

def before_bundle
  prepend_to_file 'db/seeds.rb', seed, force: true
end