Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Update README #61

Merged
merged 5 commits into from
Aug 29, 2017
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 73 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,94 @@
[![Build Status](https://travis-ci.org/cfpb/eregs-2.0.svg?branch=master)](https://travis-ci.org/cfpb/eregs-2.0)
[![Coverage Status](https://coveralls.io/repos/github/cfpb/eregs-2.0/badge.svg?branch=master)](https://coveralls.io/github/cfpb/eregs-2.0?branch=master)

This is the new version of eRegs.
Work in progress. This is an updated back-end for [consumerfinance.gov/eregulations](https://www.consumerfinance.gov/eregulations/).

## Installation
[Documentation](https://cfpb.github.io/eregs-2.0/)

To make it go, you'll need MySQL. Create a user named `eregs` and give that user sufficient privileges to run
migrations (`alter user eregs superuser` should be fine for development). pip install the requirements and run the migrations.
## Development Quick-start

You'll need some sample data, so check the `data` directory for the initial version of Reg C, or check out the entire
[regulations-xml](https://github.com/cfpb/regulations-xml) repository. Load Reg C into the database by running
Create a MySQL database named `eregs` with a priviledged user named `eregs`, password `eregs`, then:

`./manage.py import_xml path/to/2011-31712.xml`
```
mkvirtualenv eregs
workon eregs
pip install -r requirements.txt
./manage.py import_xml data/2011-31712.xml
./setup.sh
./manage.py runserver
```

This should take no more than 10 seconds and will populate the database with the first version of Reg C. `./manage.py runserver` and
visit http://localhost:8000 to get the initial eRegs screen. Click on `Reg C` and it'll take you to the first section.

## Working on the front-end
## Detailed installation

The installation instructions will guide you through cloning the repo, setting up the database, importing an initial regulation, and building the front-end. Additional instructions can be found in the project's [documentation](https://cfpb.github.io/eregs-2.0/)

### Dependencies

- Python >= 2.6
- Node >= 4
- MySQL
- ElasticSearch 2.3

MySQL and ElasticSearch can be installed using `homebrew`:

```
brew install mysql
brew install elasticsearch23
```

### Initial setup

Clone the repository, create a Python virtualenv, and install the project's dependencies.

```
git clone https://github.com/cfpb/eregs-2.0
cd eregs-2.0
mkvirtualenv eregs
workon eregs
pip install -r requirements.txt
```

### Database setup (for development)

Login to MySQL and create a database named `eregs` with an `eregs` superuser.

```
mysql
mysql> CREATE DATABASE IF NOT EXISTS eregs;
mysql> CREATE USER 'eregs'@'localhost' IDENTIFIED BY 'eregs';
mysql> GRANT ALL PRIVILEGES ON eregs.* TO 'eregs'@'localhost';
mysql> GRANT ALL PRIVILEGES ON test_eregs.* TO 'eregs'@'localhost';
mysql> FLUSH PRIVILEGES;
```


### Import a regulation

The application requires [RegML-compliant xml](https://github.com/cfpb/regulations-xml) data. To simplify development, sample data has been provided. To load the sample data into the database run:

```
./manage.py import_xml data/2011-31712.xml
```

This will populate the database with the first version of CFPB's regulation C C.

### Build the front-end

1. Install [Node.js](http://nodejs.org) v4 or greater.
1. `./setup.sh` will install dependencies and build the project.

After the initial set-up:
For front-end development, after the initial set-up:

- `npm run build` - Bundle and minify all front-end assets.
- `npm run watch` - Bundle Less and JS files whenever they're changed.
- `npm test` - Run JS unit tests and lint source files.

### Run the application

To run the application, run `./manage.py runserver` and
visit http://localhost:8000 to get the initial eRegulations screen.

## Open source licensing info

1. [TERMS](TERMS.md)
Expand Down