Skip to content

Instantly share code, notes, and snippets.

@daTokenizer
Last active November 17, 2015 11:10
Show Gist options
  • Save daTokenizer/46b92a1c9b0e597b1cef to your computer and use it in GitHub Desktop.
Save daTokenizer/46b92a1c9b0e597b1cef to your computer and use it in GitHub Desktop.
a deployment assistent for projects with more then one deployment target
#! /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])
server_a
server_b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment