Setup
- Install postgresql with:
brew install postgresql
orapt-get install postgresql-9.2
- Copy
.ruby-version.example
to.ruby-version
if you use a Ruby version manager such as RVM, rbenv or chruby - Install gems with:
bundle
- Install
mailcatcher
withgem install mailcatcher
- Get a client id/secret from GitHub at https://github.com/settings/applications/new.
- Name: whatever
- URL: http://localhost:4567
- Callback url: http://localhost:4567/github/callback
- Presuming you have Postgres installed (if not:
brew install postgres
):- create db user with:
createuser exercism
. - create database with:
createdb -O exercism exercism_development
.
- create db user with:
- Run the database migrations with
rake db:migrate
. - Run the database seed with
rake db:seed
. If you want LOTS of data:rake db:seed[1000]
or some other big number. - Copy
config/env
to.env
- Edit
.env
to fill in the correct values, including the GitHub client id/secret procured earlier. - Start the server with
foreman start
- Login at http://localhost:4567.
- You can view the emails sent in MailCatcher in your browser at localhost:1080.
- Work through 'Frontend development setup' below and run lineman for correct styling at http://localhost:4567
Frontend development setup
- Install node and npm
- osx: brew install node
- others see: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
- Install lineman via
sudo npm install -g lineman
-
cd frontend
and start lineman withlineman run
- note lineman watches for file changes and compiles them automatically, it is not required to be running for the server to run
Sending Emails
If you want to send emails, you will need to fill out the relevant environment variables in.env
and uncomment the lines so that the variables get exported.Console
There's a script inbin/console
that will load pry with the exercism environment loaded.Testing
- Prepare the test environment with
RACK_ENV=test rake db:migrate
. - Make sure that
mailcatcher
is running. - Run the test suite with
rake
orrake test
.
ruby path/to/the_test.rb
If there's a git dependency, you can do this:
bundle exec ruby path/to/the_test.rb
from https://github.com/exercism/exercism.io