From 346ddace86019be8bb79cb44e35bffbfb91bf463 Mon Sep 17 00:00:00 2001 From: Kirill Sulim Date: Fri, 21 Oct 2022 11:43:48 +0500 Subject: [PATCH] Add simple how-to to README.md --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 17728f5..3bb7b4b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,57 @@ # oak-build A make-like build system written on python + + +## How to use + +Create `oak_build.py` file in your project directory. +Every method marked with `@task` decorator can be called from CLI. + +```python +from pathlib import Path + +from oak_build import task + + +@task +def create_file(): + with open(Path("result.txt"), "w") as txt: + txt.write("test content\n") +``` + +To execute `create_file` task call `oak create_file` from console. + +## Task dependencies + +You can link dependent tasks with `depends_on` parameter. + +```python +from oak_build import task, run + + +@task +def unit_tests(): + run("poetry run pytest tests") + + +@task +def integration_tests(): + run("poetry run pytest integration_tests") + + +@task( + depends_on=[ + unit_tests, + integration_tests, + ] +) +def tests(): + pass +``` + +When `oak tests` is called oak build will execute `unit_tests` and `integration_tests` tasks as well. + +## Examples + +For examples see [integration tests files](integration_tests/resources) and self build [oak_file.py](oak_file.py). diff --git a/pyproject.toml b/pyproject.toml index 6a10921..d4bc8cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "oak-build" -version = "0.1.1" +version = "0.1.1.post1" description = "" authors = ["Kirill Sulim "] readme = "README.md"