Class: DeviseSecurityExtension::Generators::InstallGenerator

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

Overview

Install Generator

Instance Method Summary collapse

Instance Method Details

#add_configsObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/devise_security_extension/install_generator.rb', line 9

def add_configs
  inject_into_file "config/initializers/devise.rb", "\n  # ==> Security Extension\n  # Configure security extension for devise\n\n" +
  "  # Should the password expire (e.g 3.months)\n" +
  "  # config.expire_password_after = false\n\n" +
  "  # Need 1 char of A-Z, a-z and 0-9\n" +
  "  # config.password_regex = /(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])/\n\n" +
  "  # How often save old passwords in archive\n" +
  "  # config.password_archiving_count = 5\n\n" +
  "  # Deny old password (true, false, count)\n" +
  "  # config.deny_old_passwords = true" +
  "\n", :before => /end[ |\n|]+\Z/
end

#copy_localeObject



22
23
24
25
# File 'lib/generators/devise_security_extension/install_generator.rb', line 22

def copy_locale
  copy_file "../../../config/locales/en.yml", "config/locales/devise.security_extension.en.yml"
  copy_file "../../../config/locales/de.yml", "config/locales/devise.security_extension.de.yml"
end