Total Pageviews

Wednesday, 26 March 2014

exercism

Setup

  1. Install postgresql with: brew install postgresql or apt-get install postgresql-9.2
  2. Copy .ruby-version.example to .ruby-version if you use a Ruby version manager such as RVM, rbenv or chruby
  3. Install gems with: bundle
  4. Install mailcatcher with gem install mailcatcher
  5. 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
  6. Presuming you have Postgres installed (if not: brew install postgres):
    • create db user with: createuser exercism.
    • create database with: createdb -O exercism exercism_development.
  7. Run the database migrations with rake db:migrate.
  8. Run the database seed with rake db:seed. If you want LOTS of data: rake db:seed[1000] or some other big number.
  9. Copy config/env to .env
  10. Edit .env to fill in the correct values, including the GitHub client id/secret procured earlier.
  11. Start the server with foreman start
  12. Login at http://localhost:4567.
  13. You can view the emails sent in MailCatcher in your browser at localhost:1080.
  14. Work through 'Frontend development setup' below and run lineman for correct styling at http://localhost:4567

Frontend development setup

  1. Install node and npm
  2. Install lineman via sudo npm install -g lineman
  3. cd frontend and start lineman with lineman 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 in bin/console that will load pry with the exercism environment loaded.

Testing

  1. Prepare the test environment with RACK_ENV=test rake db:migrate.
  2. Make sure that mailcatcher is running.
  3. Run the test suite with rake or rake test.
To run a single test suite, you can do so with:
ruby path/to/the_test.rb
If it complains about dependencies, then either we forgot to require the correct dependencies (a distinct possibility), or we are dependening on a particular tag of a gem installed directly from github (this happens on occasion).
If there's a git dependency, you can do this:
bundle exec ruby path/to/the_test.rb
For the require, you'll need to figure out what the missing dependency is. Feel free to open an issue on github. It's likely that someone familiar with the codebase will be able to identify the problem immediately。

from https://github.com/exercism/exercism.io