An open website for opening Congress.
HTML Ruby CSS JavaScript PHP PLpgSQL Other
Latest commit db164f3 Feb 25, 2016 @crdunwel crdunwel goodnight sweet prince v2
Permalink
Failed to load latest commit information.
app goodnight sweet prince v2 Feb 24, 2016
bad_sweepers restored fragment cache sweeper Nov 23, 2009
bin fixed lazy typo Apr 24, 2015
components Use possessive gem instead of naive 's everywhere Jun 4, 2013
config download page with links to download data in csv format May 18, 2015
contrib Bump run-all script for new congress Jan 8, 2015
db Add contactable field to Person model Dec 12, 2014
doc Added initial Rails app Aug 17, 2009
features Hide more keys in second vcr config Aug 12, 2014
lib fix zip lookup May 18, 2015
log Add log & tmp files to repo for easier checkout Nov 20, 2009
public added alert banners to export notebook and tracked item exports Apr 24, 2015
script add script/delayed_job Jul 27, 2011
spec Send to myreps@ if user elects that option from email_congress/comple… Mar 10, 2015
test Send to myreps@ if user elects that option from email_congress/comple… Mar 10, 2015
tmp Add log & tmp files to repo for easier checkout Nov 20, 2009
vagrant Get unicode right for db init through vagrant, couple minor things. Nov 27, 2013
vendor/plugins A little scary that I had to do this… but, fixes swf charts Jul 2, 2013
.gitignore Update .gitignore Dec 9, 2014
.gitmodules Merge master into widgets Jul 6, 2011
.rbenv-gemsets Moving toward rbenv Nov 25, 2013
.rspec run specs with fuubar, update travis config, May 8, 2013
.ruby-gemset new rvm spec files, let's try ruby 1.9.3 for fun. May 8, 2013
.ruby-version Moving toward rbenv Nov 25, 2013
CREDITS License update for OC v3 Jul 26, 2011
Capfile More cleanup of config / Cap files Nov 13, 2009
Gemfile Peg formageddon to ref 61c4f0dae2c16345d226be8575475e0f3ebd94e3 Dec 10, 2014
Gemfile.lock Peg formageddon to ref 61c4f0dae2c16345d226be8575475e0f3ebd94e3 Dec 10, 2014
Guardfile Add guard and guard-livereload to Gemfile Apr 25, 2011
LICENSE Add deprecation notices (fixes #241) Oct 18, 2013
README.md Fixes problem where OSX users aren't receiving captchas for registeri… Jul 21, 2014
Rakefile rails 3 changes Feb 25, 2011
banned_users_test.txt Added initial Rails app Aug 17, 2009
config.ru rails 3 changes Feb 25, 2011
parsed_reports.txt Added initial Rails app Aug 17, 2009

README.md

OpenCongress

A Ruby on Rails application for gathering, displaying and tracking information about the United States Congress

Getting started with our code

Vagrant

By far, the fastest and easiest way to get started with OpenCongress is by downloading and installing our vagrant box.

You can get vagrant at http://vagrantup.com

Once you've installed vagrant, just run:

vagrant box add opencongress http://vagrant.sunlightfoundation.com/opencongress/opencongress.box
vagrant init opencongress
vagrant up

Then connect to your new VM:

vagrant ssh

From here, you can skip down to 'gem install bundler'

Running locally

Start by installing all the packages required by OpenCongress. The main dependencies are postgres and ImageMagick; OpenCongress will not run on mysql or sqlite. The following commands are suggestions, but ultimately you'll need to get postgres running to be able to run the app. We are currently running postgres 9.1 in production.

For Ubuntu 14.04 (Trusty):

# install needed libraries
sudo apt-get install postgresql postgresql-server-dev-9.3 libxml2-dev \
                     libxslt-dev libcurl4-openssl-dev libmysqlclient-dev \
                     imagemagick libssl-dev libreadline-dev

For Mac OS X, start by installing Homebrew, then run:

brew install postgresql postgresql-server ImageMagick md5sha1sum wget wkhtmltopdf ghostscript

Follow the instructions after the packages install for initializing your database


Install Ruby and the bundle of dependencies:

# install rbenv (see: https://github.com/sstephenson/rbenv#basic-github-checkout)
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

# install ruby
rbenv install 1.9.3-p484

gem install bundler
rbenv rehash            # this puts the "bundle" command in your PATH
bundle install

Note for OS X: You may need to specify additional compile options for your gems. Try: ARCHFLAGS="-arch x86_64" bundle install


Generate your settings files. First change into the opencongress directory and then:

cp config/api_keys.yml.example config/api_keys.yml
cp config/application_settings.yml.example config/application_settings.yml
cp config/database.yml.example config/database.yml

Be sure to fill out these new files with the relevant details before proceeding.

Database setup

Running the following commands will create an 'opencongress' user and empty databases for the three environments (test, development, production). The migration command will populate the development database with an empty schema.

# make a postgres superuser for opencongress
sudo -u postgres createuser opencongress -sP

# Make sure to put your password in config/database.yml!

# create the postgres database
sudo -u postgres createdb opencongress_development -O opencongress

rake db:init
rake db:migrate

Legislative Data (optional)

To import legislative data into your database, run the following command:

rake update

This will download data files from The United States project and import them into your database. The default location for storage of the data files is /tmp/opencongress_data but you can change this by editing config/application_settings.yml. This task will import ALL of the data for the current session of Congress: it will take a long time and occupy a LOT of space on your filesystem! Keep this in mind before importing the data!

Starting the server

To start the webserver:

rails s

Contributing

We are currently focused on getting the code up to speed--more friendly for developers and better covered by tests. If you would like to help out, please be sure any new code is tested appropriately under RSpec, Capybara and/or Cucumber and send pull requests to this github repo. We'd especially love help in improving test coverage, but all pull requests are welcome. See the Sunlight Community page for specific asks related to this project.

License

OpenCongress is distributed under the GPLv3.