Skip to content

hpi-swt2/lecture-portal

Repository files navigation

lecture-portal

Build Status License: MIT mergify-status

Web application for organizing and managing lecture participation, written in Ruby on Rails. Created in the Software Engineering II course at HPI in Potsdam.
Productive url: https://hpi-lectureportal.herokuapp.com/ (will be deployed on every push to master) Test url: https://hpi-lectureportal-dev.herokuapp.com/ (will be deployed on every push to dev)

Setup

  • Ensure Ruby v2.5.1 (ruby -v) with rbenv or RVM
  • Ensure Bundler v2.0.2 (bundle -v) with gem install bundler -v 2.0.2
  • bundle install --without production Install the required Ruby gem dependencies defined in the Gemfile, skipping gems used for production (like pg)
  • rails db:migrate db:seed Setup database, run migrations, seed the database with defaults
  • rails s Start the Rails development server (By default runs on localhost:3000)
  • bundle exec rspec Run all the tests (using the RSpec test framework)
  • Set the environment variable SECRET_KEY to the secret value that lecturers should enter to gain lecturer privilege. If it is not set, the secret key is IAmALecturer.

Developer Guide

Setup

  • bundle exec rails db:migrate RAILS_ENV=development && bundle exec rails db:migrate RAILS_ENV=test Migrate both test and development databases
  • bundle exec rails assets:clobber && bundle exec rails assets:precompile Redo asset generation

Testing

  • To run the full test suite: bundle exec rspec.
  • For fancier test running use option -f doc
  • bundle exec rspec spec/<rest_of_file_path>.rb Specify a folder or test file to run
  • specify what tests to run dynamically by -e 'search keyword in test name'
  • bundle exec rspec --profile examine how much time individual tests take

Linting

  • RuboCop is a Ruby static code analyzer and formatter, based on the community Ruby style guide
  • It is installed in the project. Run bundle exec rubocop to find possible issues.
  • Use --auto-correct to fix what can be fixed automatically.
  • The behavior of RuboCop can be controlled via a .rubocop.yml configuration file

Debugging

  • rails c --sandbox Test out some code in the Rails console without changing any data rails dbconsole Starts the CLI of the database you're using
  • bundle exec rails routes Show all the routes (and their names) of the application
  • bundle exec rails about Show stats on current Rails installation, including version numbers

Generating

  • rails g migration DoSomething Create migration _db/migrate/*DoSomething.rb.