Advertisement
Guest User

Untitled

a guest
May 27th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #! coding:utf-8
  2. import os
  3. import uuid
  4.  
  5. from fabric.api import *
  6. from fabtools import nodejs, files, python
  7.  
  8. env.roledefs["dev"] = ["xxx@xxx"]
  9.  
  10. @task
  11. @roles("dev")
  12. def deploy(check_env=False):
  13. make_deploy("master", "...")
  14.  
  15.  
  16. def make_deploy(branch, project_root):
  17. tmp_file = "/tmp/%s.tar.gz" % uuid.uuid4().hex
  18.  
  19. local("git archive --format=tar.gz -o {output} -9 {branch}".format(
  20. output=tmp_file,
  21. branch=branch))
  22. put(tmp_file, tmp_file)
  23.  
  24. run("tar -xzf {filename} -C {project_root}".\
  25. format(project_root=project_root, filename=tmp_file))
  26. run("rm -f {filename}".format(filename=tmp_file))
  27. local("rm -f {filename}".format(filename=tmp_file))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement