From 48b0dc70b926920781f1af57bf36a2bd5d139624 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Mon, 8 Apr 2024 10:25:55 +0200 Subject: [PATCH] Add Makefile --- Makefile | 10 ++++++++++ README.md | 19 ++++++++----------- devenv.nix | 12 ++---------- 3 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c51f022 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +.PHONY: build test + +build: + pyinstaller --clean --noconfirm schwifty.spec + +test: + @$(DEVENV_ROOT)/.venv/bin/python $(DEVENV_ROOT)/schwifty-cli/__main__.py "DE89370400440532013000" | jq '.' + +test-binary: + @$(DEVENV_ROOT)/dist/schwifty "DE89370400440532013000" | jq '.' \ No newline at end of file diff --git a/README.md b/README.md index 6c1decd..2e6333d 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,14 @@ git clone https://github.com/LN-Zap/schwifty-cli.git cd schwifty-cli ``` -If you have [`devenv`](https://devenv.sh/) and [`direnv`](https://direnv.net/) setup, the Schwifty development environment should activate automatically on entering the project directory. If not, install those dependencies. - -## Development - -To run the Schwifty CLI in development mode (direct from the source code in the `schwifty-cli` directory), use the following command in the terminal: -```bash -schwifty-src [IBAN] -``` +If you have [`devenv`](https://devenv.sh/) and [`direnv`](https://direnv.net/) setup, the Schwifty development environment should activate automatically on entering the project directory. If not, install those dependencies. Alternativly, install the Python and Poetry project dependencies. ## Build To build the Schwifty CLI (using PyInstaller), run the following command in the terminal: -``` -build +```bash +make build ``` ## Test @@ -33,11 +26,15 @@ build To run the tests for the Schwifty CLI, use the following command in the terminal: ```bash -devenv test +make test ``` ## Usage +To run the Schwifty CLI direct from the source code, run the following command in the terminal: +```bash +schwifty-src [IBAN] +``` To use the Schwifty CLI, run the following command in the terminal: diff --git a/devenv.nix b/devenv.nix index db8bd1c..61ff67a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -12,19 +12,11 @@ ]; enterTest = '' - build - tree build -L 3 - tree dist -L 3 - - echo "testing source..." - schwifty-src "DE89370400440532013000" | jq '.' - - # echo "testing binary..." - # schwifty "DE89370400440532013000" | jq '.' + make build + make test ''; # https://devenv.sh/scripts/ - scripts.build.exec = "pyinstaller --clean --noconfirm schwifty.spec"; scripts.schwifty.exec = "$DEVENV_ROOT/dist/schwifty $@"; scripts.schwifty-src.exec = "$DEVENV_ROOT/.venv/bin/python $DEVENV_ROOT/schwifty-cli/__main__.py $@";