Class: Krikri::Install

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

Instance Method Summary collapse

Instance Method Details

#configure_jettyObject

Add jetty configuration


30
31
32
# File 'lib/generators/krikri/install_generator.rb', line 30

def configure_jetty
  copy_file '../../../../config/jetty.yml', 'config/jetty.yml'
end

#configure_solrObject

Add solr configuration


23
24
25
26
# File 'lib/generators/krikri/install_generator.rb', line 23

def configure_solr
  copy_file 'schema.xml', 'solr_conf/schema.xml', :force => true
  copy_file 'solrconfig.xml', 'solr_conf/solrconfig.xml', :force => true
end

#copy_krikri_controllersObject

Copy controllers from KriKri :force => true prevents user from having to manually accept overwrite for files that are generated elsewhere.


65
66
67
68
69
70
# File 'lib/generators/krikri/install_generator.rb', line 65

def copy_krikri_controllers
  copy_file "application_controller.rb",
    "app/controllers/application_controller.rb", :force => true
  copy_file "catalog_controller.rb",
    "app/controllers/catalog_controller.rb", :force => true
end

#inject_krikri_routesObject

Add the krikri routes This will add routes at with the krikri namespace in the name For example:

/krikri/institutions

TODO: Add a default route: # route 'root :to => “krikri/records#index”'


57
58
59
# File 'lib/generators/krikri/install_generator.rb', line 57

def inject_krikri_routes
  route "mount Krikri::Engine => '/krikri'"
end

#insert_development_dependenciesObject

Add factory girl dependency for development FactoryGirl is used to generate sample data jettywrapper is used to spin up Jetty running Solr and Marmotta This must execute before run_required_generators


15
16
17
18
19
# File 'lib/generators/krikri/install_generator.rb', line 15

def insert_development_dependencies
  gem 'factory_girl_rails', group: :development, version: '~> 4.4.0'
  gem 'jettywrapper', group: :development, version: '~> 2.0'
  gem 'pry-rails', group: :development
end

#install_devise_dependencyObject

Install Devise Devise is a dependency, and is specified in krikri.gemspec, but it requires some setup if it's generated into a development environment.


39
40
41
42
43
44
# File 'lib/generators/krikri/install_generator.rb', line 39

def install_devise_dependency
  gem 'devise', version: '~> 3.4.1'
  generate "devise:install"
  generate "devise User"
  rake("db:migrate")
end

#run_required_generatorsObject


46
47
48
# File 'lib/generators/krikri/install_generator.rb', line 46

def run_required_generators
  generate "blacklight:install"
end