Water
What is water?
Water is system for managing the hand-in and reviewing of programming assignments. It combines a git-based backend with an awesome web interface.
What is awesome about it?
- Hand-ins can be made via the command line using a git push or via the awesome web interface
- The web interface is awesome because you can:
- upload multiple files simultaneously
- see and manage the tree structure of your hand-in
- mix hand-ins via git and the web interface
- Teachers and assistants can comment on specific lines of code
- Hand-ins can be automatically checked for compliance with a set of technical requirements - no more waiting days just to be rejected because a mere technicality
Setup
Preparation
- Make sure you run ruby 1.9.2 or above using
ruby -v
, otherwise install it.
- Install beanstalkd, used for internal messaging.
- Install and start PostgreSQL.
- Install foreman using
gem install foreman
- Make sure you have some kind of
sshd
installed
Installation
- Clone project using
git clone git@github.com:water/mainline.git water
- Checkout the master branch.
git checkout master
- Navigate to the config folder, create a file called
database.yml
with the your postgresql credentials. Example credentials
- Install all dependencies using
bundle install
- Create two empty log files, just in case rails complains about it,
touch log/development.log log/test.log
- Rename
gitorious.sample.yml
to gitorious.yml
and change hosts and usernames to suit your system
- Create the db and migrate it
bundle exec rake db:create db:migrate
.
- Start poller, git-daemon beanstalkd and spork by running
foreman start
- Seed the db
CLEAR=1 bundle exec rake db:seed
- Start server,
rails s
- Navigate to localhost:3000
- Login using the information from
db/seeds.rb
.
Install PostgreSQL
Linux
- Install PostgreSQL, use your favorite package manager or download src from http://www.postgresql.org/download/
- Start the server deamon, the precompiled binary packages comes with init-scripts (eg
rc.d start postgresql
|| service postgresql start
) or you can run pg_ctl start
- Create a user
sudo su postgres
psql
CREATE ROLE username WITH SUPERUSER CREATEDB CREATEROLE PASSWORD 'password' LOGIN;
- (optional) Add postgres to autostart using distro-specific methods eg (
chkconfig postgresql on
|| add it to runlevel 5 init-scripts, run-level 3 for servers)
Ubuntu
sudo apt-get install postgresql postgresql-server-dev-9.1
- Follow the Linux guidelines above about creating a user
sudo service postgresql restart
OS X
brew install postgresql
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
OR
- Get the binary from http://www.postgresql.org/download/macosx/
The binary includes the pgAdmin program which may aid in development and debugging.
Install beanstalkd
Ubuntu
sudo apt-get install beanstalkd
OS X
brew install beanstalkd
Generating nice graphic of model
To better get a understanding for our model, it's nice to get a graphical
overview of it. railroady
can create it for you automatically, install
if first by gem install railroady
and then issue
railroady -M | grep -v "Overwriting" | dot -Tsvg > Model.svg
where the grep -v
part is a hack to get rid of the warnings rails
wrongly writes to stdin rather than stderr.
Tests
- Migrate test database
RAILS_ENV=test bundle exec rake db:create db:migrate
- Start the DRb server (spork) by running
foreman start
.
- Wait until it says Spork is ready and listening on 8988!, which takes about ~20 sec.
- Download fixtures using
git submodule update --init
- Run a test
- a specific test file
rspec spec/my_spec.rb
- all specs
rspec spec/
- a specific line in a specific file
rspec spec/my_spec.rb -l 10