main
branch:
, live app: Heroku
A web application for finding your way, written in Ruby on Rails. Created in the Scalable Software Engineering course at the HPI in Potsdam.
Ensure you have access to a Unix-like environment through:
- Your local Linux / MacOS installation
- Using the Windows Subsystem for Linux (WSL)
- Using a VM, e.g. Virtualbox and Vagrant
- Using a docker container
ruby --version
Ensure Ruby v2.7.4 using rbenv or RVMsqlite3 --version
Ensure SQLite3 database installationnode --version; yarn --version
Ensure Node.js and Yarn installationbundle --version
Ensure Bundler installation (gem install bundler
)bundle config set without 'production' && bundle install
Install gem dependencies fromGemfile
yarn install
Install JS dependencies frompackage.json
rails db:migrate
Setup the database, run migrationsrails db:reset
Seeds the databaserails s
Start dev server (default port 3000 required for local HPI OpenID Connect)bundle exec rspec --format documentation
Run the tests (using RSpec framework)
rails db:migrate
rails db:reset
- Fontawesome icons
- Bootstrap for layout and styling
- Devise library for authentication
- OmniAuth & OmniAuth OpenID Connect for HPI OpenID
- FactoryBot to generate test data
- Capybara for feature testing
- shoulda for additional RSpec matchers
bundle exec rails db:migrate RAILS_ENV=development && bundle exec rails db:migrate RAILS_ENV=test
Migrate both test and development databasesrails assets:clobber && rails webpacker:compile
Redo asset compilation
To use the map's routing capabilities, you will need an access token for the Mapbox directions API. Place this token in an environment variable called MAPBOX_ACCESS_TOKEN
bundle exec rspec
Run the full test suite--format doc
More detailed test output-e 'search keyword in test name'
Specify what tests to run dynamically--exclude-pattern "spec/features/**/*.rb"
Exclude feature tests (which are typically fairly slow)
bundle exec rspec spec/<rest_of_file_path>.rb
Specify a folder or test file to runbundle exec rspec --profile
Examine run time of tests- Code coverage reports are written to
coverage/index.html
after test runs (by simplecov)
rake factory_bot:lint
Create each factory and catch any exceptions raised during the creation process (defined inlib/tasks/factory_bot.rake
)bundle exec rubocop
Use the static code analyzer RuboCop to find possible issues (based on the community Ruby style guide).--auto-correct
to fix what can be fixed automatically.- RuboCop's behavior can be controlled using
.rubocop.yml
console
anywhere in the code to access an interactive consolesave_and_open_page
within a feature test to inspect the state of a webpage in a browserrails c --sandbox
Test out some code in the Rails console without changing any datarails dbconsole
Starts the CLI of the database you're usingbundle exec rails routes
Show all the routes (and their names) of the applicationbundle exec rails about
Show stats on current Rails installation, including version numbers
rails g migration DoSomething
Create migration _db/migrate/*DoSomething.rbrails generate
takes a--pretend
/-p
option that shows what will be generated without changing anything
config/initializers/devise.rb
contains the OmniAuth OpenID Connect config for the HPI OIDC service- An OpenID Connect client for
localhost:3000
is set up for local development. Additional clients registrable at oidc.hpi.de - For deployment
OPENID_CONNECT_CLIENT_ID
,OPENID_CONNECT_CLIENT_SECRET
&OPENID_CONNECT_REDIRECT_URI
need to be provided app/controllers/users/omniauth_callbacks_controller.rb
handles data returned by the OIDC service