Skip to content

Commit

Permalink
bump version to v0.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xorpaul committed Jun 7, 2018
1 parent 0e2354b commit de4b805
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
15 changes: 13 additions & 2 deletions forge.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ func queryForgeAPI(name string, file string, fm ForgeModule) ForgeResult {
}

before := time.Now()
currentRelease := gjson.Get(string(body), "current_release").Map()

jsonBody := string(body)
currentRelease := gjson.Get(jsonBody, "current_release").Map()
deprecatedTimestamp := gjson.Get(jsonBody, "deprecated_at")
successorModule := gjson.Get(jsonBody, "superseded_by").Map()
duration := time.Since(before).Seconds()

version := currentRelease["version"].String()
modulemd5sum := currentRelease["file_md5"].String()
moduleFilesize := currentRelease["file_size"].Int()
Expand All @@ -197,6 +200,14 @@ func queryForgeAPI(name string, file string, fm ForgeModule) ForgeResult {
forgeJsonParseTime += duration
mutex.Unlock()

if deprecatedTimestamp.Exists() && deprecatedTimestamp.String() != "null" {
supersededText := ""
if successorModule["slug"].Exists() {
supersededText = " The author has suggested " + successorModule["slug"].String() + " as its replacement"
}
Warnf("WARN: Forge module " + fm.author + "-" + fm.name + " has been deprecated by its author since " + deprecatedTimestamp.String() + supersededText)
}

Debugf("found version " + version + " for " + name + "-latest")
latestForgeModules.Lock()
latestForgeModules.m[fm.author+"-"+fm.name] = version
Expand Down
2 changes: 1 addition & 1 deletion g10k.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func main() {
version := *versionFlag

if version {
fmt.Println("g10k version 0.4.63 Build time:", buildtime, "UTC")
fmt.Println("g10k version 0.4.7 Build time:", buildtime, "UTC")
os.Exit(0)
}

Expand Down
6 changes: 5 additions & 1 deletion helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ func Infof(s string) {
// Warnf is a helper function for warning logging
func Warnf(s string) {
color.Set(color.FgYellow)
fmt.Println(s)
if !debug && !verbose && !info && !quiet {
fmt.Println(s + "\n")
} else {
fmt.Println(s)
}
color.Unset()
}

Expand Down

0 comments on commit de4b805

Please sign in to comment.