Browse Source

Rename invoke tasks to standardize format

I think this is going to be a better way to name invoke tasks. The
previous naming where a verb was often first made it much harder for
anyone to figure out the name of a task that affects a certain thing
without always looking through the entire list.

For example, if someone is looking for a task that affects the web
server, it's much easier to find web-server-reload than
reload-web-server.

The changes were:

- check-code-style -> code-style-check
- reload-web-server -> web-server-reload
- renew-tls-certificate -> tls-certificate-renew
- type-checking -> type-check
- update-pip-requirements -> pip-requirements-update
merge-requests/126/merge
Deimos 4 years ago
parent
commit
79072f76d8
  1. 2
      git_hooks/pre-commit
  2. 2
      git_hooks/pre-push
  3. 12
      tildes/tasks.py

2
git_hooks/pre-commit

@ -3,4 +3,4 @@
# Pre-commit hook script that ensures type-checking, tests, and fast style checks pass
vagrant ssh -c ". activate \
&& invoke type-checking test --quiet check-code-style"
&& invoke type-check test --quiet code-style-check"

2
git_hooks/pre-push

@ -3,4 +3,4 @@
# Pre-push hook script that ensures all tests and code checks pass
vagrant ssh -c ". activate \
&& invoke type-checking test --quiet --full check-code-style --full"
&& invoke type-check test --quiet --full code-style-check --full"

12
tildes/tasks.py

@ -15,7 +15,7 @@ def output(string):
@task(help={"full": "Include all checks (very slow)"})
def check_code_style(context, full=False):
def code_style_check(context, full=False):
"""Run the various utilities to check code style.
By default, runs checks that return relatively quickly. To run the full set of
@ -38,7 +38,7 @@ def check_code_style(context, full=False):
@task
def reload_web_server(context):
def web_server_reload(context):
"""Reload the web server, in order to apply config updates."""
context.run("sudo systemctl reload nginx.service")
@ -48,9 +48,9 @@ def reload_web_server(context):
"domain": "Domain to obtain a cert for (can be specified multiple times)",
},
iterable=["domain"],
post=[reload_web_server],
post=[web_server_reload],
)
def renew_tls_certificate(context, domain, wildcard=True):
def tls_certificate_renew(context, domain, wildcard=True):
"""Renew the TLS certificate for the specified domain(s)."""
if not domain:
raise Exit("No domains specified")
@ -128,14 +128,14 @@ def shell(context):
@task
def type_checking(context):
def type_check(context):
"""Run static type checking on the Python code."""
output("Running static type checking... ")
context.run("mypy .")
@task
def update_pip_requirements(context):
def pip_requirements_update(context):
"""Use pip-tools to update package versions in the requirements files."""
for filename in ("requirements.in", "requirements-dev.in"):

Loading…
Cancel
Save