-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
54 lines (41 loc) · 1.61 KB
/
config.py
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
50
51
52
53
54
import os, json
from subprocess import Popen, PIPE
def folderCreation(folders):
for x in folders:
if os.path.isdir(x) != True:
print(f"Folder creation... {x}")
os.mkdir(x)
print("Created...")
def frameworkInst(cmdInst):
proc = Popen(cmdInst, stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
print(f'AppName: {cmdInst[-1]} created.')
def main():
with open('config.json', 'r') as f:
jsonData = json.load(f)
for x in jsonData:
if x == 'folders':
folderCreation(jsonData[x])
""" Installation depends on "service" : True """
if x == 'installation':
cmdInst = []
for y in jsonData[x]:
cmdInst = []
for list in jsonData[x][y][2]:
cmdInst.append(list)
cmdInst.append(jsonData[x][y][1])
if bool(jsonData[x][y][0]) == True:
frameworkInst(cmdInst)
#print(y)
#print(jsonData[x][y][0])
# leci pokoleji jak w pliku json, najpierw django and true (instllationDjango), react and true (installationReact)
# print(jsonData["installation"]["django"])
# print(jsonData["installation"]["react"])
if __name__ == '__main__':
main()
#folderCreation(jsonData["folders"])
#djangoInstallation('Testowski')
#reactInstallation('dupowski')
#print(json.dumps(jsonData["folders"], indent=4))
#print(json.dumps(jsonData["installation"], indent=4))
#print(json.dumps(jsonData, indent=4))