Last active
November 17, 2015 11:10
-
-
Save daTokenizer/46b92a1c9b0e597b1cef to your computer and use it in GitHub Desktop.
a deployment assistent for projects with more then one deployment target
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/python | |
############################################################################## | |
# | |
# a deployment assistent for projects with more then one deployment target | |
# | |
############################################################################### | |
import os | |
import sys | |
def usage(command): | |
print "usage:" | |
print " %s <server> - deploy to server" % command | |
print " %s all - deploy to all servers" % command | |
def deploy(server): | |
if server: | |
print "> git push %s master" % server | |
os.system("git push %s master" % server) | |
if __name__ == '__main__': | |
ALL_TOKEN = "all" | |
server_file = "server_list" | |
# see what the user supplied | |
if len(sys.argv) > 1: | |
os.system("git push") | |
if sys.argv[1] != ALL_TOKEN: | |
deploy(sys.argv[1]) | |
else: | |
with open(server_file) as f: | |
server_list = f.readlines() | |
server_list = [x.strip('\n') for x in server_list] | |
for server in server_list: | |
deploy(server) | |
else: | |
usage(sys.argv[0]) |
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
server_a | |
server_b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment