-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwilio_script.py
More file actions
50 lines (41 loc) · 1.34 KB
/
twilio_script.py
File metadata and controls
50 lines (41 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
import os
# How to use:
# replace folder_path with the absolute path to your backend-new
file_name = "gettingstarted/settings.py"
my_whitelist = "DEFAULT NO MATCH"
name = sys.argv[1]
if name == "albert":
folder_path = "/Users/zgong/sum2020/Backend/backend-new/"
my_whitelist = "ALBERT_WHITELIST="
elif name == "vicky":
# REPLACE LINE BELOW WITH YOUR ABSOLUTE PATH
folder_path = "/Users/vickyli/Desktop/work/dev/backend-new/"
my_whitelist = "VICKY_WHITELIST="
elif name == "albert-dev":
# REPLACE LINE BELOW WITH YOUR ABSOLUTE PATH
folder_path = "/Users/zgong/sum2020/Backend/backend-new/"
my_whitelist = "DEV_WHITELIST="
elif name == "vicky-dev":
folder_path = "/Users/vickyli/Desktop/work/dev/backend-new/"
my_whitelist = "DEV_WHITELIST="
else:
print('unknown user argument')
exit()
reading_file = open(folder_path + file_name, "r")
new_file_content = ""
for line in reading_file:
stripped_line = line.strip()
if (my_whitelist in stripped_line):
new_line = my_whitelist + "\"" + sys.argv[2] + "\""
else:
new_line = stripped_line
new_file_content += new_line +"\n"
reading_file.close()
writing_file = open(folder_path + file_name, "w")
writing_file.write(new_file_content)
writing_file.close()
os.chdir(folder_path)
os.system('git add .')
os.system('git commit -m \"wl albert\"')
os.system('git push heroku master')