Class: Fetty::Generators::AuthenticationGenerator

Inherits:
Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/fetty/authentication/authentication_generator.rb

Instance Method Summary collapse

Methods inherited from Base

banner, source_root

Instance Method Details

#generate_authenticationObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/generators/fetty/authentication/authentication_generator.rb', line 13

def generate_authentication
  if options.destroy?
    destroy_authentication
  else
    unless using_fetty_authentication?
      @orm = using_mongoid? ? 'mongoid' : 'active_record'
      gem "bcrypt-ruby", :require => "bcrypt"
      generate_users
      generate_sessions
      generate_reset_passwords
      generate_mailers
      edit_application_controller
      must_load_lib_directory
      add_routes
      insert_links_on_layout
      generate_specs if using_rspec?
      print_notes "Make sure you have defined root_url in your 'config/routes.rb.'"
    else
      raise "You already have User model, please remove first!!"
    end
  end
rescue Exception => e
    print_notes(e.message,"error",:red)
end