Reads the names of files that have arrived from a git pull and creates the necessary commands to deploy them in a deploy.sh
file.
git pull | python prepare.py
This creates a deploy.sh file
sh deploy.sh
Any new files will be deployed to the server.
import sys
import re
f = open("deploy.sh", "w")
for line in sys.stdin:
# Turn them into this "views/modes/profitiser.html"
matchObj = re.match( r'\s*(.*/)+(.*)\.(.*)\s*\|\s*\d+\s*\+*\-*', line)
if matchObj:
dir = matchObj.group(1)
file = matchObj.group(2) +"."+ matchObj.group(3)
command = "sudo cp " + dir + file + "/var/www/html/dev/sku/" + dir
f.write(command + "\n")
f.close()