<commit_before># README

## ContraDB

This is the source code for [contradb.com](https://contradb.com), an
online database for managing contra dances. The intended users are
dance callers, dance choreographers, and opinionated dancers. Users
create, edit, update, and delete dances, as well as copying and
viewing other users' dances. Users can create programs of dances and
call them from their phone or print outs.

## COPYING

This library is released under the AGPL, see COPYING for details.

## Development

Contact us for help. But if you don't wanna, here's some information:
Check the Gemfile.lock for the relevant versions of Ruby. I use rbenv
to manage gems.

Database configuration is pretty simple and should be handled by
migrations. Creating a Postgres user is [handled in the wiki](https://github.com/contradb/contra/wiki/Setting-up-Postgres-for-Development-and-Testing).
If you've come this far, maybe it's time to contact the project for a db replica so you can test against real data, but if you want to create your own empty DB:

1. run `rake db:seed` to create the special choreographer 'Unknown'
2. The first user you create through the website has super special
powers.

### Outline of install for Windows - Dec 2018

Sketch only and not tested - ask for help on any of this

- Virtualbox Ubuntu LTS
- clone git repo
- install rbenv
- install ruby 2.4.1 in rbenv
- gem install bundler
- bundle install
- configure config/database.yml
- get a replica database from contradb.com

Then:
- bin/rspec [runs ruby tests]
- bin/rails s [runs server on http://localhost:3000]
- bin/rails c [runs repl loop]

## Deployment

[Deployment instructions](https://github.com/contradb/contra/wiki/Installing-new-git-version-onto-production-server) are in the wiki.

## Testing

```
bin/rspec
```
will run lots of ruby tests.<commit_msg>update README.md for 20.04 Ubunutu<commit_after># README

## ContraDB

This is the source code for [contradb.com](https://contradb.com), an
online database for managing contra dances. The intended users are
dance callers, dance choreographers, and opinionated dancers. Users
create, edit, update, and delete dances, as well as copying and
viewing other users' dances. Users can create programs of dances and
call them from their phone or print outs.

## COPYING

This library is released under the AGPL, see COPYING for details.

## Development

Contact us for help. Getting contradb running locally is a 397-step
process that is not easy unless you have a good understanding of ruby,
javascript, postgres, and your operating-system of choice. But if you
don't wanna contact us, here's some notes on how to do it, current at
time of writing, but probably outdated by the time you read this.

### Install rbenv to manage versions of ruby https://github.com/rbenv/rbenv
### `cd contra`
### get the proper version from `.ruby-version` and install it

```rbenv install $(cat .ruby-version)```

I had to also do `sudo apt install gcc make` to get a C compiler and the `make` build tool. Apt is a package manager similar to brew.

### `gem install bundler`

### `bundle install`

I had to run `sudo apt install g++` for a C++ compiler.

Then I errored out for lack of postgres, so I did a detour:

### Install Postgres

For my OS I followed https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-20-04 , basically:

```
sudo apt install postgresql postgresql-contrib
```
Then I had to also install `libpq-dev` for whatever reason.

### Run `bin/rails server`

Okay, I had to go install yarn to get this to work, then run `yarn install --check-files`.



### Configure Postgres

Database configuration is pretty simple and should be handled by
migrations. Creating a Postgres user is [handled in the wiki](https://github.com/contradb/contra/wiki/Postgres-for-contradb-dev).
If you've come this far, maybe it's time to contact the project for a db replica so you can test against real data, but if you want to create your own empty DB:

1. run `rake db:seed` to create the special choreographer 'Unknown'
2. The first user you create through the website has super special
powers.

### Configure rspec

I needed to install chromedriver, which was a binary I downloaded and plopped in /usr/local/bin.

Then in a secret undocumented step that nobody tells you about, you have to also install google-chrome, supposedly at the same version (86 here).

I also did `rake db:seed test`, but that screwed things up by creating Chorographer 'unknown'. I had to go in and destroy them manually. 

## Deployment

[Deployment instructions](https://github.com/contradb/contra/wiki/Installing-new-git-version-onto-production-server) are in the wiki.

## Testing

```
bin/rspec
```
will run lots of ruby tests.
{'fraction_non_alphanumeric': 0.07932843651626442, 'fraction_numerical': 0.005876180482686254, 'mean_word_length': 4.191721132897603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1578927', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1336, 'n_words': 671}