/VGDatabase

VGDatabase (VGDB) is a platform designed and built for gamers by gamers. This site is made for an University project in Rails and it's currently hosted on Heroku.

Primary LanguageRuby

logo/logo-normal.png VGDatabase (VGDB) is a platform designed and built for gamers by gamers.

The site is based on a videogames database, where you can view many information about any games such as genre, developer, date of release, score and the reviews written by other users, with an additional external link for the purchase. The platform also provides a search functions by title or by genre, and a search for registered users. In addition, the site is updated periodically, always showing in the homepage the most popular games at the moment. Each user has his own library of games, a friends list and the possibility to group games and friends in Favorites lists. Enjoy!

The site is now live, check it out!

Authors

Dependencies

In order to build and run the Rails server in your machine, you must have installed:

  • Ruby 2.4
  • Rails 6
  • Bundler 2
  • Postgres 9 or above
  • JavaScript (any version)

Rails app setup

In order to successfully run the project, you have to obtain a valid API key on these services:

To build and run the Rails app, go into the root folder of the repo and run the following commands:

  • Build and install all required Gems included in Gemfile:

    Bundle install
  • Initialize Figaro gem, to store securely store your OAuth credentials:

    figaro install
  • To show your secret key, copy it as you will use it later:

    rake secret
  • To enter your OAuth credentials and API keys, open the file /config/application.yml created with 'Figaro install', and append at the end of file as following:

    STEAM_WEB_API_KEY: '[your-steam-api-key-here]'
    SECRET_TOKEN: '[your-rake-secret-key-here]'
    
    GOOGLE_CLIENT_ID: '[your-google-client-id-here].apps.googleusercontent.com'
    GOOGLE_CLIENT_SECRET: '[your-google-api-key-here]'
  • Insert your IGDB API key in the credentials file with:

    EDITOR='[any-IDE-here] --wait' rails credentials:edit

    And append at the end of the file that opens up the following code:

    maps:
      igdb: '[your-igdb-api-key-here]'
  • Edit in /config/database.yml the username and password with the one you have set in your local machine.

  • Ensure that the Postgres service is started:

    sudo service postgresql start
  • Initialize the db:

    rake db:reset
  • Execute database migrations:

    rake db:migrate

Rails app usage

After the first setup, execute these commmands to start the server and deploy the application:

  • Start the rails server:

    rails server
  • Then simply go on this page with your browser of choice and you're done!

    localhost:3000/login

Cucumber & RSpec testing

This project also includes several test cases to test the functioning of the main functions of the site. A detailed description of each test and what they do is avaiable here. To execute them, you need to launch respectively:

  • Cucumber test:

    cucumber ./features/*.feature
  • RSpec test:

    bundle exec rspec ./spec/*_spec.rb

Other useful command

  • Run the integrated Rails console

    rails console
  • View all the routes created in the project

    rails routes
  • Drop and recreate the schema and the tables

    rake db:reset
  • Execute database table migrations that are pending

    rake db:migrate