Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Backend component of the Open Webslides platform

License

Notifications You must be signed in to change notification settings

OpenWebslides/openwebslides-backend

Repository files navigation

Open Webslides Travis Coverage Status

Open Webslides is an open-source co-creation platform.

Getting started

Install the following software first:

  • RVM
  • Ruby (version: see Gemfile or .ruby-version)
  • Yarn
  • NodeJS 7.6.0

Then install all backend dependencies:

$ gem install bundler --no-ri --no-rdoc
$ bundle install

Initialize and update the git submodules:

$ git submodule init
$ git submodule update

To update the frontend module, use:

$ cd web
$ git pull

And install all frontend dependencies:

$ cd web
$ yarn install

Enable git pre-commit hooks:

$ bundle exec overcommit --install

When the overcommit configuration changes (and on the first run), you have to verify it:

$ bundle exec overcommit --sign

Development

Start the Rails server

$ bundle exec rails db:migrate
$ bundle exec rails server

Use RuboCop to enforce code conventions:

$ bundle exec rubocop --rails

Use RSpec to run tests:

$ bundle exec rails db:drop RAILS_ENV=test
$ bundle exec rails db:create RAILS_ENV=test
$ bundle exec rails db:migrate RAILS_ENV=test
$ bundle exec rspec

If you want to fill the development database with sample data:

$ bundle exec rails db:drop RAILS_ENV=development
$ bundle exec rails db:create RAILS_ENV=development
$ bundle exec rails db:migrate RAILS_ENV=development
$ bundle exec rails db:sample RAILS_ENV=development

There is a Rake task for generating JWTs with a long lifetime for developing:

$ # Use the user ID as argument
$ bundle exec rails token:generate[1]
$ # Or if you're using zsh
$ bundle exec rails 'token:generate[1]'

Documentation

The application structure, operations manual and API documentation is located here.