<commit_before># Community Platform (Zen) Local Development

Instructions for setting up local development for the CoderDojo Community on Mac and Linux. There are four main parts to setting up your local development environment:

* Install the tools (node.js, PostgreSQL, etc)
* Setting up the Community Platform code
* Loading test data into your fresh setup
* Making code changes

## Install Tools

To develop the Community Platform you need the following tools installed:

* [Node.js](http://nodejs.org) version 0.10.38 - ideally installed with [nvm](https://github.com/creationix/nvm) as described in this [article](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps). Note that **only** node 0.10.x is supported currently.

* [PostgreSQL](http://www.postgresql.org/) version 9.4 - see [here](https://wiki.postgresql.org/wiki/Detailed_installation_guides) for installation instructions for your platform. You also may want to install the [pgAdmin](http://www.pgadmin.org/). When PostgreSQL is installed, you need to create a new user (you can do this from pgAdmin 'Login Roles' in the tree):
  * username: platform
  * password: <PASSWORD>

Give the new `platform` user all the admin privileges, i.e. make them a super user.

You also need to have [Git](https://git-scm.com/) installed in order to get the Community Platform code from [GitHub](https://github.com/coderdojo). You will also need to have [Grunt](http://gruntjs.com/) installed globally: `npm install -g grunt`.

## Code Setup

Next step is to get the Community Platform code cloned and up and running. To do that you clone this repo and use the `localdev` command to both setup and run the code:

```
$ git clone https://github.com/CoderDojo/cp-local-development.git && cd cp-local-development
$ npm install
```

Then run `./localdev.js` to make sure the `localdev` tool can run ok. You should see output similar to the following:

```
Usage "./localdev.js <command>" where command is one of:
  "init <system>": does a fresh setup of your local dev environment
  "run <system>": runs all the services in your system
  "testdata <system>": loads test data for each service
```

The `localdev` tool has one system configured, called `zen` (this can be extended to use multiple systems, but for now, 'zen' is the only one).<commit_msg>added information about a dependency ( postgresql module)<commit_after># Community Platform (Zen) Local Development

Instructions for setting up local development for the CoderDojo Community on Mac and Linux. There are four main parts to setting up your local development environment:

* Install the tools (node.js, PostgreSQL, etc)
* Setting up the Community Platform code
* Loading test data into your fresh setup
* Making code changes

## Install Tools

To develop the Community Platform you need the following tools installed:

* [Node.js](http://nodejs.org) version 0.10.38 - ideally installed with [nvm](https://github.com/creationix/nvm) as described in this [article](https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps). Note that **only** node 0.10.x is supported currently.

* [PostgreSQL](http://www.postgresql.org/) version 9.4 - see [here](https://wiki.postgresql.org/wiki/Detailed_installation_guides) for installation instructions for your platform. You also may want to install the [pgAdmin](http://www.pgadmin.org/).

* "Cube" PostgreSQL extension may be installed together with PostgreSQL, if not, you have to install it by yourself (e.g. in Debian/Ubuntu You may need to follow [these steps](http://askubuntu.com/a/354709)).

* When PostgreSQL is installed, you need to create a new user (you can do this from pgAdmin 'Login Roles' in the tree):
  * username: platform
  * password: <PASSWORD>

Give the new `platform` user all the admin privileges, i.e. make them a super user.

You also need to have [Git](https://git-scm.com/) installed in order to get the Community Platform code from [GitHub](https://github.com/coderdojo). You will also need to have [Grunt](http://gruntjs.com/) installed globally: `npm install -g grunt`.

## Code Setup

Next step is to get the Community Platform code cloned and up and running. To do that you clone this repo and use the `localdev` command to both setup and run the code:

```
$ git clone https://github.com/CoderDojo/cp-local-development.git && cd cp-local-development
$ npm install
```

Then run `./localdev.js` to make sure the `localdev` tool can run ok. You should see output similar to the following:

```
Usage "./localdev.js <command>" where command is one of:
  "init <system>": does a fresh setup of your local dev environment
  "run <system>": runs all the services in your system
  "testdata <system>": loads test data for each service
```

The `localdev` tool has one system configured, called `zen` (this can be extended to use multiple systems, but for now, 'zen' is the only one).
{'fraction_non_alphanumeric': 0.10126582278481013, 'fraction_numerical': 0.005224030540486237, 'mean_word_length': 4.393282773564463, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 12, 'lorem ipsum': 0, 'www.': 6, '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': '1577362', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1388, 'n_words': 633}