##// END OF EJS Templates
dev(shell): make the shell use zshrc and better autocomplete
super-admin -
r5194:61b5d6b2 default
parent child Browse files
Show More
@@ -1,189 +1,191 b''
1 1 # required for pushd to work..
2 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 NODE_PATH=./node_modules
9 9 WEBPACK=./node_binaries/webpack
10 10 GRUNT=./node_binaries/grunt
11 11
12 12 .PHONY: clean
13 13 ## Cleanup compiled and cache py files
14 14 clean:
15 15 make test-clean
16 16 find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
17 17 find . -type d -name "build" -prune -exec rm -rf '{}' ';'
18 18
19 19
20 20 .PHONY: test
21 21 ## run test-clean and tests
22 22 test:
23 23 make test-clean
24 24 make test-only
25 25
26 26
27 27 .PHONY: test-clean
28 28 ## run test-clean and tests
29 29 test-clean:
30 30 rm -rf coverage.xml htmlcov junit.xml pylint.log result
31 31 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
32 32 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
33 33
34 34
35 35 .PHONY: test-only
36 36 ## Run tests only without cleanup
37 37 test-only:
38 38 PYTHONHASHSEED=random \
39 39 py.test -x -vv -r xw -p no:sugar \
40 40 --cov-report=term-missing --cov-report=html \
41 41 --cov=rhodecode rhodecode
42 42
43 43
44 44 .PHONY: test-only-mysql
45 45 ## run tests against mysql
46 46 test-only-mysql:
47 47 PYTHONHASHSEED=random \
48 48 py.test -x -vv -r xw -p no:sugar \
49 49 --cov-report=term-missing --cov-report=html \
50 50 --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \
51 51 --cov=rhodecode rhodecode
52 52
53 53
54 54 .PHONY: test-only-postgres
55 55 ## run tests against postgres
56 56 test-only-postgres:
57 57 PYTHONHASHSEED=random \
58 58 py.test -x -vv -r xw -p no:sugar \
59 59 --cov-report=term-missing --cov-report=html \
60 60 --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \
61 61 --cov=rhodecode rhodecode
62 62
63 63 .PHONY: ruff-check
64 64 ## run a ruff analysis
65 65 ruff-check:
66 66 ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev .
67 67
68 68
69 69 .PHONY: docs
70 70 ## build docs
71 71 docs:
72 72 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html)
73 73
74 74
75 75 .PHONY: docs-clean
76 76 ## Cleanup docs
77 77 docs-clean:
78 78 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean)
79 79
80 80
81 81 .PHONY: docs-cleanup
82 82 ## Cleanup docs
83 83 docs-cleanup:
84 84 (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup)
85 85
86 86
87 87 .PHONY: web-build
88 88 ## Build JS packages static/js
89 89 # https://hub.docker.com/r/huli/grunt
90 90 web-build:
91 91 NODE_PATH=$(NODE_PATH) $(GRUNT)
92 92
93 93 # check required files
94 94 STATIC_CHECK="/robots.txt /502.html \
95 95 /js/scripts.min.js /js/rhodecode-components.js \
96 96 /css/style.css /css/style-polymer.css /css/style-ipython.css"
97 97
98 98 for file in $STATIC_CHECK;
99 99 do
100 100 if [ ! -f rhodecode/public/$file ]; then
101 101 echo "Missing $file expected after web-build"
102 102 exit 1
103 103 fi
104 104 done
105 105
106 106 .PHONY: pip-packages
107 107 ## Show outdated packages
108 108 pip-packages:
109 109 python ${OUTDATED_PACKAGES}
110 110
111 111
112 112 .PHONY: build
113 113 ## Build sdist/egg
114 114 build:
115 115 python -m build
116 116
117 117
118 118 .PHONY: dev-sh
119 119 ## make dev-sh
120 120 dev-sh:
121 sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list"
121 122 sudo apt-get update
122 sudo apt-get install -y zsh
123 sudo apt-get install -y zsh carapace-bin
123 124 curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
125 echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc
124 126 PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh
125 127
126 128 .PHONY: dev-env
127 129 ## make dev-env based on the requirements files and install develop of packages
128 130 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
129 131 dev-env:
130 132 pip install build virtualenv
131 133 pushd ../rhodecode-vcsserver/ && make dev-env && popd
132 134 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
133 135 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
134 136 pip install -e .
135 137
136 138
137 139 .PHONY: dev-srv
138 140 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
139 141 dev-srv:
140 142 pserve --reload .dev/dev.ini
141 143
142 144
143 145 .PHONY: dev-srv-g
144 146 ## run gunicorn multi process workers
145 147 dev-srv-g:
146 148 gunicorn --workers=2 --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py
147 149
148 150
149 151 # Default command on calling make
150 152 .DEFAULT_GOAL := show-help
151 153
152 154 .PHONY: show-help
153 155 show-help:
154 156 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
155 157 @echo
156 158 @sed -n -e "/^## / { \
157 159 h; \
158 160 s/.*//; \
159 161 :doc" \
160 162 -e "H; \
161 163 n; \
162 164 s/^## //; \
163 165 t doc" \
164 166 -e "s/:.*//; \
165 167 G; \
166 168 s/\\n## /---/; \
167 169 s/\\n/ /g; \
168 170 p; \
169 171 }" ${MAKEFILE_LIST} \
170 172 | LC_ALL='C' sort --ignore-case \
171 173 | awk -F '---' \
172 174 -v ncol=$$(tput cols) \
173 175 -v indent=19 \
174 176 -v col_on="$$(tput setaf 6)" \
175 177 -v col_off="$$(tput sgr0)" \
176 178 '{ \
177 179 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
178 180 n = split($$2, words, " "); \
179 181 line_length = ncol - indent; \
180 182 for (i = 1; i <= n; i++) { \
181 183 line_length -= length(words[i]) + 1; \
182 184 if (line_length <= 0) { \
183 185 line_length = ncol - indent - length(words[i]) - 1; \
184 186 printf "\n%*s ", -indent, " "; \
185 187 } \
186 188 printf "%s ", words[i]; \
187 189 } \
188 190 printf "\n"; \
189 191 }'
General Comments 0
You need to be logged in to leave comments. Login now