From 1193da5d8e29d99de2576c5e1235af6f2620f68d Mon Sep 17 00:00:00 2001 From: sipp11 Date: Thu, 5 Feb 2015 02:47:41 +0700 Subject: [PATCH] make it work properly with fabric --- fabfile.py | 10 ++++++++++ pelicanconf.py | 6 +++--- publishconf.py | 8 ++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fabfile.py b/fabfile.py index 249238b..39b9ebe 100644 --- a/fabfile.py +++ b/fabfile.py @@ -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() diff --git a/pelicanconf.py b/pelicanconf.py index 74e0162..4caceaa 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals AUTHOR = u'sipp11' SITENAME = u'everyday' -SITEURL = 'http://everyday.in.th' +SITEURL = '' PATH = 'content' @@ -12,8 +12,8 @@ TIMEZONE = 'Asia/Bangkok' DEFAULT_LANG = u'th' PDF_GENERATOR = True -DISQUS_SITENAME = 'everyday-in-th' -GOOGLE_ANALYTICS = 'UA-34877059-5' +DISQUS_SITENAME = '' +GOOGLE_ANALYTICS = '' # Feed generation is usually not desired when developing FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None diff --git a/publishconf.py b/publishconf.py index 85ff8ef..cf85ad9 100644 --- a/publishconf.py +++ b/publishconf.py @@ -10,8 +10,8 @@ import sys sys.path.append(os.curdir) from pelicanconf import * -SITEURL = '' -RELATIVE_URLS = False +SITEURL = 'http://everyday.in.th' +RELATIVE_URLS = True FEED_ALL_ATOM = 'feeds/all.atom.xml' CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml' @@ -20,5 +20,5 @@ DELETE_OUTPUT_DIRECTORY = True # Following items are often useful when publishing -#DISQUS_SITENAME = "" -#GOOGLE_ANALYTICS = "" +DISQUS_SITENAME = 'everyday-in-th' +GOOGLE_ANALYTICS = 'UA-34877059-5'