Every repository with this icon (
Every repository with this icon (
DeveloperSetup
Developer Setup
This document describes everything a developer needs to do, to set up the application on a dev box.
Prerequisites
The following software packages and tools are required before you can begin development with the PromoteGo.org web site.
MySQL
Download it here. On OS X, be sure and install the preference pane for easy startup and shutdown.
git
On OS X, use port install git-core if you’re using MacPorts, or use fink install git for fink. Or, download it from git.or.cz.
Ruby
You can find the main Ruby site here, or use “port install ruby” with MacPorts.
rubygems
Download the latest version from rubygems.org.
geminstaller
After installing rubygems, run the following command to install geminstaller:
# gem install geminstaller
Downloading the source code
The source code can be found here. Use the following git command to download a copy of the repository:
# git clone git://github.com/amikula/promotego-org.git
After you download the code, cd into the project directory and run:
# sudo geminstaller
This should install all gem dependencies, but is known to fail if your mysql binaries are not in the expected location. In that case, you’ll have to run:
sudo gem install -v 2.7 mysql -- --with-mysql-dir=/usr/local/mysql
With mysql installed under MacPorts, make sure you install mysql5-devel +server, then:
sudo gem install -v 2.7 mysql -- --with-mysql-dir=/opt/local/lib/mysql5 --with-mysql-lib=/opt/local/lib/mysql5/mysql --with-mysql-include=/opt/local/include/mysql5
Setting up the database
After downloading the code, cd to the config directory, and copy the database.yml file into place with “cp database_init.yml database.yml”. Then, you have two choices:
- Configure database.yml to use root with your root password. This is the most convenient path to take.
- Copy config/database_orig.yml to config/database.yml.
- Configure the promotego_development and promotego_test sections in database.yml with your root database user and root password.
- Run
rake db:create db:schema:loadto create the database and schema.
- Configure database.yml to use a different user and password.
- Copy config/database_orig.yml to config/database.yml.
- Configure promotego_development and promotego_test sections in database.yml with another user/password combo (like “promotego” and “promotego”).
- Create the promotego databases by running
create database promotego_development;andcreate database promotego_test;in mysql. - Give access to the user you configured in database.yml by running
grant all on promotego_development.* to 'promotego'@'localhost' identified by 'the_password';andgrant all on promotego_test.* to 'promotego'@'localhost' identified by 'the_password'; - Run
rake db:schema:loadto create the database schema.
Initializing the application
Initialize the application with type and role data, and create your initial owner account:
# rake app:initialize
Testing the code
In the project home directory, run rake spec and verify that no tests failed.
Scraping the club info
In the project home directory, run rake scraper:scrape_clubs scraper:geocode_clubs.
Running the site
In the project home directory, run script/server. Navigate to localhost:3000 in your browser, click on the link for searching, and do a club search.
Set up a user account
Click on the “Register” link and sign up for a user account. The validation email won’t go out, so you’ll have to manually activate the account:
- script/console
Loading development environment (Rails 2.1.1)
>> me = User.find_by_login(‘my_login’)
=> #<User id: 1, login: “my_login”, email: … >
>> me.activate
=> true






