Browse Source

make it work properly with fabric

master
sipp11 10 years ago
parent
commit
1193da5d8e
  1. 10
      fabfile.py
  2. 6
      pelicanconf.py
  3. 8
      publishconf.py

10
fabfile.py vendored

@ -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()

6
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

8
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'

Loading…
Cancel
Save