Skip to content

Commit c2ba3cb

Browse files
committed
update demo Makefiles
1 parent 0afb237 commit c2ba3cb

File tree

24 files changed

+1668
-280
lines changed

24 files changed

+1668
-280
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ DEMO = './demo-assignments'
77

88
.PHONY: all
99
all: check-style check-type run-test-coverage clean
10-
@echo "All checks passed"
10+
@echo "All checks passed!"
1111

1212
.PHONY: check-type
1313
check-type:
Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
# provide path to where plantuml.jar is downloaded
22
PLANTUML = java -jar ~/plantuml.jar
33
DOCS = docs
4-
PROBLEM = hello
54
PYTHON = python3
65

76
.PHONY: all
8-
all: check-style fix-style check-types run-test create-docs create-uml
7+
all: check-style fix-style check-types run-test run-test-coverage create-docs create-uml clean
98
@echo "All done!"
109

10+
.PHONY: check-style
11+
check-style:
12+
flake8 .
13+
14+
.PHONY: fix-style
15+
fix-style:
16+
autopep8 --in-place --recursive --aggressive --aggressive .
17+
1118
.PHONY: run-test
1219
run-test:
1320
ifeq ($(shell which pytest), ) # if pytest not found
1421
@echo "pytest not found. Installing..."
1522
pip install pytest
1623
endif
17-
pytest --verbose --color=yes --cov --cov-report term --cov-report html tests/
24+
pytest --verbose --color=yes tests/
1825
@echo "All unittests passed!"
1926

27+
.PHONY: run-test-coverage
28+
run-test-coverage: create-doc-folder
29+
pytest --verbose --color=yes --cov --cov-report term-missing --cov-report=html:$(DOCS)/test-cov tests/
30+
@echo "All unittests passed!"
31+
32+
2033
.PHONY: check-types
2134
check-types:
2235
# use shell command which to check if mypy is installed and is in $PATH
@@ -33,8 +46,8 @@ create-doc-folder:
3346

3447
.PHONY: create-docs
3548
create-docs: create-doc-folder
36-
pdoc -o ./docs main.py hello.py # creates .md docs inside docs
37-
@echo "html docs created and saved in $(DOCS)"
49+
pdoc --output-dir $(DOCS)/code-docs hello.py main.py # creates html docs
50+
@echo "html docs created and saved in $(DOCS)/code-docs"
3851

3952
.PHONY: create-uml
4053
create-uml: create-doc-folder
@@ -47,15 +60,17 @@ ifeq ($(wildcard ~/plantuml.jar), )
4760
@echo "Downloading plantuml.jar in home folder..."
4861
curl -L -o ~/plantuml.jar https://sourceforge.net/projects/plantuml/files/plantuml.jar/download
4962
endif
50-
$(PLANTUML) uml/HelloWorld.plantuml
51-
$(PLANTUML) uml/Main.plantuml
52-
$(PLANTUML) uml/solution.plantuml
63+
$(PLANTUML) ./uml/HelloWorld.plantuml
64+
$(PLANTUML) ./uml/Main.plantuml
65+
$(PLANTUML) ./uml/solution.plantuml
5366
@echo "UML diagrams created and saved in uml folder"
5467

55-
.PHONY: check-style
56-
check-style:
57-
flake8 .
5868

59-
.PHONY: fix-style
60-
fix-style:
61-
autopep8 --in-place --recursive --aggressive --aggressive .
69+
.PHONY: clean
70+
clean:
71+
# remove all caches recursively
72+
rm -rf `find . -type d -name __pycache__` # remove all pycache
73+
rm -rf `find . -type d -name .pytest_cache` # remove all pytest cache
74+
rm -rf `find . -type d -name .mypy_cache` # remove all mypy cache
75+
rm -rf `find . -type d -name .hypothesis` # remove all hypothesis cache
76+
rm -rf `find . -name .coverage` # remove all coverage cache

demo-assignments/A0-OOP/hello/docs/hello.html renamed to demo-assignments/A0-OOP/hello/docs/code-docs/hello.html

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

demo-assignments/A0-OOP/hello/docs/index.html renamed to demo-assignments/A0-OOP/hello/docs/code-docs/index.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

demo-assignments/A0-OOP/hello/docs/main.html renamed to demo-assignments/A0-OOP/hello/docs/code-docs/main.html

Lines changed: 33 additions & 33 deletions
Large diffs are not rendered by default.

demo-assignments/A0-OOP/hello/docs/search.js renamed to demo-assignments/A0-OOP/hello/docs/code-docs/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-assignments/A0-OOP/hello/docs/hello.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

demo-assignments/A0-OOP/hello/docs/main.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

demo-assignments/A0/hello/Makefile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
DOCS = docs
2+
PYTHON = python3
3+
4+
.PHONY: all
5+
all: check-style fix-style check-types run-test run-test-coverage create-docs clean
6+
@echo "All done!"
7+
8+
.PHONY: check-style
9+
check-style:
10+
flake8 .
11+
12+
.PHONY: fix-style
13+
fix-style:
14+
autopep8 --in-place --recursive --aggressive --aggressive .
15+
16+
.PHONY: run-test
17+
run-test:
18+
ifeq ($(shell which pytest), ) # if pytest not found
19+
@echo "pytest not found. Installing..."
20+
pip install pytest
21+
endif
22+
pytest --verbose --color=yes tests/
23+
@echo "All unittests passed!"
24+
25+
.PHONY: run-test-coverage
26+
run-test-coverage: create-doc-folder
27+
pytest --verbose --color=yes --cov --cov-report term-missing --cov-report=html:$(DOCS)/test-cov tests/
28+
@echo "All unittests passed!"
29+
30+
.PHONY: check-types
31+
check-types:
32+
# use shell command which to check if mypy is installed and is in $PATH
33+
ifeq ($(shell which mypy), )
34+
@echo "mypy not found. Installing mypy..."
35+
pip install mypy
36+
endif
37+
mypy --disallow-untyped-defs --strict .
38+
@echo "Type checking done."
39+
40+
.PHONY: create-doc-folder
41+
create-doc-folder:
42+
@mkdir -p $(DOCS) # creates all folder(s) if not exists
43+
44+
.PHONY: create-docs
45+
create-docs: create-doc-folder
46+
pdoc --output-dir $(DOCS)/code-docs hello.py # creates html docs
47+
@echo "html docs created and saved in $(DOCS)/code-docs"
48+
49+
.PHONY: clean
50+
clean:
51+
# remove all caches recursively
52+
rm -rf `find . -type d -name __pycache__` # remove all pycache
53+
rm -rf `find . -type d -name .pytest_cache` # remove all pytest cache
54+
rm -rf `find . -type d -name .mypy_cache` # remove all mypy cache
55+
rm -rf `find . -type d -name .hypothesis` # remove all hypothesis cache
56+
rm -rf `find . -name .coverage` # remove all coverage cache

demo-assignments/A0/hello/docs/code-docs/hello.html

Lines changed: 139 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)