For the background behind this repository, see the #hack4good 0.6
project page,
and the slide-deck presented at the end of the event.
This repository contains a Rails app that allows collection of carbon emission data from corporations and carbon analysts (volunteers who trawl company websites and extract data about carbon emissions etc.)
It will eventually also support generation of reports on the collected data.
The app is tested on Ruby 2.1.2 but you may have luck with older versions. It is suspected that anything older than 2.0 will not work.
On Linux or MacOS X, you can use RVM, a ruby version manager:
rvm install 2.1.2
First, fork the repository. Then clone from your fork, e.g.:
git clone git@github.com:my-github-username/ET-reporting.git
With Ruby 2.0, bundler
should automatically be
available.
bundle install --without production
Use the --without production
flag to avoid installing the pg
gem
for PostgreSQL, which you don't need in development anyway!
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake surveyor FILE=surveys/et_reporting_survey.rb
If you update
surveys/et_reporting_survey.rb
and
re-run the above rake surveyor
command, then
http://localhost:3000/surveys will
list a new version of the survey. It keeps old versions and any
corresponding answers.
bundle exec rails server
and now you should be able to visit: http://localhost:3000/
We use the surveyor
gem to
implement the survey. The questions are specified in
a single file which uses a simple
Ruby-based DSL. The gem's documentation explains this DSL in more
detail:
This should allow non-coders to update the survey in the future without the expense of implementing sophisticated survey editing functionality.
We use the devise
and
devise_invitable
gems.