Skip to content

Commit d9b475d

Browse files
committed
Merge subtree 'vimhelp' from 'vimhelp/master'
2 parents 38718e9 + 5b54b28 commit d9b475d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1050
-660
lines changed

vimhelp/.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
root = true
2+
3+
[*.py]
4+
max_line_length = 88

vimhelp/.flake8

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

vimhelp/.gcloudignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/.gitignore
33
/.gcloudignore
44
/.venv
5-
/.flake8
65
/.ruff_cache
76
/scripts
87
/README.md
@@ -11,3 +10,4 @@
1110
/tasks.py
1211
/gunicorn.conf.dev.py
1312
__pycache__/
13+
html/

vimhelp/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
TODO
2-
/vimhelp/secret.py
32
/.venv/
43
__pycache__/

vimhelp/app.yaml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
runtime: python311
1+
runtime: python312
22

33
automatic_scaling:
44
max_instances: 2
@@ -10,31 +10,10 @@ automatic_scaling:
1010

1111
entrypoint: gunicorn -b :$PORT -k gevent -w 1 'vimhelp.webapp:create_app()'
1212

13-
default_expiration: "1h"
14-
1513
inbound_services:
1614
- warmup
1715

1816
handlers:
19-
- url: /(?:.*\.html)?
20-
script: auto
21-
secure: always
22-
- url: /api/.+
23-
script: auto
24-
secure: always
25-
- url: /(?:robots|sitemap)\.txt
26-
script: auto
27-
secure: always
28-
- url: /favicon\.ico
29-
script: auto
30-
secure: always
31-
- url: /(?:enqueue_)?update
17+
- url: /.*
3218
script: auto
3319
secure: always
34-
- url: /_ah/warmup
35-
script: auto
36-
secure: always
37-
- url: /(.+)
38-
static_files: static/\1
39-
upload: static/(.*)
40-
secure: always

vimhelp/cron.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ cron:
55
- description: fetch and process neovim docs
66
url: /enqueue_update?project=neovim
77
schedule: every 32 minutes
8+
- description: clean up old static asset versions
9+
url: /enqueue_clean_assets
10+
schedule: every 33 minutes

vimhelp/gunicorn.conf.dev.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
loglevel = "debug"
55
reload = True
6-
reload_extra_files = ["static", "templates"]
76
timeout = 15
87
worker_class = "gevent"
98
wsgi_app = "vimhelp.webapp:create_app()"

vimhelp/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ build-backend = "setuptools.build_meta"
1313
dependencies = { file = "requirements.txt" }
1414

1515
[tool.ruff]
16+
extend-exclude = [".pyre"]
17+
18+
[tool.ruff.lint]
1619
select = ["E", "F", "W", "I002", "N", "UP", "S", "B", "A", "C4", "DTZ", "SIM", "PTH", "PLE", "PLW", "RUF"]
1720
ignore = ["DTZ003", "PLW0603", "SIM102", "SIM108", "UP007"]
1821

19-
[tool.ruff.per-file-ignores]
22+
[tool.ruff.lint.per-file-ignores]
2023
"vimhelp/vimh2h.py" = ["E501", "PLW2901"]

vimhelp/scripts/h2h.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,11 @@ def main():
8383
app = flask.Flask(
8484
__name__,
8585
root_path=pathlib.Path(__file__).resolve().parent,
86-
static_url_path="",
87-
static_folder="../static",
88-
template_folder="../templates",
86+
template_folder="../vimhelp/templates",
8987
)
9088
app.jinja_options["trim_blocks"] = True
9189
app.jinja_options["lstrip_blocks"] = True
90+
app.jinja_env.filters["static_path"] = lambda p: p
9291

9392
with app.app_context():
9493
if args.profile:
@@ -162,19 +161,17 @@ def run(args):
162161
f.write(redirect_html)
163162

164163
if args.out_dir is not None:
165-
print("Symlinking static files...")
166-
static_dir_rel = os.path.relpath(root_path / "static", args.out_dir)
167-
for target in (root_path / "static").iterdir():
164+
print("Symlinking/creating static files...")
165+
static_dir = root_path / "vimhelp" / "static"
166+
static_dir_rel = os.path.relpath(static_dir, args.out_dir)
167+
for target in static_dir.iterdir():
168168
target_name = target.name
169-
if target_name.startswith(f"favicon-{args.project}"):
170-
src_name = target_name.replace(f"favicon-{args.project}", "favicon")
171-
elif target_name.startswith("favicon-"):
172-
continue
173-
else:
174-
src_name = target_name
175-
src = pathlib.Path(args.out_dir / src_name)
169+
src = args.out_dir / target_name
176170
src.unlink(missing_ok=True)
177171
src.symlink_to(f"{static_dir_rel}/{target_name}")
172+
for name in "vimhelp.css", "vimhelp.js":
173+
content = flask.render_template(name, mode=mode)
174+
(args.out_dir / name).write_text(content)
178175

179176
print("Done.")
180177

vimhelp/static/noscript.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)