diff options
author | clarkzjw <[email protected]> | 2023-01-20 14:55:36 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-01-20 14:55:36 -0800 |
commit | 9be2b67e354773c1f65d7502b5eee2dbf1bb1498 (patch) | |
tree | 38015f826072694783a40470a0536bb60152fedb /clarkzjw.cc/config/bia | |
parent | 3ca3701bde891b8bd6ba989c8ee92bff0dc452dd (diff) | |
download | homelab-9be2b67e354773c1f65d7502b5eee2dbf1bb1498.tar.gz |
bia: add cgit filters
Diffstat (limited to 'clarkzjw.cc/config/bia')
6 files changed, 676 insertions, 1 deletions
diff --git a/clarkzjw.cc/config/bia/ansible/roles/cgit/tasks/main.yaml b/clarkzjw.cc/config/bia/ansible/roles/cgit/tasks/main.yaml index 872a43a..375bd8f 100644 --- a/clarkzjw.cc/config/bia/ansible/roles/cgit/tasks/main.yaml +++ b/clarkzjw.cc/config/bia/ansible/roles/cgit/tasks/main.yaml | |||
@@ -6,6 +6,7 @@ | |||
6 | - nginx | 6 | - nginx |
7 | - fcgiwrap | 7 | - fcgiwrap |
8 | - security/py-certbot-nginx | 8 | - security/py-certbot-nginx |
9 | - py39-virtualenv | ||
9 | 10 | ||
10 | - name: Create git directory | 11 | - name: Create git directory |
11 | file: | 12 | file: |
@@ -38,4 +39,6 @@ | |||
38 | # test nginx conf | 39 | # test nginx conf |
39 | # reload nginx conf | 40 | # reload nginx conf |
40 | # create git user | 41 | # create git user |
41 | # git user permission | 42 | # gitolite config |
43 | # create virtualenv | ||
44 | # cgit filters | ||
diff --git a/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/cgitrc.j2 b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/cgitrc.j2 new file mode 100644 index 0000000..39585fd --- /dev/null +++ b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/cgitrc.j2 | |||
@@ -0,0 +1,79 @@ | |||
1 | ## style-sheet and custom logo | ||
2 | css=/cgit.css | ||
3 | logo=/cgit.png | ||
4 | |||
5 | ## root for all cgit links | ||
6 | virtual-root=/ | ||
7 | |||
8 | ## root config | ||
9 | root-title={{ lookup('env', 'CGIT_DOMAIN') }} | ||
10 | root-desc=clarkzjw's personal git server | ||
11 | root-readme=/var/www/{{ lookup('env', 'CGIT_DOMAIN') }}/index.html | ||
12 | |||
13 | ## syntax highlighting | ||
14 | source-filter=/usr/local/lib/cgit/filters/syntax-highlighting.py | ||
15 | about-filter=/usr/local/lib/cgit/filters/about-formatting.sh | ||
16 | |||
17 | ## mimetype | ||
18 | mimetype.gif=image/gif | ||
19 | mimetype.html=text/html | ||
20 | mimetype.jpg=image/jpeg | ||
21 | mimetype.jpeg=image/jpeg | ||
22 | mimetype.bmp=image/bmp | ||
23 | mimetype.pdf=application/pdf | ||
24 | mimetype.png=image/png | ||
25 | mimetype.svg=image/svg+xml | ||
26 | |||
27 | ## features | ||
28 | remove-suffix=1 | ||
29 | enable-remote-branches=1 | ||
30 | enable-index-links=1 | ||
31 | enable-index-owner=0 | ||
32 | enable-git-config=1 | ||
33 | enable-commit-graph=1 | ||
34 | enable-log-filecount=1 | ||
35 | enable-log-linecount=1 | ||
36 | |||
37 | ## readme | ||
38 | readme=:README.md | ||
39 | readme=:readme.md | ||
40 | readme=:README.mkd | ||
41 | readme=:readme.mkd | ||
42 | readme=:README.rst | ||
43 | readme=:readme.rst | ||
44 | readme=:README.html | ||
45 | readme=:readme.html | ||
46 | readme=:README.htm | ||
47 | readme=:readme.htm | ||
48 | readme=:README.txt | ||
49 | readme=:readme.txt | ||
50 | readme=:README | ||
51 | readme=:readme | ||
52 | readme=:INSTALL.md | ||
53 | readme=:install.md | ||
54 | readme=:INSTALL.mkd | ||
55 | readme=:install.mkd | ||
56 | readme=:INSTALL.rst | ||
57 | readme=:install.rst | ||
58 | readme=:INSTALL.html | ||
59 | readme=:install.html | ||
60 | readme=:INSTALL.htm | ||
61 | readme=:install.htm | ||
62 | readme=:INSTALL.txt | ||
63 | readme=:install.txt | ||
64 | readme=:INSTALL | ||
65 | readme=:install | ||
66 | |||
67 | ## Sort branches by date | ||
68 | branch-sort=age | ||
69 | |||
70 | ## search projects | ||
71 | section-from-path=1 | ||
72 | project-list=/opt/git/projects.list | ||
73 | scan-path=/opt/git/repositories/ | ||
74 | |||
75 | ## refs: | ||
76 | ## https://jmahler.github.io/git/2013/06/29/cgit.html | ||
77 | ## https://gitolite.com/gitolite/fool_proof_setup | ||
78 | ## https://github.com/sitaramc/gitolite | ||
79 | ## https://herrbischoff.com/2021/10/how-to-install-cgit-with-gitolite-and-nginx-on-freebsd-13/ | ||
diff --git a/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/about-formatting.sh b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/about-formatting.sh new file mode 100644 index 0000000..220afc6 --- /dev/null +++ b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/about-formatting.sh | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This may be used with the about-filter or repo.about-filter setting in cgitrc. | ||
4 | # It passes formatting of about pages to differing programs, depending on the usage. | ||
5 | |||
6 | # Markdown support requires python and markdown-python. | ||
7 | # RestructuredText support requires python and docutils. | ||
8 | # Man page support requires groff. | ||
9 | |||
10 | # The following environment variables can be used to retrieve the configuration | ||
11 | # of the repository for which this script is called: | ||
12 | # CGIT_REPO_URL ( = repo.url setting ) | ||
13 | # CGIT_REPO_NAME ( = repo.name setting ) | ||
14 | # CGIT_REPO_PATH ( = repo.path setting ) | ||
15 | # CGIT_REPO_OWNER ( = repo.owner setting ) | ||
16 | # CGIT_REPO_DEFBRANCH ( = repo.defbranch setting ) | ||
17 | # CGIT_REPO_SECTION ( = section setting ) | ||
18 | # CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) | ||
19 | |||
20 | cd "$(dirname $0)/html-converters/" | ||
21 | case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in | ||
22 | *.markdown|*.mdown|*.md|*.mkd) exec ./md2html.py; ;; | ||
23 | *.rst) exec ./rst2html; ;; | ||
24 | *.[1-9]) exec ./man2html; ;; | ||
25 | *.htm|*.html) exec cat; ;; | ||
26 | *.txt|*) exec ./txt2html; ;; | ||
27 | esac | ||
diff --git a/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/md2html.py b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/md2html.py new file mode 100644 index 0000000..4421bdd --- /dev/null +++ b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/md2html.py | |||
@@ -0,0 +1,309 @@ | |||
1 | #!/opt/cgit/bin/python3.9 | ||
2 | |||
3 | import markdown | ||
4 | import sys | ||
5 | import io | ||
6 | from pygments.formatters import HtmlFormatter | ||
7 | from markdown.extensions.toc import TocExtension | ||
8 | |||
9 | sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') | ||
10 | sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') | ||
11 | sys.stdout.write(''' | ||
12 | <style> | ||
13 | .markdown-body { | ||
14 | font-size: 14px; | ||
15 | line-height: 1.6; | ||
16 | overflow: hidden; | ||
17 | } | ||
18 | .markdown-body>*:first-child { | ||
19 | margin-top: 0 !important; | ||
20 | } | ||
21 | .markdown-body>*:last-child { | ||
22 | margin-bottom: 0 !important; | ||
23 | } | ||
24 | .markdown-body a.absent { | ||
25 | color: #c00; | ||
26 | } | ||
27 | .markdown-body a.anchor { | ||
28 | display: block; | ||
29 | padding-left: 30px; | ||
30 | margin-left: -30px; | ||
31 | cursor: pointer; | ||
32 | position: absolute; | ||
33 | top: 0; | ||
34 | left: 0; | ||
35 | bottom: 0; | ||
36 | } | ||
37 | .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { | ||
38 | margin: 20px 0 10px; | ||
39 | padding: 0; | ||
40 | font-weight: bold; | ||
41 | -webkit-font-smoothing: antialiased; | ||
42 | cursor: text; | ||
43 | position: relative; | ||
44 | } | ||
45 | .markdown-body h1 .mini-icon-link, .markdown-body h2 .mini-icon-link, .markdown-body h3 .mini-icon-link, .markdown-body h4 .mini-icon-link, .markdown-body h5 .mini-icon-link, .markdown-body h6 .mini-icon-link { | ||
46 | display: none; | ||
47 | color: #000; | ||
48 | } | ||
49 | .markdown-body h1:hover a.anchor, .markdown-body h2:hover a.anchor, .markdown-body h3:hover a.anchor, .markdown-body h4:hover a.anchor, .markdown-body h5:hover a.anchor, .markdown-body h6:hover a.anchor { | ||
50 | text-decoration: none; | ||
51 | line-height: 1; | ||
52 | padding-left: 0; | ||
53 | margin-left: -22px; | ||
54 | top: 15%; | ||
55 | } | ||
56 | .markdown-body h1:hover a.anchor .mini-icon-link, .markdown-body h2:hover a.anchor .mini-icon-link, .markdown-body h3:hover a.anchor .mini-icon-link, .markdown-body h4:hover a.anchor .mini-icon-link, .markdown-body h5:hover a.anchor .mini-icon-link, .markdown-body h6:hover a.anchor .mini-icon-link { | ||
57 | display: inline-block; | ||
58 | } | ||
59 | div#cgit .markdown-body h1 a.toclink, div#cgit .markdown-body h2 a.toclink, div#cgit .markdown-body h3 a.toclink, div#cgit .markdown-body h4 a.toclink, div#cgit .markdown-body h5 a.toclink, div#cgit .markdown-body h6 a.toclink { | ||
60 | color: black; | ||
61 | } | ||
62 | .markdown-body h1 tt, .markdown-body h1 code, .markdown-body h2 tt, .markdown-body h2 code, .markdown-body h3 tt, .markdown-body h3 code, .markdown-body h4 tt, .markdown-body h4 code, .markdown-body h5 tt, .markdown-body h5 code, .markdown-body h6 tt, .markdown-body h6 code { | ||
63 | font-size: inherit; | ||
64 | } | ||
65 | .markdown-body h1 { | ||
66 | font-size: 28px; | ||
67 | color: #000; | ||
68 | } | ||
69 | .markdown-body h2 { | ||
70 | font-size: 24px; | ||
71 | border-bottom: 1px solid #ccc; | ||
72 | color: #000; | ||
73 | } | ||
74 | .markdown-body h3 { | ||
75 | font-size: 18px; | ||
76 | } | ||
77 | .markdown-body h4 { | ||
78 | font-size: 16px; | ||
79 | } | ||
80 | .markdown-body h5 { | ||
81 | font-size: 14px; | ||
82 | } | ||
83 | .markdown-body h6 { | ||
84 | color: #777; | ||
85 | font-size: 14px; | ||
86 | } | ||
87 | .markdown-body p, .markdown-body blockquote, .markdown-body ul, .markdown-body ol, .markdown-body dl, .markdown-body table, .markdown-body pre { | ||
88 | margin: 15px 0; | ||
89 | } | ||
90 | .markdown-body hr { | ||
91 | background: transparent url("/dirty-shade.png") repeat-x 0 0; | ||
92 | border: 0 none; | ||
93 | color: #ccc; | ||
94 | height: 4px; | ||
95 | padding: 0; | ||
96 | } | ||
97 | .markdown-body>h2:first-child, .markdown-body>h1:first-child, .markdown-body>h1:first-child+h2, .markdown-body>h3:first-child, .markdown-body>h4:first-child, .markdown-body>h5:first-child, .markdown-body>h6:first-child { | ||
98 | margin-top: 0; | ||
99 | padding-top: 0; | ||
100 | } | ||
101 | .markdown-body a:first-child h1, .markdown-body a:first-child h2, .markdown-body a:first-child h3, .markdown-body a:first-child h4, .markdown-body a:first-child h5, .markdown-body a:first-child h6 { | ||
102 | margin-top: 0; | ||
103 | padding-top: 0; | ||
104 | } | ||
105 | .markdown-body h1+p, .markdown-body h2+p, .markdown-body h3+p, .markdown-body h4+p, .markdown-body h5+p, .markdown-body h6+p { | ||
106 | margin-top: 0; | ||
107 | } | ||
108 | .markdown-body li p.first { | ||
109 | display: inline-block; | ||
110 | } | ||
111 | .markdown-body ul, .markdown-body ol { | ||
112 | padding-left: 30px; | ||
113 | } | ||
114 | .markdown-body ul.no-list, .markdown-body ol.no-list { | ||
115 | list-style-type: none; | ||
116 | padding: 0; | ||
117 | } | ||
118 | .markdown-body ul li>:first-child, .markdown-body ul li ul:first-of-type, .markdown-body ul li ol:first-of-type, .markdown-body ol li>:first-child, .markdown-body ol li ul:first-of-type, .markdown-body ol li ol:first-of-type { | ||
119 | margin-top: 0px; | ||
120 | } | ||
121 | .markdown-body ul li p:last-of-type, .markdown-body ol li p:last-of-type { | ||
122 | margin-bottom: 0; | ||
123 | } | ||
124 | .markdown-body ul ul, .markdown-body ul ol, .markdown-body ol ol, .markdown-body ol ul { | ||
125 | margin-bottom: 0; | ||
126 | } | ||
127 | .markdown-body dl { | ||
128 | padding: 0; | ||
129 | } | ||
130 | .markdown-body dl dt { | ||
131 | font-size: 14px; | ||
132 | font-weight: bold; | ||
133 | font-style: italic; | ||
134 | padding: 0; | ||
135 | margin: 15px 0 5px; | ||
136 | } | ||
137 | .markdown-body dl dt:first-child { | ||
138 | padding: 0; | ||
139 | } | ||
140 | .markdown-body dl dt>:first-child { | ||
141 | margin-top: 0px; | ||
142 | } | ||
143 | .markdown-body dl dt>:last-child { | ||
144 | margin-bottom: 0px; | ||
145 | } | ||
146 | .markdown-body dl dd { | ||
147 | margin: 0 0 15px; | ||
148 | padding: 0 15px; | ||
149 | } | ||
150 | .markdown-body dl dd>:first-child { | ||
151 | margin-top: 0px; | ||
152 | } | ||
153 | .markdown-body dl dd>:last-child { | ||
154 | margin-bottom: 0px; | ||
155 | } | ||
156 | .markdown-body blockquote { | ||
157 | border-left: 4px solid #DDD; | ||
158 | padding: 0 15px; | ||
159 | color: #777; | ||
160 | } | ||
161 | .markdown-body blockquote>:first-child { | ||
162 | margin-top: 0px; | ||
163 | } | ||
164 | .markdown-body blockquote>:last-child { | ||
165 | margin-bottom: 0px; | ||
166 | } | ||
167 | .markdown-body table th { | ||
168 | font-weight: bold; | ||
169 | } | ||
170 | .markdown-body table th, .markdown-body table td { | ||
171 | border: 1px solid #ccc; | ||
172 | padding: 6px 13px; | ||
173 | } | ||
174 | .markdown-body table tr { | ||
175 | border-top: 1px solid #ccc; | ||
176 | background-color: #fff; | ||
177 | } | ||
178 | .markdown-body table tr:nth-child(2n) { | ||
179 | background-color: #f8f8f8; | ||
180 | } | ||
181 | .markdown-body img { | ||
182 | max-width: 100%; | ||
183 | -moz-box-sizing: border-box; | ||
184 | box-sizing: border-box; | ||
185 | } | ||
186 | .markdown-body span.frame { | ||
187 | display: block; | ||
188 | overflow: hidden; | ||
189 | } | ||
190 | .markdown-body span.frame>span { | ||
191 | border: 1px solid #ddd; | ||
192 | display: block; | ||
193 | float: left; | ||
194 | overflow: hidden; | ||
195 | margin: 13px 0 0; | ||
196 | padding: 7px; | ||
197 | width: auto; | ||
198 | } | ||
199 | .markdown-body span.frame span img { | ||
200 | display: block; | ||
201 | float: left; | ||
202 | } | ||
203 | .markdown-body span.frame span span { | ||
204 | clear: both; | ||
205 | color: #333; | ||
206 | display: block; | ||
207 | padding: 5px 0 0; | ||
208 | } | ||
209 | .markdown-body span.align-center { | ||
210 | display: block; | ||
211 | overflow: hidden; | ||
212 | clear: both; | ||
213 | } | ||
214 | .markdown-body span.align-center>span { | ||
215 | display: block; | ||
216 | overflow: hidden; | ||
217 | margin: 13px auto 0; | ||
218 | text-align: center; | ||
219 | } | ||
220 | .markdown-body span.align-center span img { | ||
221 | margin: 0 auto; | ||
222 | text-align: center; | ||
223 | } | ||
224 | .markdown-body span.align-right { | ||
225 | display: block; | ||
226 | overflow: hidden; | ||
227 | clear: both; | ||
228 | } | ||
229 | .markdown-body span.align-right>span { | ||
230 | display: block; | ||
231 | overflow: hidden; | ||
232 | margin: 13px 0 0; | ||
233 | text-align: right; | ||
234 | } | ||
235 | .markdown-body span.align-right span img { | ||
236 | margin: 0; | ||
237 | text-align: right; | ||
238 | } | ||
239 | .markdown-body span.float-left { | ||
240 | display: block; | ||
241 | margin-right: 13px; | ||
242 | overflow: hidden; | ||
243 | float: left; | ||
244 | } | ||
245 | .markdown-body span.float-left span { | ||
246 | margin: 13px 0 0; | ||
247 | } | ||
248 | .markdown-body span.float-right { | ||
249 | display: block; | ||
250 | margin-left: 13px; | ||
251 | overflow: hidden; | ||
252 | float: right; | ||
253 | } | ||
254 | .markdown-body span.float-right>span { | ||
255 | display: block; | ||
256 | overflow: hidden; | ||
257 | margin: 13px auto 0; | ||
258 | text-align: right; | ||
259 | } | ||
260 | .markdown-body code, .markdown-body tt { | ||
261 | margin: 0 2px; | ||
262 | padding: 0px 5px; | ||
263 | border: 1px solid #eaeaea; | ||
264 | background-color: #f8f8f8; | ||
265 | border-radius: 3px; | ||
266 | } | ||
267 | .markdown-body code { | ||
268 | white-space: nowrap; | ||
269 | } | ||
270 | .markdown-body pre>code { | ||
271 | margin: 0; | ||
272 | padding: 0; | ||
273 | white-space: pre; | ||
274 | border: none; | ||
275 | background: transparent; | ||
276 | } | ||
277 | .markdown-body .highlight pre, .markdown-body pre { | ||
278 | background-color: #f8f8f8; | ||
279 | border: 1px solid #ccc; | ||
280 | font-size: 13px; | ||
281 | line-height: 19px; | ||
282 | overflow: auto; | ||
283 | padding: 6px 10px; | ||
284 | border-radius: 3px; | ||
285 | } | ||
286 | .markdown-body pre code, .markdown-body pre tt { | ||
287 | margin: 0; | ||
288 | padding: 0; | ||
289 | background-color: transparent; | ||
290 | border: none; | ||
291 | } | ||
292 | ''') | ||
293 | sys.stdout.write(HtmlFormatter(style='solarized-light').get_style_defs('.highlight')) | ||
294 | sys.stdout.write(''' | ||
295 | </style> | ||
296 | ''') | ||
297 | sys.stdout.write("<div class='markdown-body'>") | ||
298 | sys.stdout.flush() | ||
299 | # Note: you may want to run this through bleach for sanitization | ||
300 | markdown.markdownFromFile( | ||
301 | output_format="html5", | ||
302 | extensions=[ | ||
303 | "markdown.extensions.fenced_code", | ||
304 | "markdown.extensions.codehilite", | ||
305 | "markdown.extensions.tables", | ||
306 | TocExtension(anchorlink=True)], | ||
307 | extension_configs={ | ||
308 | "markdown.extensions.codehilite":{"css_class":"highlight"}}) | ||
309 | sys.stdout.write("</div>") | ||
diff --git a/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/syntax-highlighting.py b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/syntax-highlighting.py new file mode 100644 index 0000000..2fc7149 --- /dev/null +++ b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/filters/syntax-highlighting.py | |||
@@ -0,0 +1,55 @@ | |||
1 | #!/opt/cgit/bin/python3.9 | ||
2 | |||
3 | # This script uses Pygments and Python3. You must have both installed | ||
4 | # for this to work. | ||
5 | # | ||
6 | # http://pygments.org/ | ||
7 | # http://python.org/ | ||
8 | # | ||
9 | # It may be used with the source-filter or repo.source-filter settings | ||
10 | # in cgitrc. | ||
11 | # | ||
12 | # The following environment variables can be used to retrieve the | ||
13 | # configuration of the repository for which this script is called: | ||
14 | # CGIT_REPO_URL ( = repo.url setting ) | ||
15 | # CGIT_REPO_NAME ( = repo.name setting ) | ||
16 | # CGIT_REPO_PATH ( = repo.path setting ) | ||
17 | # CGIT_REPO_OWNER ( = repo.owner setting ) | ||
18 | # CGIT_REPO_DEFBRANCH ( = repo.defbranch setting ) | ||
19 | # CGIT_REPO_SECTION ( = section setting ) | ||
20 | # CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) | ||
21 | |||
22 | |||
23 | import sys | ||
24 | import io | ||
25 | from pygments import highlight | ||
26 | from pygments.util import ClassNotFound | ||
27 | from pygments.lexers import TextLexer | ||
28 | from pygments.lexers import guess_lexer | ||
29 | from pygments.lexers import guess_lexer_for_filename | ||
30 | from pygments.formatters import HtmlFormatter | ||
31 | |||
32 | |||
33 | sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace') | ||
34 | sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') | ||
35 | data = sys.stdin.read() | ||
36 | filename = sys.argv[1] | ||
37 | formatter = HtmlFormatter(style='solarized-light', nobackground=True) | ||
38 | |||
39 | try: | ||
40 | lexer = guess_lexer_for_filename(filename, data) | ||
41 | except ClassNotFound: | ||
42 | # check if there is any shebang | ||
43 | if data[0:2] == '#!': | ||
44 | lexer = guess_lexer(data) | ||
45 | else: | ||
46 | lexer = TextLexer() | ||
47 | except TypeError: | ||
48 | lexer = TextLexer() | ||
49 | |||
50 | # highlight! :-) | ||
51 | # printout pygments' css definitions as well | ||
52 | sys.stdout.write('<style>') | ||
53 | sys.stdout.write(formatter.get_style_defs('.highlight')) | ||
54 | sys.stdout.write('</style>') | ||
55 | sys.stdout.write(highlight(data, lexer, formatter, outfile=None)) | ||
diff --git a/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/gitolite.rc.j2 b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/gitolite.rc.j2 new file mode 100644 index 0000000..e8f016f --- /dev/null +++ b/clarkzjw.cc/config/bia/ansible/roles/cgit/templates/gitolite.rc.j2 | |||
@@ -0,0 +1,202 @@ | |||
1 | # configuration variables for gitolite | ||
2 | |||
3 | # This file is in perl syntax. But you do NOT need to know perl to edit it -- | ||
4 | # just mind the commas, use single quotes unless you know what you're doing, | ||
5 | # and make sure the brackets and braces stay matched up! | ||
6 | |||
7 | # (Tip: perl allows a comma after the last item in a list also!) | ||
8 | |||
9 | # HELP for commands can be had by running the command with "-h". | ||
10 | |||
11 | # HELP for all the other FEATURES can be found in the documentation (look for | ||
12 | # "list of non-core programs shipped with gitolite" in the master index) or | ||
13 | # directly in the corresponding source file. | ||
14 | |||
15 | %RC = ( | ||
16 | |||
17 | # ------------------------------------------------------------------ | ||
18 | |||
19 | # default umask gives you perms of '0700'; see the rc file docs for | ||
20 | # how/why you might change this | ||
21 | UMASK => 0027, | ||
22 | |||
23 | # look for "git-config" in the documentation | ||
24 | GIT_CONFIG_KEYS => '.*', | ||
25 | |||
26 | # comment out if you don't need all the extra detail in the logfile | ||
27 | LOG_EXTRA => 1, | ||
28 | # logging options | ||
29 | # 1. leave this section as is for 'normal' gitolite logging (default) | ||
30 | # 2. uncomment this line to log ONLY to syslog: | ||
31 | # LOG_DEST => 'syslog', | ||
32 | # 3. uncomment this line to log to syslog and the normal gitolite log: | ||
33 | # LOG_DEST => 'syslog,normal', | ||
34 | # 4. prefixing "repo-log," to any of the above will **also** log just the | ||
35 | # update records to "gl-log" in the bare repo directory: | ||
36 | # LOG_DEST => 'repo-log,normal', | ||
37 | # LOG_DEST => 'repo-log,syslog', | ||
38 | # LOG_DEST => 'repo-log,syslog,normal', | ||
39 | # syslog 'facility': defaults to 'local0', uncomment if needed. For example: | ||
40 | # LOG_FACILITY => 'local4', | ||
41 | |||
42 | # roles. add more roles (like MANAGER, TESTER, ...) here. | ||
43 | # WARNING: if you make changes to this hash, you MUST run 'gitolite | ||
44 | # compile' afterward, and possibly also 'gitolite trigger POST_COMPILE' | ||
45 | ROLES => { | ||
46 | READERS => 1, | ||
47 | WRITERS => 1, | ||
48 | }, | ||
49 | |||
50 | # enable caching (currently only Redis). PLEASE RTFM BEFORE USING!!! | ||
51 | # CACHE => 'Redis', | ||
52 | |||
53 | # ------------------------------------------------------------------ | ||
54 | |||
55 | # rc variables used by various features | ||
56 | |||
57 | # the 'info' command prints this as additional info, if it is set | ||
58 | # SITE_INFO => 'Please see http://blahblah/gitolite for more help', | ||
59 | |||
60 | # the CpuTime feature uses these | ||
61 | # display user, system, and elapsed times to user after each git operation | ||
62 | DISPLAY_CPU_TIME => 1, | ||
63 | # display a warning if total CPU times (u, s, cu, cs) crosses this limit | ||
64 | # CPU_TIME_WARN_LIMIT => 0.1, | ||
65 | |||
66 | # the Mirroring feature needs this | ||
67 | # HOSTNAME => "foo", | ||
68 | |||
69 | # TTL for redis cache; PLEASE SEE DOCUMENTATION BEFORE UNCOMMENTING! | ||
70 | # CACHE_TTL => 600, | ||
71 | |||
72 | # ------------------------------------------------------------------ | ||
73 | |||
74 | # suggested locations for site-local gitolite code (see cust.html) | ||
75 | |||
76 | # this one is managed directly on the server | ||
77 | # LOCAL_CODE => "$ENV{HOME}/local", | ||
78 | |||
79 | # or you can use this, which lets you put everything in a subdirectory | ||
80 | # called "local" in your gitolite-admin repo. For a SECURITY WARNING | ||
81 | # on this, see http://gitolite.com/gitolite/non-core.html#pushcode | ||
82 | # LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local", | ||
83 | |||
84 | # ------------------------------------------------------------------ | ||
85 | |||
86 | # List of commands and features to enable | ||
87 | |||
88 | ENABLE => [ | ||
89 | |||
90 | # COMMANDS | ||
91 | |||
92 | # These are the commands enabled by default | ||
93 | 'help', | ||
94 | 'desc', | ||
95 | 'info', | ||
96 | 'perms', | ||
97 | 'writable', | ||
98 | |||
99 | # Uncomment or add new commands here. | ||
100 | 'create', | ||
101 | 'fork', | ||
102 | # 'mirror', | ||
103 | 'readme', | ||
104 | # 'sskm', | ||
105 | # 'D', | ||
106 | |||
107 | # These FEATURES are enabled by default. | ||
108 | |||
109 | # essential (unless you're using smart-http mode) | ||
110 | 'ssh-authkeys', | ||
111 | |||
112 | # creates git-config entries from gitolite.conf file entries like 'config foo.bar = baz' | ||
113 | 'git-config', | ||
114 | |||
115 | # creates git-daemon-export-ok files; if you don't use git-daemon, comment this out | ||
116 | 'daemon', | ||
117 | |||
118 | # creates projects.list file; if you don't use gitweb, comment this out | ||
119 | 'gitweb', | ||
120 | |||
121 | # These FEATURES are disabled by default; uncomment to enable. If you | ||
122 | # need to add new ones, ask on the mailing list :-) | ||
123 | |||
124 | # user-visible behaviour | ||
125 | |||
126 | # prevent wild repos auto-create on fetch/clone | ||
127 | #'no-create-on-read', | ||
128 | # no auto-create at all (don't forget to enable the 'create' command!) | ||
129 | # 'no-auto-create', | ||
130 | |||
131 | # access a repo by another (possibly legacy) name | ||
132 | # 'Alias', | ||
133 | |||
134 | # give some users direct shell access. See documentation in | ||
135 | # sts.html for details on the following two choices. | ||
136 | # "Shell $ENV{HOME}/.gitolite.shell-users", | ||
137 | # 'Shell alice bob', | ||
138 | |||
139 | # set default roles from lines like 'option default.roles-1 = ...', etc. | ||
140 | # 'set-default-roles', | ||
141 | |||
142 | # show more detailed messages on deny | ||
143 | 'expand-deny-messages', | ||
144 | |||
145 | # show a message of the day | ||
146 | 'Motd', | ||
147 | |||
148 | # system admin stuff | ||
149 | |||
150 | # enable mirroring (don't forget to set the HOSTNAME too!) | ||
151 | # 'Mirroring', | ||
152 | |||
153 | # allow people to submit pub files with more than one key in them | ||
154 | # 'ssh-authkeys-split', | ||
155 | |||
156 | # selective read control hack | ||
157 | # 'partial-copy', | ||
158 | |||
159 | # manage local, gitolite-controlled, copies of read-only upstream repos | ||
160 | # 'upstream', | ||
161 | |||
162 | # updates 'description' file instead of 'gitweb.description' config item | ||
163 | 'cgit', | ||
164 | |||
165 | # allow repo-specific hooks to be added | ||
166 | # 'repo-specific-hooks', | ||
167 | |||
168 | # performance, logging, monitoring... | ||
169 | |||
170 | # be nice | ||
171 | # 'renice 10', | ||
172 | |||
173 | # log CPU times (user, system, cumulative user, cumulative system) | ||
174 | # 'CpuTime', | ||
175 | |||
176 | # syntactic_sugar for gitolite.conf and included files | ||
177 | |||
178 | # allow backslash-escaped continuation lines in gitolite.conf | ||
179 | # 'continuation-lines', | ||
180 | |||
181 | # create implicit user groups from directory names in keydir/ | ||
182 | # 'keysubdirs-as-groups', | ||
183 | |||
184 | # allow simple line-oriented macros | ||
185 | # 'macros', | ||
186 | |||
187 | # Kindergarten mode | ||
188 | |||
189 | # disallow various things that sensible people shouldn't be doing anyway | ||
190 | # 'Kindergarten', | ||
191 | ], | ||
192 | |||
193 | ); | ||
194 | |||
195 | # ------------------------------------------------------------------------------ | ||
196 | # per perl rules, this should be the last line in such a file: | ||
197 | 1; | ||
198 | |||
199 | # Local variables: | ||
200 | # mode: perl | ||
201 | # End: | ||
202 | # vim: set syn=perl: | ||