Class: QaServer::Install
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- QaServer::Install
- Defined in:
- lib/generators/qa_server/install_generator.rb
Instance Method Summary collapse
- #add_to_gemfile ⇒ Object
- #banner ⇒ Object
- #create_location_for_charts ⇒ Object
- #inject_bootstrap ⇒ Object
-
#inject_routes ⇒ Object
The engine routes have to come after the devise routes so that /users/sign_in will work.
- #run_required_generators ⇒ Object
Instance Method Details
#add_to_gemfile ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/generators/qa_server/install_generator.rb', line 23 def add_to_gemfile say_status('info', ' -- adding qa_server required gems', :blue) gem 'qa', github: 'samvera/questioning_authority', tag: '496aaa34c4aba6d97d11737b229ea66ea4c64639' gem 'linkeddata' Bundler.with_clean_env do run "bundle install" end end |
#banner ⇒ Object
13 14 15 |
# File 'lib/generators/qa_server/install_generator.rb', line 13 def say_status('info', 'INSTALLING QA_SERVER', :blue) end |
#create_location_for_charts ⇒ Object
61 62 63 64 |
# File 'lib/generators/qa_server/install_generator.rb', line 61 def create_location_for_charts say_status('info', ' -- creating directory to hold dynamically generated charts', :blue) copy_file 'app/assets/images/qa_server/charts/.keep' end |
#inject_bootstrap ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/generators/qa_server/install_generator.rb', line 48 def inject_bootstrap say_status('info', ' -- adding bootstrap resources', :blue) inject_into_file 'app/views/layouts/application.html.erb', after: /<head>\n/ do " <!-- Latest compiled and minified CSS -->\n"\ " <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>\n"\ " <!-- jQuery library -->\n"\ " <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>\n"\ " <!-- Latest compiled JavaScript -->\n"\ " <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'></script>\n" end end |
#inject_routes ⇒ Object
The engine routes have to come after the devise routes so that /users/sign_in will work
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/generators/qa_server/install_generator.rb', line 34 def inject_routes say_status('info', ' -- adding qa_server routes', :blue) # # Remove root route that was added by blacklight generator # gsub_file 'config/routes.rb', /root (:to =>|to:) "catalog#index"/, '' inject_into_file 'config/routes.rb', after: /Rails.application.routes.draw do\n/ do " mount Qa::Engine => '/authorities'\n"\ " mount QaServer::Engine, at: '/'\n"\ " resources :welcome, only: 'index'\n"\ " root 'qa_server/homepage#index'\n" end end |
#run_required_generators ⇒ Object
17 18 19 20 21 |
# File 'lib/generators/qa_server/install_generator.rb', line 17 def run_required_generators generate "qa_server:assets" generate "qa_server:config" generate "qa_server:models#{options[:force] ? ' -f' : ''}" end |