forked from github/pelican
Invoke template : avoiding to spawn unnecessary process + passing-through CLI args to pelican
This commit is contained in:
parent
4d70447a5a
commit
d3c4bcc254
2 changed files with 11 additions and 5 deletions
1
THANKS
1
THANKS
|
|
@ -97,6 +97,7 @@ Kyle Fuller
|
||||||
Laureline Guerin
|
Laureline Guerin
|
||||||
Leonard Huang
|
Leonard Huang
|
||||||
Leroy Jiang
|
Leroy Jiang
|
||||||
|
Lucas Cimon
|
||||||
Marcel Hellkamp
|
Marcel Hellkamp
|
||||||
Marco Milanesi
|
Marco Milanesi
|
||||||
Marcus Fredriksson
|
Marcus Fredriksson
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import sys
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from invoke import task
|
from invoke import task
|
||||||
|
from invoke.main import program
|
||||||
from invoke.util import cd
|
from invoke.util import cd
|
||||||
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
|
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
|
||||||
from pelican.settings import DEFAULT_CONFIG, get_settings_from_file
|
from pelican.settings import DEFAULT_CONFIG, get_settings_from_file
|
||||||
|
|
@ -54,17 +55,17 @@ def clean(c):
|
||||||
@task
|
@task
|
||||||
def build(c):
|
def build(c):
|
||||||
"""Build local version of site"""
|
"""Build local version of site"""
|
||||||
c.run('pelican -s {settings_base}'.format(**CONFIG))
|
pelican_run('-s {settings_base}'.format(**CONFIG))
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def rebuild(c):
|
def rebuild(c):
|
||||||
"""`build` with the delete switch"""
|
"""`build` with the delete switch"""
|
||||||
c.run('pelican -d -s {settings_base}'.format(**CONFIG))
|
pelican_run('-d -s {settings_base}'.format(**CONFIG))
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def regenerate(c):
|
def regenerate(c):
|
||||||
"""Automatically regenerate site upon file modification"""
|
"""Automatically regenerate site upon file modification"""
|
||||||
c.run('pelican -r -s {settings_base}'.format(**CONFIG))
|
pelican_run('-r -s {settings_base}'.format(**CONFIG))
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def serve(c):
|
def serve(c):
|
||||||
|
|
@ -90,7 +91,7 @@ def reserve(c):
|
||||||
@task
|
@task
|
||||||
def preview(c):
|
def preview(c):
|
||||||
"""Build production version of site"""
|
"""Build production version of site"""
|
||||||
c.run('pelican -s {settings_publish}'.format(**CONFIG))
|
pelican_run('-s {settings_publish}'.format(**CONFIG))
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def livereload(c):
|
def livereload(c):
|
||||||
|
|
@ -130,7 +131,7 @@ def cf_upload(c):
|
||||||
@task
|
@task
|
||||||
def publish(c):
|
def publish(c):
|
||||||
"""Publish to production via rsync"""
|
"""Publish to production via rsync"""
|
||||||
c.run('pelican -s {settings_publish}'.format(**CONFIG))
|
pelican_run('-s {settings_publish}'.format(**CONFIG))
|
||||||
c.run(
|
c.run(
|
||||||
'rsync --delete --exclude ".DS_Store" -pthrvz -c '
|
'rsync --delete --exclude ".DS_Store" -pthrvz -c '
|
||||||
'-e "ssh -p {ssh_port}" '
|
'-e "ssh -p {ssh_port}" '
|
||||||
|
|
@ -147,3 +148,7 @@ def gh_pages(c):
|
||||||
'-m {commit_message} '
|
'-m {commit_message} '
|
||||||
'{deploy_path} -p'.format(**CONFIG))
|
'{deploy_path} -p'.format(**CONFIG))
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
def pelican_run(cmd):
|
||||||
|
cmd += ' ' + program.core.remainder # allows to pass-through args to pelican
|
||||||
|
pelican_main(cmd.split(' '))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue