Class: Integral::Generators::InstallGenerator

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

Overview

Runs setup for an Integral Application

Instance Method Summary collapse

Instance Method Details

#copy_initializer_filesObject

Copies over necessary initialiser files



10
11
12
13
# File 'lib/generators/integral/install_generator.rb', line 10

def copy_initializer_files
  copy_file 'integral.rb', 'config/initializers/integral.rb'
  copy_file 'sitemap.rb', 'config/sitemap.rb'
end

#copy_migrationsObject

Copy required migrations



26
27
28
29
30
# File 'lib/generators/integral/install_generator.rb', line 26

def copy_migrations
  rake 'integral:install:migrations'
  rake 'block_editor:install:migrations'
  rake 'active_storage:install'
end

#copy_routesObject

Copies routes file



16
17
18
# File 'lib/generators/integral/install_generator.rb', line 16

def copy_routes
  copy_file 'routes.rb', 'config/routes.rb'
end

#copy_seedingObject

Copies seeding file



21
22
23
# File 'lib/generators/integral/install_generator.rb', line 21

def copy_seeding
  copy_file 'seeds.rb', 'db/seeds.rb'
end

#install_messageObject

Output successful install message



40
41
42
43
44
45
46
47
48
49
# File 'lib/generators/integral/install_generator.rb', line 40

def install_message
  puts ' --------------------------------------------------------------------'
  puts '  Integral has successfully installed! '
  puts
  puts "  The admin backend is located at /#{Integral.backend_namespace}."
  puts
  puts "  User email     :  #{Integral::User.first.email}"
  puts '  User password     :  password'
  puts ' --------------------------------------------------------------------'
end

#setup_databaseObject

Create, migrate and run setup on database - setup is incase DB was already present



33
34
35
36
37
# File 'lib/generators/integral/install_generator.rb', line 33

def setup_database
  rake 'db:create'
  rake 'db:migrate'
  rake 'db:setup'
end