|
|
|
@ -27,25 +27,30 @@ env.github_pages_branch = "gh-pages"
|
|
|
|
|
# Port for `serve` |
|
|
|
|
PORT = 8000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def clean(): |
|
|
|
|
"""Remove generated files""" |
|
|
|
|
if os.path.isdir(DEPLOY_PATH): |
|
|
|
|
shutil.rmtree(DEPLOY_PATH) |
|
|
|
|
os.makedirs(DEPLOY_PATH) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build(): |
|
|
|
|
"""Build local version of site""" |
|
|
|
|
local('pelican -s pelicanconf.py') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def rebuild(): |
|
|
|
|
"""`clean` then `build`""" |
|
|
|
|
clean() |
|
|
|
|
build() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def regenerate(): |
|
|
|
|
"""Automatically regenerate site upon file modification""" |
|
|
|
|
local('pelican -r -s pelicanconf.py') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def serve(): |
|
|
|
|
"""Serve site at http://localhost:8000/""" |
|
|
|
|
os.chdir(env.deploy_path) |
|
|
|
@ -58,15 +63,18 @@ def serve():
|
|
|
|
|
sys.stderr.write('Serving on port {0} ...\n'.format(PORT)) |
|
|
|
|
server.serve_forever() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reserve(): |
|
|
|
|
"""`build`, then `serve`""" |
|
|
|
|
build() |
|
|
|
|
serve() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def preview(): |
|
|
|
|
"""Build production version of site""" |
|
|
|
|
local('pelican -s publishconf.py') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cf_upload(): |
|
|
|
|
"""Publish to Rackspace Cloud Files""" |
|
|
|
|
rebuild() |
|
|
|
@ -76,6 +84,7 @@ def cf_upload():
|
|
|
|
|
'-K {cloudfiles_api_key} ' |
|
|
|
|
'upload -c {cloudfiles_container} .'.format(**env)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@hosts(production) |
|
|
|
|
def publish(): |
|
|
|
|
"""Publish to production via rsync""" |
|
|
|
@ -88,6 +97,7 @@ def publish():
|
|
|
|
|
extra_opts='-c', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def gh_pages(): |
|
|
|
|
"""Publish to GitHub Pages""" |
|
|
|
|
rebuild() |
|
|
|
|