Skip to content

Commit

Permalink
Add inv dev
Browse files Browse the repository at this point in the history
  • Loading branch information
utensil committed Nov 25, 2023
1 parent faaab2d commit 62297ba
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from blueprint.tasks import web, bp, print_bp, serve

ROOT = Path(__file__).parent
BP_DIR = ROOT/'blueprint'

@task(bp, web)
def all(ctx):
Expand All @@ -17,4 +18,33 @@ def all(ctx):
@task(web)
def html(ctx):
shutil.rmtree(ROOT/'docs'/'blueprint', ignore_errors=True)
shutil.copytree(ROOT/'blueprint'/'web', ROOT/'docs'/'blueprint')
shutil.copytree(ROOT/'blueprint'/'web', ROOT/'docs'/'blueprint')

@task(bp, web)
def dev(ctx):
"""
Serve the blueprint website, rebuild PDF and the website on file changes
"""

from watchfiles import run_process, DefaultFilter

def callback(changes):
print('Changes detected:', changes)
bp(ctx)
web(ctx)

run_process(BP_DIR/'src', target='inv serve', callback=callback,
watch_filter=DefaultFilter(
ignore_entity_patterns=(
'.*\.aux$',
'.*\.log$',
'.*\.fls$',
'.*\.fdb_latexmk$',
'.*\.bbl$',
'.*\.paux$',
'.*\.pdf$',
'.*\.out$',
'.*\.blg$',
'.*\.synctex.*$',
)
))

0 comments on commit 62297ba

Please sign in to comment.