Class: Rodauth::Rails::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Rodauth::Rails::Generators::InstallGenerator
- Defined in:
- lib/generators/rodauth/install_generator.rb
Constant Summary collapse
- SEQUEL_ADAPTERS =
{ "postgresql" => RUBY_ENGINE == "jruby" ? "postgresql" : "postgres", "mysql2" => RUBY_ENGINE == "jruby" ? "mysql" : "mysql2", "sqlite3" => "sqlite", "oracle_enhanced" => "oracle", "sqlserver" => RUBY_ENGINE == "jruby" ? "mssql" : "tinytds", }
- MAILER_VIEWS =
%w[ email_auth password_changed reset_password unlock_account verify_account verify_login_change ]
Instance Method Summary collapse
- #create_account_model ⇒ Object
- #create_fixtures ⇒ Object
- #create_mailer ⇒ Object
- #create_rodauth_app ⇒ Object
- #create_rodauth_controller ⇒ Object
- #create_rodauth_initializer ⇒ Object
- #generate_rodauth_migration ⇒ Object
- #show_instructions ⇒ Object
Instance Method Details
#create_account_model ⇒ Object
54 55 56 |
# File 'lib/generators/rodauth/install_generator.rb', line 54 def create_account_model template "app/models/account.rb", "app/models/#{table_prefix}.rb" end |
#create_fixtures ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/generators/rodauth/install_generator.rb', line 68 def create_fixtures = ::Rails.configuration.generators. if [:test_unit][:fixture] && [:test_unit][:fixture_replacement].nil? test_dir = [:rails][:test_framework] == :rspec ? "spec" : "test" template "test/fixtures/accounts.yml", "#{test_dir}/fixtures/#{table_prefix.pluralize}.yml" end end |
#create_mailer ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/generators/rodauth/install_generator.rb', line 58 def create_mailer return unless defined?(ActionMailer) template "app/mailers/rodauth_mailer.rb" MAILER_VIEWS.each do |view| copy_file "app/views/rodauth_mailer/#{view}.text.erb" end end |
#create_rodauth_app ⇒ Object
45 46 47 48 |
# File 'lib/generators/rodauth/install_generator.rb', line 45 def create_rodauth_app template "app/misc/rodauth_app.rb" template "app/misc/rodauth_main.rb" end |
#create_rodauth_controller ⇒ Object
50 51 52 |
# File 'lib/generators/rodauth/install_generator.rb', line 50 def create_rodauth_controller template "app/controllers/rodauth_controller.rb" end |
#create_rodauth_initializer ⇒ Object
41 42 43 |
# File 'lib/generators/rodauth/install_generator.rb', line 41 def create_rodauth_initializer template "config/initializers/rodauth.rb" end |
#generate_rodauth_migration ⇒ Object
35 36 37 38 39 |
# File 'lib/generators/rodauth/install_generator.rb', line 35 def generate_rodauth_migration invoke "rodauth:migration", migration_features, name: "create_rodauth", prefix: table_prefix end |
#show_instructions ⇒ Object
76 77 78 |
# File 'lib/generators/rodauth/install_generator.rb', line 76 def show_instructions readme "INSTRUCTIONS" if behavior == :invoke end |