Skip to content

Instantly share code, notes, and snippets.

@andrebian
Last active December 28, 2015 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrebian/7441399 to your computer and use it in GitHub Desktop.
Save andrebian/7441399 to your computer and use it in GitHub Desktop.
Script para deploy de aplicações em Python
#!/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