Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidFun committed Dec 16, 2023
1 parent 1f7230b commit 400fb18
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@ Add this pre-commit hook to your `.pre-commit-config.yaml` (create it, if you do
```yaml
repos:
- repo: https://github.com/LiquidFun/aoc_tiles
rev: 0.4.0
rev: 0.5.0
hooks:
- id: aoc-tiles
args:
- --auto-add-tiles-to-git
- --auto-add-tiles-to-git=amend
```
There are a lot more flags, see [config.py](./aoc_tiles/config.py) for all of them.
Auto add tiles is recommended as it will automatically add the tiles to your git repository, otherwise you might
forget it and the tiles will not be updated.
forget it and the tiles will not be updated. Note that this will amend your just created commit. If you do not want
this, remove that flag.
Now install the hook with `pre-commit install --hook-type post-commit` and you are done!
The **--hook-type** flag is important, otherwise the hook will not run.

### Set-up

Expand Down
11 changes: 7 additions & 4 deletions aoc_tiles/make_tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ def _ensure_is_not_running(self):

def make_tiles(self):
self._ensure_is_not_running()
with open(self.config.running_lock_path, "w") as file:
file.write("")
print("Running AoC-Tiles")
solve_data = self.compose_solve_data()
logger.info("Found {} years with solutions", len(solve_data.year_to_data))
Expand All @@ -183,9 +181,14 @@ def make_tiles(self):
self.solution_finder.git_add(self.config.image_dir)

if self.config.auto_add_tiles_to_git in ["amend"]:
self.solution_finder.git_commit_amend()
with open(self.config.running_lock_path, "w") as file:
file.write("")
try:
self.solution_finder.git_commit_amend()
finally:
print("Could not amend commit. Maybe there is nothing to amend?")
self.config.running_lock_path.unlink()

self.config.running_lock_path.unlink()

# Currently max_workers=1 until bug is fixed where README is written simultaneously
# with ThreadPoolExecutor(max_workers=1) as executor:
Expand Down
25 changes: 13 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aoc-tiles"
version = "0.4.1"
version = "0.5.0"
description = "Fancy Advent of Code README tiles showing the completion status of the challenges per day"
authors = ["Brutenis Gliwa, <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 400fb18

Please sign in to comment.