Skip to content

Commit

Permalink
better messages during qa_server:install; better installation instruc…
Browse files Browse the repository at this point in the history
…tions in README
  • Loading branch information
elrayle committed Aug 27, 2018
1 parent 884de0e commit 796f4d7
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 13 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,25 @@ $ gem install qa_server
#### Install the engine and run migrations

```bash
$ bundle exec rails qa_server:install
$ rails g qa_server:install
$ rake db:migrate
```

#### Test the install

* Start rails server with `rails s`
* You should see the Home page. Click the other nav menus to be sure you see content there as well.
* On Authorities List, click the URL for one of the authorities to confirm you get data.
* On Check Status, select one authority from the selection list and confirm that tests pass.
* Clicking on Monitor Status will run all tests, which is very slow. When it completes, it will have confirmed that the database tables are setup correctly. You can expect all tests to pass, although, there is a possibility that one or more authorities are down at the moment you run the tests. If all fail, there may be an installation problem. If only a few fail, it is more likely a problem with the authority.

#### Trouble Shooting

Common problems:

* If complaints about a table not existing, either the migrations were not copied over or have not run.
* All tests fail could mean that the required gems were not installed. Look for gems `qa` and `linkeddata`.
* If some tests fail with a comment that the results are not RDF, confirm that gems `qa` and `linkeddata` are installed. Confirm that `qa` gem is using the `min-context` branch.

## Supported Authorities

Expand Down
12 changes: 7 additions & 5 deletions lib/generators/qa_server/assets_generator.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
require 'rails/generators'

class QaServer::AssetsGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)

desc """
This generator installs the qa_server CSS assets into your application
"""

source_root File.expand_path('../templates', __FILE__)
def banner
say_status('info', 'GENERATING QA_SERVER ASSETS', :blue)
end

def inject_css
say_status('info', ' -- adding qa_server css', :blue)
copy_file "qa_server.scss", "app/assets/stylesheets/qa_server.scss"
end

def inject_js
return if qa_server_javascript_installed?
say_status('info', ' -- adding qa_server javascript', :blue)
insert_into_file 'app/assets/javascripts/application.js', after: '//= require_tree .' do
<<-JS.strip_heredoc
Expand All @@ -21,10 +27,6 @@ def inject_js
end
end

# def copy_image_file
# copy_file 'app/assets/images/unauthorized.png'
# end

private

def qa_server_javascript_installed?
Expand Down
9 changes: 8 additions & 1 deletion lib/generators/qa_server/config_generator.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
require 'rails/generators'

class QaServer::ConfigGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)

desc """
This generator installs the qa_server configuration files into your application for:
* authority configs
* authority scenarios
* i18n
"""

source_root File.expand_path('../templates', __FILE__)
def banner
say_status('info', 'INSTALLING QA_SERVER CONFIGURATIONS', :blue)
end

def authority_configs
say_status('info', ' -- adding authority configurations', :blue)
directory "config/authorities/linked_data", recursive: false
end

def authority_scenarios
say_status('info', ' -- adding authority validations', :blue)
directory "config/authorities/linked_data/scenarios", recursive: false
end

def inject_i18n
say_status('info', ' -- adding i18n translations', :blue)
copy_file 'config/locales/qa_server.en.yml'
end
end
15 changes: 12 additions & 3 deletions lib/generators/qa_server/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ class Install < Rails::Generators::Base
3. Installs qa_server assets
"""

def banner
say_status('info', 'INSTALLING QA_SERVER', :blue)
end

def run_required_generators
generate "qa_server:models#{options[:force] ? ' -f' : ''}"
generate "qa_server:assets"
generate "qa_server:config"
generate "qa_server:models#{options[:force] ? ' -f' : ''}"
end

def add_to_gemfile
say_status('info', ' -- adding qa_server required gems', :blue)
gem 'qa', github: 'samvera/questioning_authority', branch: 'min_context'
gem 'linkeddata'

Expand All @@ -26,8 +31,10 @@ def add_to_gemfile

# The engine routes have to come after the devise routes so that /users/sign_in will work
def inject_routes
# Remove root route that was added by blacklight generator
gsub_file 'config/routes.rb', /root (:to =>|to:) "catalog#index"/, ''
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"\
Expand All @@ -38,6 +45,8 @@ def inject_routes
end

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"\
Expand Down
10 changes: 7 additions & 3 deletions lib/generators/qa_server/models_generator.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
class QaServer::ModelsGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
desc 'This generator makes the following changes to your application:
1. Copies database migrations'

desc """
This generator makes the following changes to your application:
1. Copies database migrations
"""

def banner
say_status('info', 'GENERATING QA SERVER MODELS', :blue)
say_status('info', 'INSTALLING QA_SERVER MODELS AND MIGRATIONS', :blue)
end

# Setup the database migrations
def copy_migrations
say_status('info', ' -- installing migrations', :blue)
rake 'qa_server:install:migrations'
end
end

0 comments on commit 796f4d7

Please sign in to comment.