git clone git://github.com/opennorth/patinermontreal.ca.git
cd patinermontreal.ca
bundle
bundle exec rake db:setup
bundle exec rake cron
bundle exec rake import:manual
bundle exec rake import:location
bundle exec rake import:contacts
bundle exec rake import:geojson
Run bundle exec rake db:drop
to start over.
To run the app locally, run rails server
.
Create a Heroku account, install the Heroku toolbelt and setup SSH keys as described on Getting Started with Heroku.
heroku apps:create --stack cedar --addons pgbackups:auto-month memcachier scheduler:standard
git push heroku master
heroku config:add SECRET_TOKEN=`bundle exec rake secret`
heroku domains:add patinermontreal.ca
heroku domains:add www.patinermontreal.ca
To run the updates every hour, run heroku addons:open scheduler
and add a rake cron
job on an hourly frequency.
If you have already run the Rake tasks to build the database locally, run:
heroku pg:push
Otherwise:
heroku run rake db:schema:load
heroku run rake cron
heroku run rake import:manual
heroku run rake import:location
heroku run rake import:contacts
heroku run rake import:geojson
To reset the Heroku database at the beginning of a season, run:
heroku pg:reset DATABASE_NAME
You can get a list of databases with:
heroku pg:info
If the city changes its data such that a duplicate rink is created, you need to either:
- Delete the old rink
- Delete the new rink and change the code so that duplicate rinks are not created
To find all non-geocoded rinks open a Rails console (rails console
locally or heroku run console
remotely), and run:
Patinoire.nongeocoded
For prettier output, run:
Patinoire.nongeocoded.each{|p| puts "#{p.nom} (nom_arr: #{p.arrondissement.nom_arr}, parc: #{p.parc}, genre: #{p.genre}, disambiguation: #{p.disambiguation})"};nil
Then, find the rink's latitude and longitude somehow (e.g. using Google Maps), and enter that data into this spreadsheet. Fill in the columns to match each rink.
Rinks in Dollard-des-Ormeaux, Laval, Vieux-Longueuil and Saint-Hubert are now handled using static GeoJSON files, instead of relying on the google spreadsheet. The static Task parses dollarddesormeaux.geojson, laval.geojson, longueuil.geojson and sainthubert.geojson and adds the rinks to the database. Currently, Dollard-des-Ormeaux and Laval have unknown conditions N/A
. Vieux-Longueuil and Saint-Hubert conditions are parsed from their respective Winter conditions HTML table.
Delete the rink from the database through a Rails console, e.g.:
Patinoire.find(numeric_identifier).destroy
If the rink was added manually, delete the row from this spreadsheet.
This app's main repository is on GitHub: http://github.com/opennorth/patinermontreal.ca, where your contributions, forks, bug reports, feature requests, and feedback are greatly welcomed.
Copyright (c) 2011 Open North Inc., released under the MIT license