##// END OF EJS Templates
dev(makefile): added dev shell prompt
super-admin -
r1172:a2015e2c default
parent child Browse files
Show More
@@ -1,120 +1,128 b''
1 1 # required for pushd to work..
2 #SHELL = /bin/bash
2 SHELL = /bin/bash
3 3
4 4
5 5 # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py
6 6 OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES}
7 7
8 8 .PHONY: clean
9 9 ## Cleanup compiled and cache py files
10 10 clean:
11 11 make test-clean
12 12 find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
13 13 find . -type d -name "build" -prune -exec rm -rf '{}' ';'
14 14
15 15
16 16 .PHONY: test
17 17 ## run test-clean and tests
18 18 test:
19 19 make test-clean
20 20 make test-only
21 21
22 22
23 23 .PHONY: test-clean
24 24 ## run test-clean and tests
25 25 test-clean:
26 26 rm -rf coverage.xml htmlcov junit.xml pylint.log result
27 27 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
28 28 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
29 29
30 30
31 31 .PHONY: test-only
32 32 ## Run tests only without cleanup
33 33 test-only:
34 34 PYTHONHASHSEED=random \
35 35 py.test -x -vv -r xw -p no:sugar \
36 36 --cov-report=term-missing --cov-report=html \
37 37 --cov=vcsserver vcsserver
38 38
39 39
40 40 .PHONY: ruff-check
41 41 ## run a ruff analysis
42 42 ruff-check:
43 43 ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev .
44 44
45 45
46 46 .PHONY: pip-packages
47 47 ## Show outdated packages
48 48 pip-packages:
49 49 python ${OUTDATED_PACKAGES}
50 50
51 51
52 52 .PHONY: build
53 53 ## Build sdist/egg
54 54 build:
55 55 python -m build
56 56
57 57
58 .PHONY: dev-sh
59 ## make dev-sh
60 dev-sh:
61 sudo apt-get update
62 sudo apt-get install -y zsh
63 curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
64 PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh
65
58 66 .PHONY: dev-env
59 67 ## make dev-env based on the requirements files and install develop of packages
60 68 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
61 69 dev-env:
62 70 pip install build virtualenv
63 71 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt
64 72 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt
65 73 pip install -e .
66 74
67 75
68 76 .PHONY: dev-srv
69 77 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
70 78 dev-srv:
71 79 pserve --reload .dev/dev.ini
72 80
73 81
74 82 .PHONY: dev-srv-g
75 83 ## run gunicorn multi process workers
76 84 dev-srv-g:
77 85 gunicorn --workers=4 --paste .dev/dev.ini --bind=0.0.0.0:10010 --config=.dev/gunicorn_config.py
78 86
79 87
80 88 # Default command on calling make
81 89 .DEFAULT_GOAL := show-help
82 90
83 91 .PHONY: show-help
84 92 show-help:
85 93 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
86 94 @echo
87 95 @sed -n -e "/^## / { \
88 96 h; \
89 97 s/.*//; \
90 98 :doc" \
91 99 -e "H; \
92 100 n; \
93 101 s/^## //; \
94 102 t doc" \
95 103 -e "s/:.*//; \
96 104 G; \
97 105 s/\\n## /---/; \
98 106 s/\\n/ /g; \
99 107 p; \
100 108 }" ${MAKEFILE_LIST} \
101 109 | LC_ALL='C' sort --ignore-case \
102 110 | awk -F '---' \
103 111 -v ncol=$$(tput cols) \
104 112 -v indent=19 \
105 113 -v col_on="$$(tput setaf 6)" \
106 114 -v col_off="$$(tput sgr0)" \
107 115 '{ \
108 116 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
109 117 n = split($$2, words, " "); \
110 118 line_length = ncol - indent; \
111 119 for (i = 1; i <= n; i++) { \
112 120 line_length -= length(words[i]) + 1; \
113 121 if (line_length <= 0) { \
114 122 line_length = ncol - indent - length(words[i]) - 1; \
115 123 printf "\n%*s ", -indent, " "; \
116 124 } \
117 125 printf "%s ", words[i]; \
118 126 } \
119 127 printf "\n"; \
120 128 }'
General Comments 0
You need to be logged in to leave comments. Login now