-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodeeol.go
46 lines (39 loc) · 1.09 KB
/
nodeeol.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
package main
import (
"cuddly-eureka-/conf/initialize"
"cuddly-eureka-/github"
"cuddly-eureka-/http"
nodeinternal "cuddly-eureka-/plugininternal"
"cuddly-eureka-/types"
"cuddly-eureka-/util"
"strings"
)
type NodeEOL struct {
}
func extractCycleFromDotXString(dotxNotation string) string {
split := strings.Split(strings.TrimSpace(dotxNotation), ".")
return split[0]
}
func (node NodeEOL) Check(repoName string, opts ...*string) types.MaturityCheck {
app := initialize.GetAppConstants()
g := &github.GitHub{}
g = g.Init(app.GitHubToken)
eolDetails, eolErr := http.EOLProvider(http.EOLNode)
if eolErr != nil {
panic("Failed to find EOL details for " + http.EOLNode + " ")
}
var existingVersion = nodeinternal.FindNodeVersion(repoName)
if existingVersion != nil {
cycleNumber := extractCycleFromDotXString(*existingVersion)
eolValue := util.CheckEOL(cycleNumber, eolDetails)
return eolValue
}
return types.MaturityValue0
}
func (node NodeEOL) Meta() types.MaturityMeta {
return types.MaturityMeta{
Type: types.MaturityTypeDependency,
Name: "Not EOL: Node",
}
}
var Check NodeEOL