-
Notifications
You must be signed in to change notification settings - Fork 0
/
master.ps1
126 lines (117 loc) · 2.13 KB
/
master.ps1
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
$venv_path = ".\venv"
$venv_exist = Test-Path $venv_path
$dependencies_exist = Test-Path .\runtime.txt
if ($venv_exist) {
Write-Host "
Venv exists
"
Write-Host "
Using venv
"
Write-Host "
Activating Virtual Environemnt!...
"
.\venv\Scripts\activate
Write-Host "
VirtualEnv has been activated!
"
if ($dependencies_exist) {
Write-Host "
Dependencies already Exist!
"
Write-Host "
Done!
"
}
else {
Write-Host "
Installing dependencies...
"
pip install -r requirements.txt
fsutil file createnew runtime.txt 0
Write-Host "
Dependencies installed
"
Write-Host "
Done!
"
}
}
else {
Write-Host "
venv does not exist
"
Write-Host "
creating venv
"
pip install virtualenv
virtualenv venv
# virtualenv --python "C:\Users\rajee\AppData\Local\Programs\Python\Python38\python.exe" venv
Write-Host "
venv created
"
Write-Host "
Using venv
"
Write-Host "
Installing dependencies...
"
.\venv\Scripts\activate
pip install -r requirements.txt
fsutil file createnew runtime.txt 0
Write-Host "
Dependencies installed
"
Write-Host "
Done
"
}
$choice = Read-Host -Prompt ("
Press 1 to run initial setup.
Press 2 to start the webserver.
Press 3 to run the ADMIN utility.
Press 4 to exit.
")
$i = 0
While ($i -eq 0) {
if ($choice -eq 1) {
Write-Host "
Creating the Database...
"
Set-Location .\init-setup
python create-database.py
Write-Host "
Populating the database with admin users and other setup data...
"
python insert-data.py
python generate_rooms.py
Set-Location ..
$i++
}
elseif ($choice -eq 2) {
Write-Host "
Starting the webserver on port:5000
"
python .\app.py
$i++
}
elseif ($choice -eq 3) {
Write-Host "
Running the Admin Utility...
"
Write-Host "
WITH GREAT POWER COMES GREAT RESPONSIBILITY!
"
python .\add-admins.py
$i++
}
elseif ($choice -eq 4) {
deactivate
$i++
}
else {
Write-Host "Please enter a valid input"
deactivate
$i++
}
}