A Ruby on Rails app to manage sport matches
Branch | Travis CI | Code Coverage | Code Analysis | Heroku Deploy | Errbit |
---|---|---|---|---|---|
dev (default) | [link] | [link] | |||
master | [link] | [link] |
When all tests succeed on Travis CI, the application is deployed to Heroku. Click the badges for detailed info.
Errors that occur while using the deployed master branch on Heroku are logged to the Errbit error catcher, you can sign in with your Github account.
You can setup the project either locally, i.e. directly on your system, or using a VM (e.g. when on Windows). Please keep in mind that using a VM may lead to a loss in performance, due to the added abstraction layer.
- Clone this repository
cat .ruby-version && echo $(ruby --version)
See if locally installed ruby version matches the one specified in the.ruby_version
file.- If the ruby version is different: Install the required version using rbenv (recommended) or RVM
gem install bundler
Install bundler for managing Ruby gemsbundle install
Install the required Ruby gem dependencies defined in the Gemfile (if there are any errors, ensure that the following packages are installed:libpq-dev
,libsqlite3-dev
,g++
, if you are on MacOS you runbundle install --without production
to skip thelibpq-dev
dependency)rake db:create db:migrate db:seed
Setup database, run migrations, seed the database with defaultsrspec
Run all the tests (using the RSpec test framework)rails s
Start the Rails development server (runs onlocalhost:3000
by default)
- Install a Virtual Machine provider, we recommend VirtualBox
- Install Vagrant which makes setting up the VM easier. The Vagrantfile in this repo provides the configuration for the VM
- Clone this repository and change to the created folder
vagrant up
Download and provision the VMvagrant ssh
SSH into the VMcd hpi-swt2
Change into the repo folder, mounted from your local machinegem install bundler
Install bundler for managing Ruby gems (it is itself a gem)bundle install
Install the required Ruby gem dependencies defined in the Gemfilebundle exec rails s -b 0
Start the rails server, don't drop non-local requests (-b)- Open
localhost:3000
on the host machine, port 3000 (the default server port) is forwarded from the VM vagrant suspend
issued from the host, suspends the VM (halt
shuts down)
All libraries employed in this project are listed in the project's Gemfile
. Some potentially useful ones for the future are commented out. The most important ones currently used are:
devise
(docs) Authentication solution for Rails, responsible for session management, logging users in and out, etc.omniauth
(docs) Provides standardized multi-provider authentication, could be useful for openID authenticationcancancan
(docs) Authorization library which restricts what resources a given user is allowed to access. All permissions are defined in an 'Ability' file (app/models/ability.rb
) and do not have to be duplicated.factory_bot_rails
(docs) Fixture replacement, build objects using factoriesjquery-rails
(docs) Use jQuery as the JavaScript librarytwitter-bootstrap-rails
(docs) Use Bootstrap CSS toolkitturbolinks
(docs) Turbolinks speeds up page loads using AJAX. No server-side cooperation necessary. It automatically fetches the page, swaps in its<body>
and merges its<head>
, without the cost of a full page loadhas_scope
(docs) Map incoming controller parameters to named scopes in resources
bundle exec <command>
Run command within the context of the current gemsetrspec spec/controller/expenses_controller_spec.rb
Specify a folder or test file to runbundle exec annotate
Add a comment summarizing the current schema to the top of filesbundle exec rubocop
Run static code analysis for code smells based on.rubocop.yml
configrails c
Run the Rails consolerails c --sandbox
Test out some code without changing any datarails g migration DoSomething
Create migration _db/migrate/*DoSomething.rb.rails dbconsole
Starts the CLI of the database you're usingrake routes
Show all the routes (and their names) of the applicationrails assets:precompile
Precompile the assets in app/assets to public/assetsrake about
Show stats on current Rails installation, including version numbersrspec --profile
examine how much time individual tests take- Put
<%= console %>
anywhere in a view to render an interactive console session (provided by 'web-console' gem) - Put
byebug
anywhere in ruby code to start a debugging session (provided by 'byebug' gem)
Required environment variables for file storage:
S3_BUCKET_NAME
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION