-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaddModule.py
41 lines (26 loc) · 1006 Bytes
/
addModule.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
import subprocess
import os
import getModule as gm
import removeModule as rm
def obtainModule(moduleName):
return gm.findModule(moduleName)
def git(filename):
subprocess.call(["git", "clone",filename])
def addModule(filename):
cloneLink = obtainModule(filename)
try :
rm.removeModule(filename)
git(cloneLink)
subprocess.call(["mv", filename,"../modules"])
path = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
path = path +"/modules/"+filename
shellCommand = "cd "+ path + " &&" + " npm install"
subprocess.call(shellCommand, shell=True)
shellCommand = "cd "+ path + " &&" + " npm audit fix"
subprocess.call(shellCommand, shell=True)
shellCommand = "node changeConfig.js add "+filename
subprocess.call(shellCommand, shell=True)
print (filename + " Added")
print ("---------------------------")
except :
print("Error: Adding Module")