Skip to content

Exygy/dahlia-listings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Housing Portal

Code Climate

Cross-browser testing done with

Purpose

Affordable housing portal for the Bay Area. This application streamlines the process of searching and applying for affordable housing, making it easier to rent and stay in our region.

Technical Architecture

This repository contains the source code for sites such as smc.housingbayarea.org, which is the user-facing web application of the platform. It is a Ruby on Rails application that serves up a single page AngularJS app. The web application connects to a PostgreSQL backend controlled by the admin app (see repo here), which is where the listings are created and administered. Both apps use a common set of data models via a Ruby gem (see repo here).

Dependencies

Before you install, your system should have the following:

  • Ruby 2.5.3 (Use RVM or rbenv)
  • Bundler gem install bundler
  • PostgreSQL
  • Use Node v12.x (npm v6.9.x) — If you need to manage multiple Node versions on your dev machine, install NVM and run nvm use

Getting started

  1. Make sure your PostgreSQL server is running (e.g. using Postgres.app listed above)
  2. Open a terminal window
  3. git clone https://github.com/Exygy/dahlia-listings.git to create the project directory
  4. cd dahlia-listings to open the directory
  5. bundle install to download all necessary gems
    • see here if you have issues installing pg gem with Postgres.app, you may need to use: `gem install pg -v 1.1.4 -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
  6. yarn install to install Angular and other JS dependancies.
  7. overcommit --install to install git hooks into the repo
  8. rails s to start the server, which will now be running at http://localhost:3000 by default

For a fresh installation only (no existing DB)

  1. rails db:create && rails db:migrate to create the dev and test databases and run migrations
  2. rails db:seed to load the seed data into the new databases

Running Tests

To run Ruby tests:

  • rails spec

To run Javascript unit tests:

To run E2E tests:

  • Installation (needs to be run once): ./node_modules/protractor/bin/webdriver-manager update to get the selenium webdriver installed
  • On one tab have your Rails test server running: yarn rails-setup-test
  • On another tab, run yarn protractor to run the selenium webdriver and protractor tests. A Chrome browser will pop up and you will see it step through each of the tests.
  • After you are done with your testing, run the teardown command to stop the test server and remove test DB files: yarn rails-teardown-test

Note: These tests will run on Semaphore (our CI) as well for every review app and QA deploy.

Importing pattern library styles

We currently manually transfer the application's CSS from our pattern library using Grunt.

To update this app with the latest PL styles:

  1. Clone the PL repository in the same parent directory as this one.
  2. Optional: switch to the PL branch you want to import styles from.
  3. cd to your dahlia-listings folder
  4. Run grunt

We use grunt-clean and grunt-copy to transfer the CSS, and grunt-replace to replace relative background image paths with Rails asset URLs.

Acceptance/Feature Apps

Temporary "acceptance" apps are created upon opening a pull request for a feature branch. After the pull request is closed, the acceptance app is automatically spun down. See this Heroku article for details.

Code style and quality

Javascript

Javascript code quality is ensured by two npm packages: JsHint and JSCS. They will run automatically as a pre-commit hooks. Follow the Airbnb JavaScript Style guide.

Ruby

Rubocop is configured in .rubocop.yml to enforce code quality and style standards based on the Ruby Style Guide and runs every time you commit using a pre-commit hook. Refer to the Ruby Style Guide for all Ruby style questions. To identify and have Rubocop automatically correct violations when possible, run:

  • rubocop -a [path_to_file] for individual files
  • rubocop -a for all Ruby files

Changing the Style Guide settings

Any changes to Rubocop, JSCS, etc. affect the entire team, so it should be a group decision before commiting any changes. Please don't commit changes without discussing with the team first.

License

This housing portal is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this housing portal. If not, see http://choosealicense.com/licenses/gpl-3.0/