Last active
December 28, 2015 04:19
-
-
Save andrebian/7441399 to your computer and use it in GitHub Desktop.
Script para deploy de aplicações em Python
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Criado originalmente po Arthur Furlan - http://arthurfurlan.org/ | |
from fabric.api import * | |
env.hosts = ['user@host'] | |
env.path = '/home/user_path/public_html' | |
env.port = '22' # Opcional | |
## Definições de deploy | |
def _git_pull(path, user, remote='origin', branch='master'): | |
''' Executa "git pull" no repositório da sua aplicação em produção. ''' | |
run('su %s -c "cd %s; git pull %s %s"' % (user, path, remote, branch)) | |
## Executando deploy | |
def deploy(version=None): | |
''' Executa o deploy no ambiente de PRODUÇÃO. ''' | |
_git_pull(env.path, 'user') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment