From 5e8dfc808d0a0f4068fdebd917a1c3db2d1fe3d9 Mon Sep 17 00:00:00 2001 From: Ev-1 <33662061+Ev-1@users.noreply.github.com> Date: Thu, 29 Dec 2022 20:18:07 +0100 Subject: [PATCH] Add justfile for simple command running --- justfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..a9baf00 --- /dev/null +++ b/justfile @@ -0,0 +1,53 @@ +env_name := "venv" +python := "./" + env_name+'/bin/python3' + +default: + @just --list + +# Make a new virtual environment +[private] +make_venv: + python3.10 -m venv {{env_name}} + {{python}} -m pip install --upgrade pip + {{python}} -m pip install -r requirements.txt + {{python}} -m pip install flake8 + {{python}} -m pip install isort + {{python}} -m pip install pytest + +# Make the environment if it does not exit +[private] +@venv: + [ -d {{env_name}} ] || just make_venv + +# Run the bot +run: venv + {{python}} bot.py + +# Run with debug logging enabled +debug: run + --debug + +clean: + rm -rf {{env_name}} +# Lint with flake8 +flake: venv + {{python}} -m flake8 bot.py musicbot + +# Fix import order with isort +isort: venv + {{python}} -m isort --sp setup.cfg bot.py musicbot + +# Run both isort and flake8 +lint: venv + just isort + just flake + +# Run tests +test: venv + {{python}} -m pytest + +# Run lints and test +pre_commit: venv + just lint + just test +