summaryrefslogtreecommitdiffstats
path: root/fabfile.py
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2014-02-14 16:06:50 +0100
committermakefu <github@syntax-fehler.de>2014-02-14 16:06:50 +0100
commitd2ff51546f349b10b14ce5d9627c7959d39b2879 (patch)
tree5e46147fa1c9ee738d761daf25213748dab2c25b /fabfile.py
initial vomit
Diffstat (limited to 'fabfile.py')
-rw-r--r--fabfile.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/fabfile.py b/fabfile.py
new file mode 100644
index 0000000..817f448
--- /dev/null
+++ b/fabfile.py
@@ -0,0 +1,60 @@
+from fabric.api import *
+import fabric.contrib.project as project
+import os
+
+# Local path configuration (can be absolute or relative to fabfile)
+env.deploy_path = 'output'
+DEPLOY_PATH = env.deploy_path
+
+# Remote server configuration
+production = 'root@localhost:22'
+dest_path = '/var/www'
+
+# Rackspace Cloud Files configuration settings
+env.cloudfiles_username = 'my_rackspace_username'
+env.cloudfiles_api_key = 'my_rackspace_api_key'
+env.cloudfiles_container = 'my_cloudfiles_container'
+
+
+def clean():
+ if os.path.isdir(DEPLOY_PATH):
+ local('rm -rf {deploy_path}'.format(**env))
+ local('mkdir {deploy_path}'.format(**env))
+
+def build():
+ local('pelican -s pelicanconf.py')
+
+def rebuild():
+ clean()
+ build()
+
+def regenerate():
+ local('pelican -r -s pelicanconf.py')
+
+def serve():
+ local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env))
+
+def reserve():
+ build()
+ serve()
+
+def preview():
+ local('pelican -s publishconf.py')
+
+def cf_upload():
+ rebuild()
+ local('cd {deploy_path} && '
+ 'swift -v -A https://auth.api.rackspacecloud.com/v1.0 '
+ '-U {cloudfiles_username} '
+ '-K {cloudfiles_api_key} '
+ 'upload -c {cloudfiles_container} .'.format(**env))
+
+@hosts(production)
+def publish():
+ local('pelican -s publishconf.py')
+ project.rsync_project(
+ remote_dir=dest_path,
+ exclude=".DS_Store",
+ local_dir=DEPLOY_PATH.rstrip('/') + '/',
+ delete=True
+ )