Class: Georgia::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_default_indexerObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/generators/georgia/install/install_generator.rb', line 40

def add_default_indexer
  return if defined?(Sunspot)
  if !defined?(Tire)
    say("Adding Tire gem for Elasticsearch", :yellow)
    gem 'tire'
    Bundler.with_clean_env do
      run "bundle install"
    end
  end
  say("Creating elasticsearch indices", :yellow)
  rake "environment tire:import CLASS=Georgia::Page FORCE=true"
  rake "environment tire:import CLASS=Ckeditor::Asset FORCE=true"
  rake "environment tire:import CLASS=Ckeditor::Picture FORCE=true"
end

#copy_templatesObject



34
35
36
37
38
# File 'lib/generators/georgia/install/install_generator.rb', line 34

def copy_templates
  copy_file "config/initializers/georgia.rb"
  copy_file "config/initializers/carrierwave.example.rb"
  copy_file "app/controllers/pages_controller.rb"
end

#create_admin_userObject



29
30
31
32
# File 'lib/generators/georgia/install/install_generator.rb', line 29

def create_admin_user
  say("You're almost done. You need an admin user to get started.", :yellow)
  rake "georgia:seed"
end

#mount_engineObject



15
16
17
18
19
20
21
22
# File 'lib/generators/georgia/install/install_generator.rb', line 15

def mount_engine
  # Must be in reverse order to keep priorities
  route "get '*request_path', to: 'pages#show', as: :page"
  route "root to: 'pages#show', request_path: 'home'"
  route "resources :messages, only: [:create]"
  route "mount Ckeditor::Engine => '/ckeditor'"
  route "mount Georgia::Engine => '/admin'"
end

#run_migrationsObject



24
25
26
27
# File 'lib/generators/georgia/install/install_generator.rb', line 24

def run_migrations
  rake "railties:install:migrations"
  rake "db:migrate"
end

#show_readmeObject



55
56
57
# File 'lib/generators/georgia/install/install_generator.rb', line 55

def show_readme
  readme "README"
end