##// END OF EJS Templates
chore: makefile, cleanup node_modules before generating a new ones
super-admin -
r5475:973675bc default
parent child Browse files
Show More
@@ -1,171 +1,172 b''
1 # required for pushd to work..
1 # required for pushd to work..
2 SHELL = /bin/bash
2 SHELL = /bin/bash
3
3
4
4
5 # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py
5 # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py
6 OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES}
6 OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES}
7
7
8 .PHONY: clean
8 .PHONY: clean
9 ## Cleanup compiled and cache py files
9 ## Cleanup compiled and cache py files
10 clean:
10 clean:
11 make test-clean
11 make test-clean
12 find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
12 find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
13 find . -type d -name "build" -prune -exec rm -rf '{}' ';'
13 find . -type d -name "build" -prune -exec rm -rf '{}' ';'
14
14
15
15
16 .PHONY: test
16 .PHONY: test
17 ## run test-clean and tests
17 ## run test-clean and tests
18 test:
18 test:
19 make test-clean
19 make test-clean
20 make test-only
20 make test-only
21
21
22
22
23 .PHONY: test-clean
23 .PHONY: test-clean
24 ## run test-clean and tests
24 ## run test-clean and tests
25 test-clean:
25 test-clean:
26 rm -rf coverage.xml htmlcov junit.xml pylint.log result
26 rm -rf coverage.xml htmlcov junit.xml pylint.log result
27 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
27 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
28 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
28 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
29
29
30
30
31 .PHONY: test-only
31 .PHONY: test-only
32 ## Run tests only without cleanup
32 ## Run tests only without cleanup
33 test-only:
33 test-only:
34 PYTHONHASHSEED=random \
34 PYTHONHASHSEED=random \
35 py.test -x -vv -r xw -p no:sugar \
35 py.test -x -vv -r xw -p no:sugar \
36 --cov-report=term-missing --cov-report=html \
36 --cov-report=term-missing --cov-report=html \
37 --cov=rhodecode rhodecode
37 --cov=rhodecode rhodecode
38
38
39
39
40 .PHONY: docs
40 .PHONY: docs
41 ## build docs
41 ## build docs
42 docs:
42 docs:
43 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html)
43 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html)
44
44
45
45
46 .PHONY: docs-clean
46 .PHONY: docs-clean
47 ## Cleanup docs
47 ## Cleanup docs
48 docs-clean:
48 docs-clean:
49 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean)
49 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean)
50
50
51
51
52 .PHONY: docs-cleanup
52 .PHONY: docs-cleanup
53 ## Cleanup docs
53 ## Cleanup docs
54 docs-cleanup:
54 docs-cleanup:
55 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup)
55 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup)
56
56
57
57
58 .PHONY: web-build
58 .PHONY: web-build
59 ## Build JS packages static/js
59 ## Build JS packages static/js
60 web-build:
60 web-build:
61 rm -rf node_modules
61 docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt"
62 docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt"
62 # run static file check
63 # run static file check
63 ./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/
64 ./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/
64 rm -rf node_modules
65 rm -rf node_modules
65
66
66 .PHONY: ruff-check
67 .PHONY: ruff-check
67 ## run a ruff analysis
68 ## run a ruff analysis
68 ruff-check:
69 ruff-check:
69 ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev .
70 ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev .
70
71
71 .PHONY: pip-packages
72 .PHONY: pip-packages
72 ## Show outdated packages
73 ## Show outdated packages
73 pip-packages:
74 pip-packages:
74 python ${OUTDATED_PACKAGES}
75 python ${OUTDATED_PACKAGES}
75
76
76
77
77 .PHONY: build
78 .PHONY: build
78 ## Build sdist/egg
79 ## Build sdist/egg
79 build:
80 build:
80 python -m build
81 python -m build
81
82
82
83
83 .PHONY: dev-sh
84 .PHONY: dev-sh
84 ## make dev-sh
85 ## make dev-sh
85 dev-sh:
86 dev-sh:
86 sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list"
87 sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list"
87 sudo apt-get update
88 sudo apt-get update
88 sudo apt-get install -y zsh carapace-bin
89 sudo apt-get install -y zsh carapace-bin
89 rm -rf /home/rhodecode/.oh-my-zsh
90 rm -rf /home/rhodecode/.oh-my-zsh
90 curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
91 curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
91 @echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc
92 @echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc
92 @echo "${RC_DEV_CMD_HELP}"
93 @echo "${RC_DEV_CMD_HELP}"
93 @PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh
94 @PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh
94
95
95
96
96 .PHONY: dev-cleanup
97 .PHONY: dev-cleanup
97 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
98 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
98 dev-cleanup:
99 dev-cleanup:
99 pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
100 pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
100 rm -rf /tmp/*
101 rm -rf /tmp/*
101
102
102
103
103 .PHONY: dev-env
104 .PHONY: dev-env
104 ## make dev-env based on the requirements files and install develop of packages
105 ## make dev-env based on the requirements files and install develop of packages
105 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
106 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
106 dev-env:
107 dev-env:
107 sudo -u root chown rhodecode:rhodecode /home/rhodecode/.cache/pip/
108 sudo -u root chown rhodecode:rhodecode /home/rhodecode/.cache/pip/
108 pip install build virtualenv
109 pip install build virtualenv
109 pushd ../rhodecode-vcsserver/ && make dev-env && popd
110 pushd ../rhodecode-vcsserver/ && make dev-env && popd
110 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
111 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
111 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
112 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
112 pip install -e .
113 pip install -e .
113
114
114
115
115 .PHONY: sh
116 .PHONY: sh
116 ## shortcut for make dev-sh dev-env
117 ## shortcut for make dev-sh dev-env
117 sh:
118 sh:
118 make dev-env
119 make dev-env
119 make dev-sh
120 make dev-sh
120
121
121
122
122 ## Allows changes of workers e.g make dev-srv-g workers=2
123 ## Allows changes of workers e.g make dev-srv-g workers=2
123 workers?=1
124 workers?=1
124
125
125 .PHONY: dev-srv
126 .PHONY: dev-srv
126 ## run gunicorn web server with reloader, use workers=N to set multiworker mode
127 ## run gunicorn web server with reloader, use workers=N to set multiworker mode
127 dev-srv:
128 dev-srv:
128 gunicorn --paste=.dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload --workers=$(workers)
129 gunicorn --paste=.dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload --workers=$(workers)
129
130
130
131
131 # Default command on calling make
132 # Default command on calling make
132 .DEFAULT_GOAL := show-help
133 .DEFAULT_GOAL := show-help
133
134
134 .PHONY: show-help
135 .PHONY: show-help
135 show-help:
136 show-help:
136 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
137 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
137 @echo
138 @echo
138 @sed -n -e "/^## / { \
139 @sed -n -e "/^## / { \
139 h; \
140 h; \
140 s/.*//; \
141 s/.*//; \
141 :doc" \
142 :doc" \
142 -e "H; \
143 -e "H; \
143 n; \
144 n; \
144 s/^## //; \
145 s/^## //; \
145 t doc" \
146 t doc" \
146 -e "s/:.*//; \
147 -e "s/:.*//; \
147 G; \
148 G; \
148 s/\\n## /---/; \
149 s/\\n## /---/; \
149 s/\\n/ /g; \
150 s/\\n/ /g; \
150 p; \
151 p; \
151 }" ${MAKEFILE_LIST} \
152 }" ${MAKEFILE_LIST} \
152 | LC_ALL='C' sort --ignore-case \
153 | LC_ALL='C' sort --ignore-case \
153 | awk -F '---' \
154 | awk -F '---' \
154 -v ncol=$$(tput cols) \
155 -v ncol=$$(tput cols) \
155 -v indent=19 \
156 -v indent=19 \
156 -v col_on="$$(tput setaf 6)" \
157 -v col_on="$$(tput setaf 6)" \
157 -v col_off="$$(tput sgr0)" \
158 -v col_off="$$(tput sgr0)" \
158 '{ \
159 '{ \
159 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
160 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
160 n = split($$2, words, " "); \
161 n = split($$2, words, " "); \
161 line_length = ncol - indent; \
162 line_length = ncol - indent; \
162 for (i = 1; i <= n; i++) { \
163 for (i = 1; i <= n; i++) { \
163 line_length -= length(words[i]) + 1; \
164 line_length -= length(words[i]) + 1; \
164 if (line_length <= 0) { \
165 if (line_length <= 0) { \
165 line_length = ncol - indent - length(words[i]) - 1; \
166 line_length = ncol - indent - length(words[i]) - 1; \
166 printf "\n%*s ", -indent, " "; \
167 printf "\n%*s ", -indent, " "; \
167 } \
168 } \
168 printf "%s ", words[i]; \
169 printf "%s ", words[i]; \
169 } \
170 } \
170 printf "\n"; \
171 printf "\n"; \
171 }'
172 }'
General Comments 0
You need to be logged in to leave comments. Login now