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