Class: Solidus::Auth::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_migrationsObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/solidus/auth/install/install_generator.rb', line 20

def add_migrations
  admin_email = options[:admin_email] || (options[:interactive] && ask("Email:", default: '[email protected]'))
  admin_password = options[:admin_password] || (options[:interactive] && ask("Password:", default: 'test123'))

  options = []
  options << "ADMIN_EMAIL=#{admin_email}" if admin_email
  options << "ADMIN_PASSWORD=#{admin_password}" if admin_password

  rake "railties:install:migrations FROM=solidus_auth #{options.shelljoin}"
end

#generate_devise_keyObject



16
17
18
# File 'lib/generators/solidus/auth/install/install_generator.rb', line 16

def generate_devise_key
  template 'config/initializers/devise.rb', 'config/initializers/devise.rb', skip: true
end

#run_migrationsObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/solidus/auth/install/install_generator.rb', line 31

def run_migrations
  if options[:skip_migrations] ||
    options[:auto_run_migrations] == false || # exclude nil
    options[:interactive] && no?('Would you like to run the migrations now?')

    say_status :skip, 'Skipping rake db:migrate, don\'t forget to run it!', :yellow
  else
    rake 'db:migrate'
  end
end