diff options
author | Cody Hiar <codyfh@gmail.com> | 2017-03-01 04:14:06 +0000 |
---|---|---|
committer | Cody Hiar <codyfh@gmail.com> | 2017-03-01 04:14:06 +0000 |
commit | f95311ce4de26cf2c2db14906410f55589fab0a8 (patch) | |
tree | 1b7ace85a73b6a2f9a9b920311a660c5b6537252 /snippets/python/fabfile.py | |
parent | 5fcd5c3ab60bde0d43367e4243512450a2f83091 (diff) |
Adding some snippet functionality, reduce typing
Diffstat (limited to 'snippets/python/fabfile.py')
-rw-r--r-- | snippets/python/fabfile.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/snippets/python/fabfile.py b/snippets/python/fabfile.py new file mode 100644 index 0000000..c519167 --- /dev/null +++ b/snippets/python/fabfile.py @@ -0,0 +1,33 @@ +"""Fabfile for automating some mundane tasks.""" +from fabric.api import cd, env, prefix, run + +# Use local SSH config +env.use_ssh_config = True + + +def prod(): + """Production host.""" + env.hosts = ['myserver'] + env.virtual_env = 'projname' + env.forward_agent = True + + +def prod_old(): + """Old way of defining.""" + env.user = 'cody' + env.hosts = ['123.123.123.123:1234'] + env.virtual_env = 'projname' + env.forward_agent = True + + +def deploy_virstualenv(): + """Deploy through virtualenv.""" + with prefix('workon {}'.format(env.virtual_env)): + run('deploy') + + +def deploy_git_folder(): + """Deploy the application.""" + with cd('www'): + run('git fetch origin master') + run('git reset --hard origin/master') |