Skip to content

Thrillberg/imperial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributor Covenant

Imperial

This is an implementation of the board game, Imperial.

It can be played in production at playimperial.club.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Local development setup

Imperial uses Ruby version 3.2.2, Redis (> 4.0), PostgreSQL, and NodeJS.

To run Imperial on your local machine, please follow these instructions:

  1. Clone the repo:
git clone https://github.com/Thrillberg/imperial.git
  1. Change directory into the imperial directory:
cd imperial
  1. Begin the PostgreSQL service:
  • If installed through brew
brew services start postgresql
  • If installed through apt
sudo service postgresql start
  1. Start a Redis server:
  • If installed through brew,
brew services start redis
  • If installed through apt, in a separate terminal
redis-server
  1. Run the Rails setup command:
bin/setup
  • If you get the error PG::InsufficientPrivilege: ERROR: permission denied to create extension "pgcrypto" run this command:
sudo su postgres -c "psql rails_server_development -c 'CREATE EXTENSION pgcrypto;'"
  • If you get the error ‘ruby\r’: No such file or directory, make sure your editor's line-endings are set to LF instead of CRLF.
  1. Run the npm install command:
npm install
  1. In one terminal window, run webpack:
bin/webpack --watch
  1. Keep webpack running and in a separate terminal window, run the Rails server:
rails s
  1. You can now view the app at
localhost:3000/

If any of the above instructions did not work for you, please do not hesitate to open an issue.

Running tests

To run JS tests, run the following command from the project root:

npm test

To run Ruby RSpec tests, run the following command from the project root:

rspec

This project also uses Cypress for feature tests. These tests have not been maintained, however. To run these tests, run the following command from the project root:

bin/webpack
./test_server

And in another terminal:

npm run cypress

Local debugging

Production games will often present situations that are hard to reproduce locally and therefore get challening to debug. Therefore, we have implemented the ability to export and import games.

Exporting a game

Visit /exports/[game_id] and a JSON file will be downloaded to your computer. This file contains the game log and can be used when importing a game.

Importing a game

Visit http://localhost:3000/import_game and paste the contents of the downloaded JSON in the box and click Import game. This will reconstruct the game locally in your database and let you play around with it and, hopefully, improve debugging.