<commit_before># Run local postgres in docker:

    docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD= -d postgres
    
## Create DB user if necessary
    
    $ psql -h localhost -U postgres
    # create role maintainit with createdb login password 'password'
    
# Environments

## LOCAL DEV

Run the `./script/build.sh` to execute rspec and cucumber tests.

Cucumber tests will execute in headless chrome by default. To run full chrome for visual inspection, use:

    `FULL_CHROME=true ./script/build.sh`
    
    
    
## TEST/STAGE

On merge to master, Codeship will automagically run tests and push to maintainit-test heroku app.

Assuming you named your git remote for test environment "herokutest"

    $ git remote -v    
    herokutest	https://git.heroku.com/maintainit-test.git (fetch)
    herokutest	https://git.heroku.com/maintainit-test.git (push)    
    
Then just push to herokutest master:

    git push herokutest master 
    
    heroku run rake db:migrate --app maintainit-test    
    
## PRODUCTION     

On merge to release, Codeship will automagically push to maintainit heroku app.

### Manually deploying to production


Assuming you named your git remote for test environment "heroku"

    $ git remote -v    
    heroku	https://git.heroku.com/maintainit.git (fetch)
    heroku	https://git.heroku.com/maintainit.git (push)

Then just push to heroku master:

    git push heroku master 
    
    heroku run rake db:migrate --app maintainit
    
# Annotating Models

Using the annotate gem from ctran. After changing models, execute:

`annotate --exclude tests,fixtures,factories,serializers`    <commit_msg>document some frequent tasks<commit_after># Run local postgres in docker:

    docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD= -d postgres
    
## Create DB user if necessary
    
    $ psql -h localhost -U postgres
    # create role maintainit with createdb login password 'password'
    
# Environments

## LOCAL DEV

Run the `./script/build.sh` to execute rspec and cucumber tests.

Cucumber tests will execute in headless chrome by default. To run full chrome for visual inspection, use:

    `FULL_CHROME=true ./script/build.sh`
    
    
    
## TEST/STAGE

On merge to master, Codeship will automagically run tests and push to maintainit-test heroku app.

Assuming you named your git remote for test environment "herokutest"

    $ git remote -v    
    herokutest	https://git.heroku.com/maintainit-test.git (fetch)
    herokutest	https://git.heroku.com/maintainit-test.git (push)    
    
Then just push to herokutest master:

    git push herokutest master 
    
    heroku run rake db:migrate --app maintainit-test    
    
## PRODUCTION     

On merge to release, Codeship will automagically push to maintainit heroku app.

### Manually deploying to production


Assuming you named your git remote for test environment "heroku"

    $ git remote -v    
    heroku	https://git.heroku.com/maintainit.git (fetch)
    heroku	https://git.heroku.com/maintainit.git (push)

Then just push to heroku master:

    git push heroku master 
    
    heroku run rake db:migrate --app maintainit
    
## Tasks and DB

### Access db

`heroku pg:psql --app maintainit-test`

### Run rake tasks

`heroku run rake chores:schedule --app maintainit-test`    
    
# Annotating Models

Using the annotate gem from ctran. After changing models, execute:

`annotate --exclude tests,fixtures,factories,serializers`    

{'fraction_non_alphanumeric': 0.07477710670117918, 'fraction_numerical': 0.004601668104687949, 'mean_word_length': 3.0488940628637953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5035720', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1066, 'n_words': 387}