Mercurial > public > pelican-blog
comparison fabfile.py @ 0:c4ec6945bb86
Just ran pelican-quickstart and answered some questions.
Created .hgignore file.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 29 Jan 2014 18:53:45 -0600 |
parents | |
children | 75a003a548c4 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c4ec6945bb86 |
---|---|
1 from fabric.api import * | |
2 import fabric.contrib.project as project | |
3 import os | |
4 | |
5 # Local path configuration (can be absolute or relative to fabfile) | |
6 env.deploy_path = 'output' | |
7 DEPLOY_PATH = env.deploy_path | |
8 | |
9 # Remote server configuration | |
10 production = 'brian@jaguar:22' | |
11 dest_path = '/svr/www/deathofagremmie.com/public' | |
12 | |
13 # Rackspace Cloud Files configuration settings | |
14 env.cloudfiles_username = 'my_rackspace_username' | |
15 env.cloudfiles_api_key = 'my_rackspace_api_key' | |
16 env.cloudfiles_container = 'my_cloudfiles_container' | |
17 | |
18 | |
19 def clean(): | |
20 if os.path.isdir(DEPLOY_PATH): | |
21 local('rm -rf {deploy_path}'.format(**env)) | |
22 local('mkdir {deploy_path}'.format(**env)) | |
23 | |
24 def build(): | |
25 local('pelican -s pelicanconf.py') | |
26 | |
27 def rebuild(): | |
28 clean() | |
29 build() | |
30 | |
31 def regenerate(): | |
32 local('pelican -r -s pelicanconf.py') | |
33 | |
34 def serve(): | |
35 local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env)) | |
36 | |
37 def reserve(): | |
38 build() | |
39 serve() | |
40 | |
41 def preview(): | |
42 local('pelican -s publishconf.py') | |
43 | |
44 def cf_upload(): | |
45 rebuild() | |
46 local('cd {deploy_path} && ' | |
47 'swift -v -A https://auth.api.rackspacecloud.com/v1.0 ' | |
48 '-U {cloudfiles_username} ' | |
49 '-K {cloudfiles_api_key} ' | |
50 'upload -c {cloudfiles_container} .'.format(**env)) | |
51 | |
52 @hosts(production) | |
53 def publish(): | |
54 local('pelican -s publishconf.py') | |
55 project.rsync_project( | |
56 remote_dir=dest_path, | |
57 exclude=".DS_Store", | |
58 local_dir=DEPLOY_PATH.rstrip('/') + '/', | |
59 delete=True | |
60 ) |