From 48edc620de7c6bbe791d690168392f50f02c328e Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 2 Dec 2021 01:24:31 +0100
Subject: [PATCH] Update installation instructions

---
 INSTALL_INSTRUCTIONS    | 59 +++++++++++++++++++++++++++++++++++++++++
 README.md               |  2 +-
 client/README.md        | 36 ++-----------------------
 client/download_objects | 23 ----------------
 server/README.md        | 37 +++-----------------------
 5 files changed, 65 insertions(+), 92 deletions(-)
 create mode 100644 INSTALL_INSTRUCTIONS
 delete mode 100644 client/download_objects

diff --git a/INSTALL_INSTRUCTIONS b/INSTALL_INSTRUCTIONS
new file mode 100644
index 00000000..c560b1fb
--- /dev/null
+++ b/INSTALL_INSTRUCTIONS
@@ -0,0 +1,59 @@
+### DOWNLOAD REPO ###
+
+git clone git@github.com:yagu0/vchess.git
+# or https version: git clone https://github.com/yagu0/vchess.git
+cd vchess
+
+### SERVER ###
+
+cd server/db
+# Next line doesn't work, but should (?!); anyway typing in SQLite works.
+sqlite3 vchess.sqlite '.read create.sql ; .read populate.sql'
+# Rename dbconnect.py.dist --> dbconnect.py and edit DB path on line 7
+# Then synchronize the GameStat table:
+./sync_gamestat.py
+
+cd ../config
+# Rename and edit parameters.js.dist --> parameters.js
+# Rename and edit discord.json.dist --> discord.json
+# NOTE: token *must be empty* locally in dev mode
+
+cd ..
+npm i
+npm start
+
+### CLIENT ###
+
+cd client/src
+# Rename and edit parameters.js.dist --> parameters.js
+# NOTE: parameters here and in server/config should be intuitive enough.
+#       if not, ask me or check in code :)
+
+# Next step is just "git fat init && git fat pull" if I have your ssh key.
+# NOTE: you should use your own strategy then, for binary files.
+wget -r --no-parent https://xogo.fr/images/pieces/Eightpieces/tmp_png/
+wget -r --no-parent https://xogo.fr/images/pieces/Otage/
+wget -r --no-parent https://xogo.fr/images/pieces/Pacosako/
+wget -r --no-parent https://xogo.fr/images/pieces/Titan/
+rsync -a --exclude=index.html xogo.fr/images/ public/images/
+wget -r --no-parent https://xogo.fr/variants/Empire/
+wget -r --no-parent https://xogo.fr/variants/Orda/
+wget -r --no-parent https://xogo.fr/variants/Xiangqi/
+rsync -a --exclude=index.html xogo.fr/variants/ public/variants/
+wget -r --no-parent https://xogo.fr/sounds/
+rsync -a --exclude=index.html xogo.fr/sounds/ public/sounds/
+rm -rf xogo.fr
+wget -O public/favicon.ico https://xogo.fr/favicon.ico
+
+# Generate Emergo + Avalam pieces
+cd public/images/pieces/Emergo
+./generateSVG_simple.py
+./generateSVG_composite.py
+cd ../Avalam
+./generateSVG.py
+
+cd ../../../../
+npm i
+npm run serve
+# In production, use 'npm run build' and serve dist/ folder
+# NOTE: this dist/ folder is symlinked as server/static.
diff --git a/README.md b/README.md
index a57c1c1e..04776c03 100644
--- a/README.md
+++ b/README.md
@@ -18,4 +18,4 @@ If you feel comfortable with the code a pull request is a good start too.
 
 ### Running the website locally
 
-Follow the instructions in server/README.md first, and then in client/README.md.
+Follow the instructions in INSTALL\_INSTRUCTIONS.
diff --git a/client/README.md b/client/README.md
index 2c1caabd..e943f2cf 100644
--- a/client/README.md
+++ b/client/README.md
@@ -1,40 +1,8 @@
 # vchess-client
 
-## Project setup
+## Setup
 
-Rename and edit src/parameters.js.dist into parameters.js. Then,
-download the folders and files listed in download\_objects file.
-(This is optional, most variants will work without it).
-
-For Emergo and Avalam, run generateSVG\*.py scripts in folder
-public/images/pieces/Emergo and Avalam (pieces SVGs).
-
-Finally install dependencies.
-```
-npm install
-```
-
-### Compiles and hot-reloads for development
-
-```
-npm run serve
-```
-
-### Compiles and minifies for production
-
-```
-npm run build
-```
-
-### Lints and fixes files
-
-```
-npm run lint
-```
-
-### Customize configuration
-
-See [Configuration Reference](https://cli.vuejs.org/config/).
+See main INSTALL\_INSTRUCTIONS file.
 
 ## Resources
 
diff --git a/client/download_objects b/client/download_objects
deleted file mode 100644
index ff78bda6..00000000
--- a/client/download_objects
+++ /dev/null
@@ -1,23 +0,0 @@
-# NOTES to restore binary files
-# (They are normally retrieved using git-fat, but it won't work if I don't know you)
-
-* Full folders (these are supposed to be temporary)
-
-client/public/images/pieces/Eightpieces/tmp_png
-client/public/images/pieces/Otage
-client/public/images/pieces/Pacosako
-client/public/images/pieces/Titan
-
-* And some files (permanent)
-
-client/public/variants/Empire/EagleMoves.png
-client/public/variants/Empire/Board.png
-client/public/variants/Orda/Falcon.png
-client/public/variants/Orda/Archer.png
-client/public/variants/Orda/Orda.png
-client/public/variants/Orda/Kheshig.png
-client/public/variants/Orda/Lancer.png
-client/public/variants/Orda/Yurt.png
-client/public/variants/Xiangqi/HorseDiagram.png
-client/public/variants/Xiangqi/Boards.png
-client/public/variants/Xiangqi/ElephantDiagram.png
diff --git a/server/README.md b/server/README.md
index ed41ad95..c75d01c5 100644
--- a/server/README.md
+++ b/server/README.md
@@ -1,41 +1,10 @@
 # vchess-server
 
-Instructions to run the server locally.
+## Setup
+
+See main INSTALL\_INSTRUCTIONS file.
 
 ## Requirements
 
 - Node.js + npm (any recent version)
 - SQLite (version 3)
-
-## Installation
-
-1. Execute db/\*.sql scripts to create and fill db/vchess.sqlite
-
-```
-cd server/db
-sqlite3 vchess.sqlite
-sqlite> .read create.sql
-sqlite> .read populate.sql
-sqlite> .exit
-```
-
-2. Rename and edit `db/dbconnect.py.dist` into `db/dbconnect.py`.
-Then synchronize the GameStat table:
-
-```
-./sync_gamestat.py
-```
-
-2. Rename and edit `config/parameters.js.dist` into `config/parameters.js`
-
-3. Install npm modules
-
-```
-npm install
-```
-
-## Running
-
-```
-npm start
-```
-- 
2.44.0