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.
Imperial uses Ruby version 3.2.2, Redis (> 4.0), PostgreSQL, and NodeJS.
To run Imperial on your local machine, please follow these instructions:
- Clone the repo:
git clone https://github.com/Thrillberg/imperial.git
- Change directory into the
imperial
directory:
cd imperial
- Begin the PostgreSQL service:
- If installed through
brew
brew services start postgresql
- If installed through
apt
sudo service postgresql start
- Start a Redis server:
- If installed through
brew
,
brew services start redis
- If installed through
apt
, in a separate terminal
redis-server
- 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 toLF
instead ofCRLF
.
- Run the npm install command:
npm install
- In one terminal window, run webpack:
bin/webpack --watch
- Keep webpack running and in a separate terminal window, run the Rails server:
rails s
- 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.
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
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.
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.
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.