README

Intro

Time for the Planet is a website to help raise money and find entrepreneurs to create companies dedicated to fight climate change.

Purchasing shares is done using a Typeform, whose link is found on this page.

Projets content is controlled by editors via a CMS.

Check the website : https://www.time-planet.com

Technical stack

Time for the Planet is developped using Ruby on Rails.

For JavaScript, it uses the framework Stimulus.

Editor can publish new contents using Active Admin with the theme Arctic Admin.

A continuous integration system is set up using Circle CI to launch tests from Github. The website is deployed through Heroku. Errors are catched with Sentry.

Sidekiq is used for background processing.

Style

Grid

This website uses only the grid system of Bootstrap

BEM

For CSS, we use the BEM (Block Element Modifier) methodology. The principle is to organize CSS code by component (the Block), then by Elements of the components, and then create variants (the Modifiers) if needed. We use SCSS, so the different classes should be nested.

Example :

# app/assets/stylesheets/components/_card.scss

.Card {
  display: flex;
  padding: 1 rem;
  border-radius: 3px;
  
  &--dark {
    background-color: $black;
    color: $white;
  }
  
  &--light {
    background-color: $white;
    color: $black;
  }
  
  &-title {
    font-weight: bold;
    font-size: 1.5;
  }
  
  &-content {
    font-size: 1rem
    
    &--dark {
      color: $light-grey;
    }
  
    &--light {
      color: $dark-grey;
    }
  }
}

Install project

Clone the repository

git clone git@github.com:EmmanuelleN/time-planet.git
cd mon-time-planet

Check you Ruby version

ruby -v

The ouput should start with something like ruby 2.6.5

If not, install the right ruby version using rbenv (it could take a while):

rbenv install 2.6.5

Install dependencies

Using Bundler and Yarn:

bundle && yarn

Environment variables

The environment variables are set using the dotenv gem. To get the variables, contact the developper at emmanuelle@nada.computer (sensitive data).

Initialize the database

rails db:create db:migrate db:seed

Add Heroku remote

Using the command line:

heroku git:remote -a time-planet

Serve

Start rails server :

rails s

Start sidekiq to enable background processing

sidekiq

Deploy

Deploy to production :

git push heroku master

Be careful when deploying, always add new environment variables to Heroku before deploying, and migrate the database and restart > the server after deploying if needed.

Code Style

This project uses rubocop with a configuration taken from standard

To check your code style :

bundle exec rubocop

Content

A default call to action is defined for contents using env variable DEFAULT_CTA_ID