17
17
18
18
from glob import glob
19
19
from .deploy import *
20
+ from .client import get_nuvolaris_config
21
+
20
22
21
23
def scan ():
22
24
# first look for requirements.txt and build the venv (add in set)
23
25
deployments = set ()
24
26
packages = set ()
25
27
26
28
print ("> Scan:" )
27
- reqs = glob ("packages/*/*/requirements.txt" ) + glob ("packages/*/*/package.json" )
29
+
30
+ # => REQUIREMENTS
31
+ default_reqs_globs = ["packages/*/*/requirements.txt" ,
32
+ "packages/*/*/package.json" ,
33
+ "packages/*/*/composer.json" ,
34
+ "packages/*/*/go.mod" ]
35
+
36
+ package_globs = get_nuvolaris_config ("requirements" , default_reqs_globs )
37
+ reqs = list ()
38
+
39
+ for pkg_glob in package_globs :
40
+ items = glob (pkg_glob )
41
+ # extend first list without duplicates
42
+ reqs .extend (x for x in items if x not in reqs )
43
+
28
44
# req = reqs[0]
29
45
# from util.deploy.deploy import *
30
46
for req in reqs :
31
47
print (">> Requirements:" , req )
32
48
sp = req .split ("/" )
33
- act = build_zip (sp [1 ],sp [2 ])
49
+ act = build_zip (sp [1 ], sp [2 ])
34
50
deployments .add (act )
35
51
packages .add (sp [1 ])
36
-
37
- mains = glob ("packages/*/*/index.js" ) + glob ("packages/*/*/__main__.py" )
52
+
53
+ # => MAINS
54
+ default_mains_globs = ["packages/*/*/index.js" ,
55
+ "packages/*/*/__main__.py" ,
56
+ "packages/*/*/index.php" ,
57
+ "packages/*/*/main.go" ]
58
+ mains_globs = get_nuvolaris_config ("mains" , default_mains_globs )
59
+ mains = list ()
60
+ for main_glob in mains_globs :
61
+ items = glob (main_glob )
62
+ # extend first list without duplicates
63
+ mains .extend (x for x in items if x not in mains )
64
+
38
65
# main = mains[2]
39
- for main in mains :
66
+ for main in mains :
40
67
print (">> Main:" , main )
41
68
sp = main .split ("/" )
42
- act = build_action (sp [1 ],sp [2 ])
69
+ act = build_action (sp [1 ], sp [2 ])
43
70
deployments .add (act )
44
- packages .add (sp [1 ])
71
+ packages .add (sp [1 ])
72
+
73
+ # => SINGLES
74
+ default_singles_globs = ["packages/*/*.py" ,
75
+ "packages/*/*.js" ,
76
+ "packages/*/*.php" ,
77
+ "packages/*/*.go" ]
78
+ singles_globs = get_nuvolaris_config ("singles" , default_singles_globs )
79
+ singles = list ()
80
+ for single_glob in singles_globs :
81
+ items = glob (single_glob )
82
+ singles .extend (x for x in items if x not in singles )
45
83
46
- singles = glob ("packages/*/*.py" ) + glob ("packages/*/*.js" )
47
84
# single = singles[0]
48
85
for single in singles :
49
86
print (">> Action:" , single )
@@ -52,11 +89,10 @@ def scan():
52
89
packages .add (sp [1 ])
53
90
54
91
print ("> Deploying:" )
55
-
56
92
for package in packages :
57
93
print (">> Package:" , package )
58
94
deploy_package (package )
59
-
95
+
60
96
for action in deployments :
61
97
print (">>> Action:" , action )
62
- deploy_action (action )
98
+ deploy_action (action )
0 commit comments