A Ruby on Rails app to manage sport matches
| Branch | Travis CI | Code Coverage | Code Analysis | Heroku Deploy | Errbit |
|---|---|---|---|---|---|
| dev (default) | [link] | ||||
| master | [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_versionfile.- If the ruby version is different: Install the required version using rbenv (recommended) or RVM
gem install bundlerInstall bundler for managing Ruby gemsbundle installInstall 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 productionto skip thelibpq-devdependency)rake db:create db:migrate db:seedSetup database, run migrations, seed the database with defaultsrspecRun all the tests (using the RSpec test framework)rails sStart the Rails development server (runs onlocalhost:3000by 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 upDownload and provision the VMvagrant sshSSH into the VMcd hpi-swt2Change into the repo folder, mounted from your local machinegem install bundlerInstall bundler for managing Ruby gems (it is itself a gem)bundle installInstall the required Ruby gem dependencies defined in the Gemfilebundle exec rails s -b 0Start the rails server, don't drop non-local requests (-b)- Open
localhost:3000on the host machine, port 3000 (the default server port) is forwarded from the VM vagrant suspendissued from the host, suspends the VM (haltshuts 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.rbSpecify a folder or test file to runbundle exec annotateAdd a comment summarizing the current schema to the top of filesbundle exec rubocopRun static code analysis for code smells based on.rubocop.ymlconfigrails cRun the Rails consolerails c --sandboxTest out some code without changing any datarails g migration DoSomethingCreate migration _db/migrate/*DoSomething.rb.rails dbconsoleStarts the CLI of the database you're usingrake routesShow all the routes (and their names) of the applicationrails assets:precompilePrecompile the assets in app/assets to public/assetsrake aboutShow stats on current Rails installation, including version numbersrspec --profileexamine how much time individual tests take- Put
<%= console %>anywhere in a view to render an interactive console session (provided by 'web-console' gem) - Put
byebuganywhere in ruby code to start a debugging session (provided by 'byebug' gem)
Required environment variables for file storage:
S3_BUCKET_NAMEAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION