/PurpurDocs

This is the documentation for Purpur that uses Mkdocs to generate a static site

Primary LanguagePythonBSD 2-Clause "Simplified" LicenseBSD-2-Clause

PurpurDocs

This is the documentation for Purpur that uses Mkdocs to generate a static site hosted on https://purpurmc.org/docs. Included is a Python script that compares the diff of two commit hashes and outputs the config/permission additions/removals into a YAML file.

Building

Create and activate a Python 3 virtual environment

$ pip install --user virtualenv
$ virtualenv env
$ source env/bin/activate

Install the required packages

pip install -r requirements.txt

Preview changes

To preview your changes to the documentation, run mkdocs serve. This will start a web server that will preview the documentation and recompile it as you make changes. More info is shown here: https://www.mkdocs.org/#getting-started

$ mkdocs serve

Compare commits for config/permission additions/removals

Run the compare-commits.sh script to run an interactive script that compares between Purpur commits and generates a file of config option/permission additions/removals.

./compare-commits.sh <prev_hash> <curr_hash> You can also add two commit hashes as command line arguments and it will skip the interactive aspect of the script.
$ ./compare-commits.sh 885092 22b876
# logs/885092..22b876.yml

config:
  additions:
  - gameplay-mechanics.item.immune.cactus: new ArrayList<>()
  - gameplay-mechanics.player.fix-stuck-in-portal: 'false'
  removals:
  - projectile-load-save-per-chunk-limit: '-1'
permission:
  additions: []
  removals: []
./compare-commits.sh <prev_hash> Including only one hash will compare it to the latest commit of the branch specified (which is `ver/1.16.5` at the time of writing).
$ ./compare-commits.sh 885092
# logs/885092..ver|1.16.5.yml

config:
  additions:
  - gameplay-mechanics.item.immune.cactus: new ArrayList<>()
  - gameplay-mechanics.player.fix-stuck-in-portal: 'false'
  removals:
  - projectile-load-save-per-chunk-limit: '-1'
permission:
  additions: []
  removals: []
./compare-commits.sh --no-commits Running the script with the option `--no-commits` or `-nc` will create a `last_commit` file that includes the most recent commit at runtime. Running it again will make it use the hash located in `last_commit` as the first commit hash, replacing it with the most recent commit after generating the file.
# First time running it
$ ./compare-commits.sh -nc
# logs/885092..ver|1.16.5.yml

config:
  additions:
  - gameplay-mechanics.item.immune.cactus: new ArrayList<>()
  - gameplay-mechanics.player.fix-stuck-in-portal: 'false'
  removals:
  - projectile-load-save-per-chunk-limit: '-1'
permission:
  additions: []
  removals: []
# Creates a last_commit file
885092
# Running it again after new commits are pushed to Purpur
$ ./compare-commits.sh -nc
# logs/885092..22b876.yml

config:
  additions:
  - gameplay-mechanics.item.immune.cactus: new ArrayList<>()
  - gameplay-mechanics.player.fix-stuck-in-portal: 'false'
  removals:
  - projectile-load-save-per-chunk-limit: '-1'
permission:
  additions: []
  removals: []
# Modifies the last_commit file
22b876