Class: DeviseSafeguard::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- DeviseSafeguard::Generators::InstallGenerator
- Defined in:
- lib/generators/devise_safeguard/install_generator.rb
Overview
Install Generator
Instance Method Summary collapse
- #add_configs ⇒ Object
- #copy_assets ⇒ Object
- #copy_locale ⇒ Object
- #copy_views ⇒ Object
- #inject_assets_in_layout ⇒ Object
Instance Method Details
#add_configs ⇒ Object
12 13 14 15 16 17 |
# File 'lib/generators/devise_safeguard/install_generator.rb', line 12 def add_configs inject_into_file "config/initializers/devise.rb", "\n" + " # ==> Devise Safeguard Authentication Extension\n" + " # How long should the user's device be remembered for.\n" + " # config.safeguard_remember_device = 1.month\n\n", :before => /^end[\r\n]*$/ end |
#copy_assets ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/generators/devise_safeguard/install_generator.rb', line 32 def copy_assets if .sass? copy_file '../../../app/assets/stylesheets/devise_safeguard.sass', 'app/assets/stylesheets/devise_safeguard.sass' else copy_file '../../../app/assets/stylesheets/devise_safeguard.css', 'app/assets/stylesheets/devise_safeguard.css' end copy_file '../../../app/assets/images/logo_safeguard.png', 'app/assets/images/devise_logo_safeguard.png' end |
#copy_locale ⇒ Object
19 20 21 22 |
# File 'lib/generators/devise_safeguard/install_generator.rb', line 19 def copy_locale copy_file "../../../config/locales/pt-BR.yml", "config/locales/devise.safeguard.pt-BR.yml" copy_file "../../../config/locales/en.yml", "config/locales/devise.safeguard.en.yml" end |
#copy_views ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/generators/devise_safeguard/install_generator.rb', line 24 def copy_views if .haml? copy_file '../../../app/views/devise/verify_safeguard.html.haml', 'app/views/devise/devise_safeguard/verify_safeguard.html.haml' else copy_file '../../../app/views/devise/verify_safeguard.html.erb', 'app/views/devise/devise_safeguard/verify_safeguard.html.erb' end end |
#inject_assets_in_layout ⇒ Object
41 42 |
# File 'lib/generators/devise_safeguard/install_generator.rb', line 41 def inject_assets_in_layout end |