bgneal@0: from fabric.api import * bgneal@0: import fabric.contrib.project as project bgneal@0: import os bgneal@0: bgneal@0: # Local path configuration (can be absolute or relative to fabfile) bgneal@0: env.deploy_path = 'output' bgneal@0: DEPLOY_PATH = env.deploy_path bgneal@0: bgneal@0: # Remote server configuration bgneal@0: production = 'brian@jaguar:22' bgneal@0: dest_path = '/svr/www/deathofagremmie.com/public' bgneal@0: bgneal@0: # Rackspace Cloud Files configuration settings bgneal@0: env.cloudfiles_username = 'my_rackspace_username' bgneal@0: env.cloudfiles_api_key = 'my_rackspace_api_key' bgneal@0: env.cloudfiles_container = 'my_cloudfiles_container' bgneal@0: bgneal@0: bgneal@0: def clean(): bgneal@0: if os.path.isdir(DEPLOY_PATH): bgneal@0: local('rm -rf {deploy_path}'.format(**env)) bgneal@0: local('mkdir {deploy_path}'.format(**env)) bgneal@0: bgneal@0: def build(): bgneal@0: local('pelican -s pelicanconf.py') bgneal@0: bgneal@0: def rebuild(): bgneal@0: clean() bgneal@0: build() bgneal@0: bgneal@0: def regenerate(): bgneal@0: local('pelican -r -s pelicanconf.py') bgneal@0: bgneal@0: def serve(): bgneal@0: local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env)) bgneal@0: bgneal@0: def reserve(): bgneal@0: build() bgneal@0: serve() bgneal@0: bgneal@0: def preview(): bgneal@0: local('pelican -s publishconf.py') bgneal@0: bgneal@0: def cf_upload(): bgneal@0: rebuild() bgneal@0: local('cd {deploy_path} && ' bgneal@0: 'swift -v -A https://auth.api.rackspacecloud.com/v1.0 ' bgneal@0: '-U {cloudfiles_username} ' bgneal@0: '-K {cloudfiles_api_key} ' bgneal@0: 'upload -c {cloudfiles_container} .'.format(**env)) bgneal@0: bgneal@0: @hosts(production) bgneal@0: def publish(): bgneal@0: local('pelican -s publishconf.py') bgneal@0: project.rsync_project( bgneal@0: remote_dir=dest_path, bgneal@0: exclude=".DS_Store", bgneal@0: local_dir=DEPLOY_PATH.rstrip('/') + '/', bgneal@0: delete=True bgneal@0: )