"Whitehall" is the code name for the Inside Government project, which aims to bring Government departments online in a consistent and user-friendly manner. Documention can be found on rdoc.
- Ruby >= 1.9.3
- Rubygems and Bundler
- Mysql
- Imagemagick and Ghostscript (for generating thumbnails of uploaded PDFs)
- xpdf
- PhantomJS (for running the Javascript tests)
The database.yml for this project is checked into source control so you'll need a local user with credentials that match those in database.yml.
mysql> grant all on `whitehall\_%`.* to whitehall@localhost identified by 'whitehall';
$ cd /path/to/whitehall
$ bundle install
If you wish to use a sanitized export of the production data (recommended for internal staff) then see the alphagov/development repo for the replication script. Once that is imported upgrade your import to the latest schema version with
$ bundle exec rake db:migrate
Otherwise set up an empty database with:
$ bundle exec rake db:create:all
$ bundle exec rake db:schema:load
Two environment variables can be (optionally) set up, typically:
GOVUK_APP_DOMAIN=dev.gov.uk
GOVUK_ASSET_ROOT=http://static.dev.gov.uk
Then run
$ bundle exec rake
Alternatively run
$ govuk_setenv whitehall env RAILS_ENV=test bundle exec rake
Note that using bowler
or foreman
will automatically use the
govuk_setenv
method for you.
The test suite can be run in parallel like so:
rake test:in_parallel
This will automatically prepare your test database for parallel work.
Javascript unit tests can be run together:
rake test:javascript
To run individual tests or when debugging:
./script/javascript-test-server
And go to http://localhost:3100/test/qunit in the browser
NB: The shared mustache templates must be compiled for the tests to pass. Take care not to commit the compiled templates to the repository.
rake shared_mustache:compile
rake shared_mustache:clean
$ bundle exec rails s
New users will need a sign-on-o-tron account before they can access whitehall in production. You can create new sign-on-o-tron accounts with the capistrano task in alphagov-deployment/sign-on-o-tron. This will email the new user and prompt them to create their account.
- Set
GOVUK_ASSET_ROOT
to point to your local instance of thestatic
app when running thewhitehall
app e.g.GOVUK_ASSET_ROOT=http://static.dev
, this is set for you within the development VM.
The Whitehall app relies on Rummager for document indexing, and the Gov.UK frontend application to serve results.
To use a local copy of Rummager you'll need to:
- elasticsearch;
- Set the environment variable
RUMMAGER_HOST
to point to the local instance of Rummager (e.g.export RUMMAGER_HOST=http://rummager.dev
in.powrc
); - You'll also need to set
RUMMAGER_HOST
when using the Rummager rake tasks e.g.RUMMAGER_HOST=http://rummager.dev rake rummager:index
; - Run the
rummager
andfrontend
applications to view results. You just need therummager
app to index results.
Note: Before you index the whitehall data, make sure you have created the rummager indices by running the following task from the rummager repo:
RUMMAGER_INDEX=government bundle exec rake rummager:migrate_index
Whitehall uses the GDS Content API to serve categorisation for Detailed Guidance.
You need to set the following environment variables :-
CONTENT_API_ENDPOINT_URL # e.g. https://contentapi.preview.alphagov.co.uk
CONTENT_API_USERNAME
CONTENT_API_PASSWORD
We use YARD for the documentation. You can generate a local copy with:
yard server --reload
You can also read the docs on rdoc.info.