Created
January 11, 2015 20:37
-
-
Save johnie/cf553bc4bb2e86d3ddc5 to your computer and use it in GitHub Desktop.
Simple Fabric deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import with_statement | |
import os.path | |
from fabric.api import * | |
from fabric.contrib.project import * | |
""" | |
Environments | |
""" | |
def prod(): | |
env.hosts = ['ssh.host.com'] | |
env.user = 'sshmaster' | |
env.path = 'path/to/prod-folder' | |
"Default deploy to prod" | |
prod() | |
def stage(): | |
env.hosts = ['ssh.host.com'] | |
env.user = 'sshmaster' | |
env.path = 'path/to/stage-folder' | |
""" | |
Deployment | |
""" | |
def deploy(): | |
require('path', provided_by=[prod]) | |
extra_opts = '--omit-dir-times --no-perms' | |
rsync_project( | |
env.path, | |
'%s/' % os.path.dirname(__file__), | |
['log/*', 'cache/*', '.git', '.DS_Store', 'Gulpfile.js', 'fabfile.py*', 'node_modules/', 'bower_components/'], | |
False, | |
extra_opts=extra_opts, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment