Last active
          October 13, 2015 22:38 
        
      - 
      
 - 
        
Save mgax/4266737 to your computer and use it in GitHub Desktop.  
    fabfile for sarge deployment
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | import os | |
| import subprocess | |
| from StringIO import StringIO | |
| from fabric.api import * | |
| _host, _directory = os.environ['TARGET'].split(':') | |
| env['hosts'] = [_host] | |
| env['target_directory'] = _directory | |
| env['use_ssh_config'] = True | |
| @task | |
| def deploy(): | |
| tarball = subprocess.check_output(['git', 'archive', 'HEAD']) | |
| with cd(env['target_directory']): | |
| put(StringIO(tarball), '_app.tar') | |
| try: | |
| run('bin/airship deploy _app.tar') | |
| finally: | |
| run('rm _app.tar') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment