threefunkymonkeys / funky-world-cup

MIT License
8 stars 3 forks source link

Funky World Cup

Funky World Cup is a match predictions website for the FIFA World Cup, that allows you to create groups so you can play with your friends defining prices.

To play on it, you just need an account on Facebook or Twitter. As stated in the disclaimer page, it uses your social network account just for log-in purposes. It doesn't play with your data nor posts in your behalf.

Funky World Cup is open source, so you can collaborate or base your work on it.

How to collaborate

There are two ways of collaboration:

Installation

Web Application

The application is built on Ruby, using Cuba and a PostgresSQL database.

The gem dependency is handled by the dep gem, so the first thing you have to do is install it

gem install dep

Once installed, you need to install your dependencies, which are listed in the .gems and .gems-test files:

dep install

Database

You need two databases, one for tests and one for your development environment.

Create the databases using your preferred method, either using psql or some GUI tool like pgAdmin

CREATE ROLE funkywc WITH LOGIN CREATEDB PASSWORD 'funkywc';
CREATE DATABASE funky_wc_dev WITH OWNER funkywc ENCODING 'utf8';
CREATE DATABASE funky_wc_test WITH OWNER funkywc ENCODING 'utf8';

Setup

Once you have everything installed and your database created you need to set up the application.

First, copy the settings sample file:

cp config/settings{.sample,}.yml

Then edit the settings file to setup your database access with the database name and credentials you used in the Database step.

Once the database access is set, run the migrations to create the database structure:

rake db:migrate

Then, seed the database with the teams and matches for the FIFA World Cup 2014

rake db:seed

Now you have everything you need to start the application:

rackup

This will put an app server up and running in port 9292 by default, open your browser and point it to http://localhost:9292, you should be able to run the application.

Development environment

If your planning on playing around with the code, you might want to run the tests, for this you need to install the tests gem dependencies:

dep install -f .gems-test

Then, prepare the database:

rake db:test:prepare

This will clone the development database schema into the test database to keep it synchronized. Then run the tests:

rake test:all

You can also use the shotgun gem to run the application which allows you to make changes and see them without having to restart the app server:

gem install shotgun

shotgun -p 9292

The shotgun gem will make the server to listen in the port 9393 by default, with the -p flag you can specify the port of your preference.