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