Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

rails-girls-summer-of-code/rgsoc-teams

Repository files navigation

Rails Girls Summer of Code Teams

Build Status Maintainability Test Coverage

Looking for your help!

For RGSoC we are building an app that aggregates daily status updates, commit activity and other sources into an activity stream.

Main goals are:

  • make it easy to get an overview of each team's activity/progress for supervision
  • make it easy for people interested in coaching to find opportunities to give support/help
  • display to the world how much amazing stuff is happening

Features:

  • Users can sign in through GitHub OAuth
  • Students can create teams and apply for the program
  • Teams can organize their members (students, coaches, mentors aka project maintainers)
  • RSS feeds are fetched from all teams' logs regularly and aggregated
  • Organizers can process new projects for submission, review new teams for selection, keep track of information on conferences for students

We're really excited at how much this app has grown and developed, and are really grateful for all of the community help along the way. There's still plenty to do here - and we'd love to have your contributions! Hop on over to the issues and have a look πŸ‘€.

Requirements:

  • Keep it simple to lower the barrier for RGSoC students to contribute too
  • By contributing, you agree to adhere to our Code of Conduct
  • Make sure to check our Contribution Guide

Getting Started

In order to contribute, you need to run the Teams App locally on your computer. For setting it up, you'll need to have some tools installed on your system:

The following section will guide you step by step through the setup and installation process on Linux 🐧 and macOS 🍏

1. Installation

Setup on Ubuntu 🐧

# Install required packages
sudo apt-get install postgresql libpq-dev libcurl3 libcurl3-gnutls libcurl4-openssl-dev postgresql-contrib-9.5 chromium-chromedriver

# Install bundler
gem install bundler

# Create database user rgsoc with password rgsoc
sudo -u postgres createuser -P -s rgsoc
# Enter password for new role: rgsoc
# Enter it again: rgsoc

Setup on macOS 🍏

# Install required packages
brew install ruby postgres
# Make sure to follow the instructions printed on the screen for postgres

# Install chromedriver
brew tap caskroom/cask
brew cask install chromedriver

# Install bundler
gem install bundler

# Update postgres then start postgres to avoid any conflicts while creating the pg user 
brew postgresql-upgrade-database

# Start postgres 
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

# Create database user rgsoc with password rgsoc
createuser -P -s rgsoc
# Enter password for new role: rgsoc
# Enter it again: rgsoc

πŸ’ Ran into problems so far with the setup? Check our Troubleshooting Guide.

2. Project setup

Once you have you system ready, we need to setup the database and the Rails app. The steps are the same for 🐧 and 🍏.

Copy config/database.yml.example file to config/database.yml:

cp config/database.yml.example config/database.yml

Then modify the new database.yml file to your needs. Add username and password in the development and test sections:

development:
  adapter: postgresql
  database: rgsocteams_development
  host: localhost
  username: rgsoc
  password: rgsoc

test:
  adapter: postgresql
  database: rgsocteams_test
  host: localhost
  username: rgsoc
  password: rgsoc

Then back in the root directory of the project, install all project dependencies with bundler:

bundle install

Once this is done, setup the database and fill it with some initial data:

bundle exec rails db:setup

πŸ’ Want more? Check the Optional Setup section for setting up some additional tooling πŸ‘‡

3. Run the App

Start the Rails server:

bundle exec rails server

The project will run at http://localhost:3000

πŸ’ All set? Check the Quick Start section for the first steps in the project πŸ‘‡

Quick Start


Some tips for your first interactions with the Teams App. For this, make sure you have the server running and the app open in your browser πŸ–₯.

http://localhost:3000

To access all functionality of the app, add yourself as an organizer. For this, first start an interactive Rails console in a separate terminal (window/tab) πŸ“Ÿ:

bundle exec rails console
  1. In the browser πŸ–₯: log in with your Github account
  2. In the console πŸ“Ÿ
    user = User.last
    user.roles.create(name: 'organizer')
    
    # alternative: find your user, e.g. by your Github handle
    user = User.find_by(github_handle: <your-github-handle-here>)
    
    # You can assign yourself other roles the same way.
    # If you've assigned yourself student AND organizer roles however,
    # this may lead to undesired behavior of the app. Best remove the
    # student role again.
  3. Refresh the browser πŸ–₯: you should see links to orga pages now

Once you're an organizer, you can:

πŸ’ you are good to go now. Happy coding!

Optional Setup

Google Places API

To avoid accidentally exceeding the rate limit on Google's Places API (e.g. when heavily testing city-autocomplete fields) and thus blocking its usage for other RGSoC sites and devs:

Get your own API key, and set the GOOGLE_MAPS_API_KEY environment variable (or simply override the key in config/initializers/google_maps.rb):

export GOOGLE_MAPS_API_KEY=<your-api-key>

Testing

Please write relevant tests as you code, and test locally before opening a pull request. Thank you!

bundle exec rake spec

You can optionally create a test-coverage report in coverage/* like so:

COVERAGE=yes bundle exec rake spec

Feature Tests

Feature tests run in headless Chrome. For local debugging, you can run them in a normal window by tagging the examples with driver: :selenium_chrome, like so:

it 'is an interesting example', driver: :selenium_chrome do
  visit some_path

  # you can e.g. interrupt here
  binding.pry
  # now you can switch to Chrome and inspect things there

  # etc.
end

Code Analysis

You can run automatic code analyzers to check if your code complies to the project's guidelines and general best practice.

For Ruby code:

bundle exec rubocop

For JS code: (you need to install jshint first)

jshint app/assets/javascript

Deployment

The staging app lives at http://rgsoc-teams-staging.herokuapp.com. The production app is at http://teams.railsgirlssummerofcode.org.

[remote "staging"]
        url = [email protected]:rgsoc-teams-staging.git
        fetch = +refs/heads/*:refs/remotes/staging/*
[remote "production"]
        url = [email protected]:rgsoc-teams-production.git
        fetch = +refs/heads/*:refs/remotes/production/*

Append -r staging or -r production to any heroku command in order to specify the app.

Cron jobs

The Heroku scheduler is set to run these tasks:

  • rake activity:update every 10 min

Camo

Both apps on Heroku use camo to proxy insecure images in activity logs. For this to work, the CAMO_HOST and CAMO_KEY environment variables need to be set in Heroku's configuration for the app.