-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·50 lines (42 loc) · 1.26 KB
/
setup.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
#!/usr/bin/env python3
import os
from textwrap import dedent
import subprocess
# checking whether all the necessary files are prepared
if not os.path.exists('assets'):
print('No "assets/" folder was found')
try:
os.makedirs('assets')
print('Created "assets/" folder')
except:
print('Failed to create "assets/"')
if not os.path.exists('.env'):
print('No ".env" file was found')
try:
with open('.env', 'w') as file:
content = dedent('''
GIN_MODE=debug
PORT=:3000
DB_FILE=database.db
''').strip()
file.write(content)
print(f'Created ".env" file with the following content: \n{content}')
except:
print('Failed to create ".env"')
# checking system installs
def node_installed():
try:
subprocess.run(['node', '-v'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return True
except FileNotFoundError:
return False
if not node_installed():
print('Node JS is not installed on the computer. Please install it')
subprocess.run(['open', 'https://nodejs.org/en' ])
exit(1)
dependencies = ['nodemon', 'typescript', 'sass']
print('Setting up the following dependencies: ')
for dep in dependencies:
print(f'Installing {dep}...')
subprocess.run(['npm', 'install', '-g', dep])
print('Done!')