Skip to content

pinballmap/pbm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

codecov

Code License: License: GPL v3

The GPL v3 license applies to the code in this repository.

Data License: License: CC BY-SA 4.0

The data is not included in this repository. Rather, it is accessed via the public API. This data is under a CC BY-SA license (and not GPL v3). Amongst other things, this license requires attribution when using the data.

ko-fi

sweet pinballin' brah

This repo is the codebase for pinballmap.com. The code for the Pinball Map mobile app is here. If you have an app issue, please use that repo.

API Documentation

Available here: http://pinballmap.com/api/v1/docs

Mac Environment Setup

  1. Fork it on Github. Then:
  • git clone https://github.com/{you}/pbm.git
  • git remote add upstream git://github.com/pinballmap/pbm.git
  1. Install the correct ruby version

  2. Install dependencies

  • bundle install
  • selenium install
  • brew update
  1. Install and configure the database
  • Download Postgres App.
  • cp config/database.yml.example config/database.yml to create your database.yml for development
  • brew install postgresql
  • initdb /usr/local/var/postgres -E utf8
  • CREATEDB pbm_dev
  • bin/rake db:create ; RAILS_ENV=test bin/rake db:create
  • bin/rake db:migrate ; RAILS_ENV=test bin/rake db:migrate
  1. Run the development server
  • bin/rails s
  1. Run the tests
  • bundle exec rspec

Run tests: bundle exec rspec

  1. Run the debug server
  • Start server: bin/debug
  • Install VSCode command line tools via command palette. From the VSCode top Menu: View | Command Palette then search for: Shell Command: Install 'code' command in path
  • Attach via VSCode debugger and set breakpoints
  1. Get a database dump from Scott. Then:
  • pg_restore --verbose --clean --no-acl --no-owner -h localhost -d pbm_dev dump.file

If the site loads properly it will be an empty version of pinballmap.com, then ask Scott for a data dump so you can have a full set of data to work with.

Linux Setup

  1. Fork it. Then:
  • clone https://github.com/{you}/pbm.git
  • git remote add upstream git://github.com/pinballmap/pbm.git
  1. Install postgresql.

  2. Setup postgres:

  • createuser --interactive
  • createdb pbm_dev
  1. Install the correct ruby version
  • gem install bundler
  • bundle install
  • cp config/database.yml.example config/database.yml to create your database.yml for development
  • bin/rake db:create ; RAILS_ENV=test bin/rake db:create
  • bin/rake db:migrate ; RAILS_ENV=test bin/rake db:migrate
  1. Get a database dump from Scott. Then:
  • pg_restore --verbose --clean --no-acl --no-owner -h localhost -d pbm_dev dump.file

Start server: bin/rails s

Run tests: bundle exec rspec

Docker Setup

Prerequisites

  • Docker >= v1.12.0+
  • Docker-Compose (comes with Docker for Mac. Separate install on Linux)
  • Optional: direnv or some other way to source environment variables to override default ports in case of conflict

Usage

Fully Containerized

  • Run docker-compose up -d to start containers
  • Navigate to localhost:$PORT (either specified, or defaults to 3000)
  • Bring down containers with docker-compose down
    • By default, the database will keep its state as a docker volume. If you want to start fresh, run docker-compose down -v to destroy the volume. The next time you bring up this docker-compose file, db:create and db:migrate will re-populate the database.

Postgres only

If you just want to run postgres in a container and use your local filesystem for running Rails, you can use the postgres only compose file.

  • Run docker-compose -f docker-compose.postgres.yml up -d
  • If first time running, run bin/rake db:create db:migrate to populate the postgres container.
  • Bring down containers with docker-compose -f docker-compose.postgres.yml down
    • By default, the database will keep its state as a docker volume. If you want to start fresh, run docker-compose -f docker-compose.postgres.yml down -v to destroy the volume.