1
0
Fork 0
forked from github/pelican

Invoke template : avoiding to spawn unnecessary process + passing-through CLI args to pelican

This commit is contained in:
Lucas Cimon 2020-06-09 16:01:46 +02:00
commit d3c4bcc254
No known key found for this signature in database
GPG key ID: 08DA831E717571EE
2 changed files with 11 additions and 5 deletions

1
THANKS
View file

@ -97,6 +97,7 @@ Kyle Fuller
Laureline Guerin
Leonard Huang
Leroy Jiang
Lucas Cimon
Marcel Hellkamp
Marco Milanesi
Marcus Fredriksson

View file

@ -6,6 +6,7 @@ import sys
import datetime
from invoke import task
from invoke.main import program
from invoke.util import cd
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
from pelican.settings import DEFAULT_CONFIG, get_settings_from_file
@ -54,17 +55,17 @@ def clean(c):
@task
def build(c):
"""Build local version of site"""
c.run('pelican -s {settings_base}'.format(**CONFIG))
pelican_run('-s {settings_base}'.format(**CONFIG))
@task
def rebuild(c):
"""`build` with the delete switch"""
c.run('pelican -d -s {settings_base}'.format(**CONFIG))
pelican_run('-d -s {settings_base}'.format(**CONFIG))
@task
def regenerate(c):
"""Automatically regenerate site upon file modification"""
c.run('pelican -r -s {settings_base}'.format(**CONFIG))
pelican_run('-r -s {settings_base}'.format(**CONFIG))
@task
def serve(c):
@ -90,7 +91,7 @@ def reserve(c):
@task
def preview(c):
"""Build production version of site"""
c.run('pelican -s {settings_publish}'.format(**CONFIG))
pelican_run('-s {settings_publish}'.format(**CONFIG))
@task
def livereload(c):
@ -130,7 +131,7 @@ def cf_upload(c):
@task
def publish(c):
"""Publish to production via rsync"""
c.run('pelican -s {settings_publish}'.format(**CONFIG))
pelican_run('-s {settings_publish}'.format(**CONFIG))
c.run(
'rsync --delete --exclude ".DS_Store" -pthrvz -c '
'-e "ssh -p {ssh_port}" '
@ -147,3 +148,7 @@ def gh_pages(c):
'-m {commit_message} '
'{deploy_path} -p'.format(**CONFIG))
{% endif %}
def pelican_run(cmd):
cmd += ' ' + program.core.remainder # allows to pass-through args to pelican
pelican_main(cmd.split(' '))