<commit_before># Whitehall App

## Getting set-up locally

### Pre-requisites

* Ruby >= 1.9.2 (we have run it successfully against 1.9.2-p290 and 1.9.3-p0)
* Rubygems and Bundler
* Mysql
* Imagemagick and Ghostscript (for generating thumbnails of uploaded PDFs)
* PhantomJS (for running the Javascript tests)

### Creating the mysql user

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';

### Preparing the app

    $ cd /path/to/whitehall
    $ bundle install
    $ bundle exec rake db:create:all
    $ bundle exec rake db:schema:load

### Getting a copy of live data

There's a capistrano task which will download a dump of the mysql database and load it on your local machine:

    cap db:import                # Import data from DEPLOY_TO environment to loca...
  
To use it, go to the whitehall directory in alphagov-deployment and then do:
    
    $ DEPLOY_TO=production bundle exec cap db:import

this will load data from production into your local database.

### Running the server locally

    $ script/rails s

## Creating new users in Production

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.

## Using local assets

* Set `STATIC_DEV` to point to your local instance of the `static` app when running the `whitehall` app e.g. `STATIC_DEV=http://static.dev`

## Getting search running locally

The Whitehall app relies on a separate instance of [Rummager](https://github.com/alphagov/rummager) for document search. The default (citizen) configuration is overridden by the `whitehall-rummager` project in the deployment repository.

To use a local copy of Rummager you'll need to:

* Tell Rummager to use the whitehall Solr core by setting `:path: "/solr/whitehall-rummager"` in `rummager/solr.yml`.
* Tell Rummager to listen for requests on the whitehall path prefix by setting `:path_prefix: "/government"` in `rummager/router.yml`.
* Set `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`.
* Optional: if you want to hit the Rummager app directly from a browser (i.e. not using `Accept: application/json`), e.g. to see how the citizen app works, then you may want to set `SLIMMER_ASSET_HOST` to point to your local instance of the `static` app.

To use a local copy of Solr - see the instruction in the Rummager [README.md](https://github.com/alphagov/rummager).<commit_msg>Update README to reflect new whitehall-admin project<commit_after># Whitehall App

## Getting set-up locally

### Pre-requisites

* Ruby >= 1.9.2 (we have run it successfully against 1.9.2-p290 and 1.9.3-p0)
* Rubygems and Bundler
* Mysql
* Imagemagick and Ghostscript (for generating thumbnails of uploaded PDFs)
* PhantomJS (for running the Javascript tests)

### Creating the mysql user

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';

### Preparing the app

    $ cd /path/to/whitehall
    $ bundle install
    $ bundle exec rake db:create:all
    $ bundle exec rake db:schema:load

### Getting a copy of live data

There's a capistrano task which will download a dump of the mysql database and load it on your local machine:

    cap db:import                # Import data from DEPLOY_TO environment to loca...

To use it, go to the `whitehall-admin` directory in `alphagov-deployment` and then do:

    $ DEPLOY_TO=production bundle exec cap db:import

this will load data from production into your local database.

### Running the server locally

    $ script/rails s

## Creating new users in Production

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.

## Using local assets

* Set `STATIC_DEV` to point to your local instance of the `static` app when running the `whitehall` app e.g. `STATIC_DEV=http://static.dev`

## Getting search running locally

The Whitehall app relies on a separate instance of [Rummager](https://github.com/alphagov/rummager) for document search. The default (citizen) configuration is overridden by the `whitehall-rummager` project in the deployment repository.

To use a local copy of Rummager you'll need to:

* Tell Rummager to use the whitehall Solr core by setting `:path: "/solr/whitehall-rummager"` in `rummager/solr.yml`.
* Tell Rummager to listen for requests on the whitehall path prefix by setting `:path_prefix: "/government"` in `rummager/router.yml`.
* Set `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`.
* Optional: if you want to hit the Rummager app directly from a browser (i.e. not using `Accept: application/json`), e.g. to see how the citizen app works, then you may want to set `SLIMMER_ASSET_HOST` to point to your local instance of the `static` app.

To use a local copy of Solr - see the instruction in the Rummager [README.md](https://github.com/alphagov/rummager).

{'fraction_non_alphanumeric': 0.08083219645293316, 'fraction_numerical': 0.004433833560709414, 'mean_word_length': 4.038659793814433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6970823', 'n_tokens_mistral': 1801, 'n_tokens_neox': 1721, 'n_words': 773}