Class: Warclight::Install

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

Overview

Warclight install generator

Direct Known Subclasses

Update

Instance Method Summary collapse

Instance Method Details

#add_custom_routesObject



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

def add_custom_routes
  inject_into_file 'config/routes.rb', after: "mount Blacklight::Engine => '/'" do
    "\n    mount Warclight::Engine => '/'\n"
  end
end

#add_warclight_search_behaviorObject



41
42
43
44
45
# File 'lib/generators/warclight/install_generator.rb', line 41

def add_warclight_search_behavior
  inject_into_file 'app/models/search_builder.rb', after: 'include Blacklight::Solr::SearchBuilderBehavior' do
    "\n  include Warclight::SearchBehavior"
  end
end

#assetsObject



32
33
34
35
36
37
38
39
# File 'lib/generators/warclight/install_generator.rb', line 32

def assets
  copy_file 'warclight.scss', 'app/assets/stylesheets/warclight.scss'
  copy_file 'warclight.js', 'app/assets/javascripts/warclight.js'
  inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do
    "\n//= require bootstrap/scrollspy\n" \
    "\n//= require bootstrap/tab\n"
  end
end

#create_blacklight_catalogObject



11
12
13
14
# File 'lib/generators/warclight/install_generator.rb', line 11

def create_blacklight_catalog
  remove_file 'app/controllers/catalog_controller.rb'
  copy_file 'catalog_controller.rb', 'app/controllers/catalog_controller.rb'
end

#include_warclight_solrdocumentObject



16
17
18
19
20
# File 'lib/generators/warclight/install_generator.rb', line 16

def include_warclight_solrdocument
  inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do
    "\n include Warclight::SolrDocument"
  end
end

#install_blacklight_range_limitObject



22
23
24
# File 'lib/generators/warclight/install_generator.rb', line 22

def install_blacklight_range_limit
  generate 'blacklight_range_limit:install'
end

#modify_blacklight_ymlObject



51
52
53
# File 'lib/generators/warclight/install_generator.rb', line 51

def modify_blacklight_yml
  gsub_file 'config/locales/blacklight.en.yml', "application_name: 'Blacklight'", "application_name: 'Warclight'"
end

#solr_configObject



47
48
49
# File 'lib/generators/warclight/install_generator.rb', line 47

def solr_config
  directory '../../../../solr', 'solr', force: true
end