-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
24 lines (18 loc) · 717 Bytes
/
makefile
File metadata and controls
24 lines (18 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.PHONY: files add inputs test
SESSIONID=`cat sessionid`
# create files for the day
# use as `make files year=2023 day=2`
files: inputs
mkdir -p "$(year)/code"
echo "INPUT_FILE='$(year)/inputs/day$(day).txt'" > "$(year)/code/day$(day)_part1.py"
cat template >> "$(year)/code/day$(day)_part1.py"
echo "INPUT_FILE='$(year)/inputs/day$(day).txt'" > "$(year)/code/day$(day)_part2.py"
cat template >> "$(year)/code/day$(day)_part2.py"
inputs:
mkdir -p "$(year)/inputs"
curl --cookie session="$(SESSIONID)" "https://adventofcode.com/$(year)/day/$(day)/input" > "$(year)/inputs/day$(day).txt"
# add new code and inputs to git
add:
git add $(year)/code/* $(year)/inputs/*
test:
pytest -s $(year)/code/test.py