Class: EnjuLeaf::QuickInstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/enju_leaf/quick_install/quick_install_generator.rb

Instance Method Summary collapse

Instance Method Details

#quick_installObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/enju_leaf/quick_install/quick_install_generator.rb', line 4

def quick_install
  environment = ENV['RAILS_ENV'] || 'development'
  gsub_file 'config/schedule.rb', /^set :environment, :development$/,
    "set :environment, :#{environment}"
  rake("enju_seed_engine:install:migrations")
  rake("enju_library_engine:install:migrations")
  rake("enju_biblio_engine:install:migrations")
  rake("enju_manifestation_viewer_engine:install:migrations")
  if !ENV['ENJU_SKIP_CONFIG']
    generate("enju_library:setup")
    generate("enju_biblio:setup")
    generate("enju_circulation:setup")
    generate("enju_subject:setup")
    generate("friendly_id")
  end
  gsub_file Dir.glob("#{Rails.root.to_s}/db/migrate/*_create_friendly_id_slugs.rb").first,
    /^class CreateFriendlyIdSlugs < ActiveRecord::Migration$/,
    'class CreateFriendlyIdSlugs < ActiveRecord::Migration[5.1]'
  rake("db:migrate", env: environment)
  rake("enju_leaf:setup", env: environment)
  rake("enju_circulation:setup", env: environment)
  rake("enju_subject:setup", env: environment)
  rake("assets:precompile", env: environment) if environment == 'production'
  rake("db:seed", env: environment)
  if !ENV['ENJU_SKIP_SOLR']
    if ENV['OS'] == 'Windows_NT'
      rake("sunspot:solr:run", env: environment)
    else
      rake("sunspot:solr:start", env: environment)
      sleep 5
      rake("environment sunspot:reindex", env: environment)
      rake("sunspot:solr:stop", env: environment)
    end
  end
end