-
Notifications
You must be signed in to change notification settings - Fork 0
/
runme.go
50 lines (40 loc) · 1.18 KB
/
runme.go
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
package main
import (
"github.com/ilucin/go-mdm/db"
"github.com/ilucin/go-mdm/lib-manager"
"github.com/ilucin/go-mdm/parser"
"github.com/ilucin/go-mdm/repo"
)
func main() {
db.Init()
// db.TestPrepare()
projectRepos := []string{"github.com/ilucin/plutus-app", "github.com/angular/angular", "github.com/facebook/react", "github.com/twbs/bootstrap", "github.com/rackt/redux", "github.com/postcss/postcss", "github.com/infinumjs/hektor-gulp", "github.com/infinumjs/hektor-grunt", "github.com/ilucin/plasticknives-web"}
scanProjects(projectRepos)
scanLibs()
}
func scanLibs() {
libs := db.GetLibs()
for i := 0; i < len(libs); i++ {
scanLib(libs[i])
}
}
func scanLib(lib db.Lib) {
version, err := libManager.Scan(lib.Name, lib.Type)
if err == nil {
db.UpdateLibVersion(lib, version)
}
}
func scanProjects(projectRepos []string) {
if len(projectRepos) < 0 {
return
}
for i := 0; i < len(projectRepos); i++ {
scanProject(projectRepos[i])
}
}
func scanProject(projectRepo string) {
project := db.CreateOrGetProject(projectRepo)
file, libType, _ := repo.Scan(projectRepo)
libMap := parser.ParseStruct{}.Parse(libType, file)
db.UpdateProjectLibs(project, libMap, libType)
}