/planningalerts-app

Fork to implement HTML alert emails

Primary LanguageRuby

PlanningAlerts.org.au – a free service which searches as many planning authority websites as it can find and emails
you details of applications near you

Copyright © 2009, 2010 OpenAustralia Foundation Limited and original contributors to PlanningAlerts.com

The aim of this to enable shared scrutiny of what is being built (and knocked down) in peoples’ communities.

This is the code for the web application side of things written using Ruby on Rails. The original code from PlanningAlerts.com, which this app is based on, was written using php.

This code is free and open-source and is licensed under the GPL v2.

PlanningAlerts.org.au is brought to you by the OpenAustralia Foundation with financial assistance from the Australian Government 2.0 Taskforce. It was adapted for Australia by Matthew Landauer and Katherine Szuminska, and is based on the UK site PlanningAlerts.com, built by Richard Pope, Mikel Maron, Sam Smith, Duncan Parkes, Tom Hughes and Andy Armstrong.

Setting up a dev environment

Install Dependencies

Checkout The Project

  • Fork the project on Github
  • Checkout the project

Install Ruby Dependencies

  • Install bundler – gem install bundler
  • Install dependencies – bundle install

Setup The Database

  • Create your own database config file – cp config/database.yml.example config/database.yml
  • Update the config/database.yml with your root mysql credentials
  • If you are on OSX change the socket to /tmp/mysql.sock
  • Create the databases – rake db:create
  • Load the database schema – rake db:schema:load

Run The Tests

  • Run the test suite – rake

Scraping and sending emails in your dev environment

Step 1 – Seed authorities table

Step 2 – Scrap DA’s

  • Run – rake planningalerts:applications:scrape['marrickville']

Step 3 – Setup an Alert

  • Start the rails server – rails s
  • Hit the home page – http://localhost:3000
  • Enter an address e.g. 638 King St, Newtown NSW 2042
  • Click the “Email me” link and setup an alert
  • Fish the email confirmation link from the logs and hit the link. It should look something like http://localhost:3000/alerts/f2c772161467b30a1bb8/confirmed

Step 4 – Send email alerts

  • Setup a gmail account for sending emails
  • Edit your config/environments/development.rb and add the following lines:
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :domain               => 'gmail.com',
    :user_name            => 'TEST_ACCOUNT_USERNAME@gmail.com',
    :password             => 'TEST_ACCOUNT_PASSWORD',
    :authentication       => 'plain',
    :enable_starttls_auto => true
  }
  • Run – rake planningalerts:applications:email
  • If you want to send the email again set the last_sent column in the alerts table to null and run the rake command again

Contact

You can get in touch at contact@planningalerts.org.au