Skip to content

MontrealNewTech/website

Repository files navigation

README

CircleCI codecov Code Climate Dependency Status

Read Me

This is the website for Montreal New Tech. It's still in development and everyone is welcome to contribute! The public-facing part shows our upcoming events, community news, and some information about what we do and who we are. Behind the scenes it allows for organizers to manage and plan events. Everybody is welcome and encouraged to contribute. This can be a great way to get your feet wet with contributing to a live open-source project! Feel free to come out to our meetups if you have any questions, need some help getting started, or just want to meet some friendly people.

Contributing

We love contributions! The first thing to check are the Issues with the priority label. You can also optionally use Zenhub to see the development pipeline and issue boards and pick any issue from the "Next Up" column. When you start working on an issue, let everyone else know somehow (move the issue to the "In Progress" column in Zenhub, add the "in progress" label, or even just leave a comment saying "Got this one!"), so that we don't end up with two people developing the same feature at the same time.

Anybody is welcome to submit a pull request. See below on how to set up your machine for development and how our development process works. Once you have the app up and running, run the tests (rspec) and make sure they pass. Then write some specs and add your changes. Make the tests pass again. Then push to your fork and submit a pull request. Then, you'll be waiting on us. We try to at least comment on all pull requests within a couple of days. We might suggest some changes or improvements or alternatives. Some things you can do to increase the chances of your pull request being accepted are:

  • Make sure everything is tested
  • Follow the style and standards of the project
  • Write a good commit message
  • Discuss major features or changes before deciding on a final approach

Github also has tons of great guides (like this one on working on your own fork of a repo) about working with git and open source projects.

Style Guides

This codebase is monitored by hound CI, which automatically comments on style violations. We follow community style guides for ruby, Rails, Sass, es6, and erb. If your pull request has some comments by the hound, please fix those to speed up the review process.

Development Setup

Fork the repository and clone it to your machine then change directory into website. Rename it if you want to.

git clone git@github.com:***your-github-username***/website.git && cd website

Database

This project uses Postgresql, a free and open-source database. Google the instructions on how to install it for your operating system if you run in to any problems.

On a mac you can run:

brew install postgresql

Or on linux distro:

apt-get install postgresql

There are also various postgresql installers available for Windows.

Background jobs are queued with Sidekiq, which uses Redis, a free and open-source NoSQL database to keep track of jobs. You'll need to install Redis. Google the installation instructions for your operating system if you run in to any problems.

On a mac you can run:

brew install redis

When installing Redis on Ubuntu, make sure the config file is installed in /usr/local/etc/redis.conf instead of the default location. Creating a symlink seems to work as well.

Ruby version

The project currently uses ruby 2.3.2. You can install many versions of Ruby on your machine with a ruby environment manager. Two common ones are rbenv and rvm.

Libraries

External depenencies are managed with bundler. It will be installed when you run the bin/setup script, or if you're setting up your environment by yourself you can install it manually:

gem install bundler

Rails

The project is built with Rails, a stable and mature web framework. If you're unfamiliar with it there are tons of great tutorials out there, like Michael Hartl's Rails tutorial, or you can check out the great documentation on RailsGuides.

Setup the project

Setting environment variables

We use cloudinary for image hosting. You can sign up for a free cloudinary account to get API keys for your local development and testing environments. You need to set the CLOUDINARY_API_KEY and CLOUDINARY_API_SECRET environment variables.

The community events are pulled from our community google calendar. You need to set the GOOGLE_CALENDAR_API_KEY environment variable. To access the google calendar api you need a google api key, which you can get here.

Our events are pulled from eventbrite. You need to set the EVENTBRITE_API_TOKEN environment variable. To access eventbrite's api you need an eventbrite api key, which you can get according to these instructions.

Your environment variables should be the following:

CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
GOOGLE_CALENDAR_API_KEY=
EVENTBRITE_API_TOKEN=

This project uses the dotenv gem, so you just put these environment variables in a .env file in the root of the project and they will available to the Rails environment. Be sure to add this file to your .gitignore and never check it in to version control.

Launch your database server

You need to start your postgres server, redis server, and Sidekiq worker (if you want to process background jobs in development). You can launch these services and leave them running on your machine, or automate the process for manually starting all of them with a tool like foreman.

Setting up the project

Once you have the above dependencies installed and your database server is running, setup the project with

bin/setup

This script runs the following commands to set up your local development environment:

  • install bundler for managing gem dependencies
  • install all required gems
  • create and setup your databse
  • cleanup logs and temporary files

You can also run those steps manually.

Starting your server

Start your local server. You can run a local server with:

rails server

Unless you configure a different local host the app will be available at http://localhost:3000.

Developing a feature and submitting a pull request

In your pull request and in your branch name, specify the number of the issue you're working on. This way github will automatically close the issue(s) once the pull request has been merged.

Testing

The app is tested with RSpec. You can run all the tests with

rspec

Run a single test file by passing only the test file, or a single test example by passing the test file with the line of the test you want to run:

rspec spec/path/to/your/spec.rb
rspec spec/path/to/your/spec.rb:8  # 8 is the line number of the test you want to run.

I recommend using zeus, an external gem, to pre-load the app so your tests run instantly.

Bugs

If you find any bugs please open an issue in project's repo.

License

This app is released under the MIT License.