Skip to content

Commit 557a411

Browse files
committed
Clean up docs with exercise utils
1 parent 372790a commit 557a411

File tree

6 files changed

+57
-4
lines changed

6 files changed

+57
-4
lines changed

docs/architecture/deployment-pipeline.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ The versioning is done as follows: `<major>.<minor>.<patch>` where
2323
The app automatically checks for the latest version published and warns users if their local version is out of date if the `<major>` or `<minor>` versions are wrong.
2424

2525
If you do not have permissions to push a new tag, contact <[email protected]> for assistance.
26+
27+
{: .note }
28+
29+
For more information for packaging for Linux, refer to [this Notion page](https://woojiahao.notion.site/linux-packaging-226f881eda0580d68bc8dc6f8e1d5d0d?source=copy_link).

docs/contributing/exercise.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ The `download.py` contains the instructions to setup the local repository.
4545

4646
For more information about how Git-Mastery downloads exercises, refer to the [Download Workflow](/developers/docs/architecture/download-workflow)
4747

48-
The default download script comes with a helper function to `run_command` to run local command, and a command to attach a tag as the "start tag". This is only useful if you want to iterate through the user's commits in your verification script. Otherwise, this can be removed.
48+
{: .note }
49+
50+
> `exercises` comes with a set of utility functions in the `exercise_utils` module that are made available during the download flow. They provide simple wrappers around common functionality such as `exercise_utils.cli.run_command` to invoke any command and `exercise_utils.file.create_or_update_file` to create or update a given file.
51+
>
52+
> For the full list of utility functions, refer [here](/developers/docs/tooling/exercise-utils).
4953
5054
These are some references for download setups for other exercises:
5155

5256
- [ignoring-somethings](https://raw.githubusercontent.com/git-mastery/exercises/refs/heads/main/ignoring_somethings/download.py)
5357
- [branch-bender](https://raw.githubusercontent.com/git-mastery/exercises/refs/heads/main/branch_bender/download.py)
58+
- [amateur-detective]
5459

5560
### Download conventions
5661

docs/contributing/hands-on.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,19 @@ Hands-on downloads are all single-file stored in `hands_on/`. The `<hands on nam
4545

4646
For more information about how Git-Mastery downloads hands-on, refer to the [Download Workflow](/developers/docs/architecture/download-workflow)
4747

48-
The default download script comes with a helper function to `run_command` to run local command.
48+
{: .note }
49+
50+
> `exercises` comes with a set of utility functions in the `exercise_utils` module that are made available during the download flow. They provide simple wrappers around common functionality such as `exercise_utils.cli.run_command` to invoke any command and `exercise_utils.file.create_or_update_file` to create or update a given file.
51+
>
52+
> For the full list of utility functions, refer [here](/developers/docs/tooling/exercise-utils).
53+
54+
).
4955

5056
These are some references for download setups for other exercises:
5157

5258
- [init-repo](https://raw.githubusercontent.com/git-mastery/exercises/refs/heads/main/hands_on/init_repo.py)
5359
- [add-files](https://raw.githubusercontent.com/git-mastery/exercises/refs/heads/main/hands_on/add_files.py)
60+
- [stage-modified](https://raw.githubusercontent.com/git-mastery/exercises/refs/heads/main/hands_on/stage_modified.py)
5461

5562
### Download conventions
5663

docs/tooling/exercise-utils.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Exercise utilities
3+
nav_order: 1
4+
parent: Tooling
5+
---
6+
7+
These are all contained within the [`exercises/exercise_utils` module](https://github.com/git-mastery/exercises/tree/main/exercise_utils).
8+
9+
These are loaded when downloading an exercise, which means that the `app` has access to these functions.
10+
11+
## Available utility functions
12+
13+
There are functions broadly for the following categories:
14+
15+
- `exercise_utils.cli`: Generic CLI calls
16+
- `exercise_utils.file`: File creation/appending
17+
- `exercise_utils.git`: Common Git operations like commit, initializing a repository, and adding files
18+
- `exercise_utils.gitmastery`: Git-Mastery specific functions like creating the start tag
19+
20+
## Contributing utility functions
21+
22+
These should cover around 80% of all use cases, but if there isn't an existing utility function for your use case, `exercise_utils.cli.run_command` is available to execute any other CLI calls.
23+
24+
If you believe that more utility functions should be supported, feel free to open a PR adding one.
25+
26+
{: .note }
27+
28+
If you add a new file, for example `exercise_utils/general.py`, please update `app` to include the file in the `EXERICSE_UTILS_FILES` constant [here](https://github.com/git-mastery/app/blob/6786aa998e9c8f7ca63c77534bfaf5b7514a89c2/app/utils/gitmastery.py#L212).

docs/tooling/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Tooling
3+
nav_order: 4
4+
---
5+
6+
Git-Mastery maintains various tools to support development.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
---
2-
title: Libraries
3-
nav_order: 4
2+
title: Published libraries
3+
nav_order: 2
4+
parent: Tooling
45
---
56

7+
## Published Python packages
8+
69
Git-Mastery publishes and maintains several public packages:
710

811
- [`repo-smith`](https://github.com/git-mastery/repo-smith)

0 commit comments

Comments
 (0)