Skip to content

Commit

Permalink
Replaced semver and updated logic to support newer node versioning lo…
Browse files Browse the repository at this point in the history
…gic. Closes #276
  • Loading branch information
coreybutler committed May 31, 2017
1 parent 6382830 commit 472411e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SET ORIG=%CD%
REM SET GOPATH=%CD%\src
SET GOBIN=%CD%\bin
SET GOARCH=386
SET version=1.1.4
SET version=1.1.5

REM Get the version number from the setup file
REM for /f "tokens=*" %%i in ('findstr /n . %INNOSETUP% ^| findstr ^4:#define') do set L=%%i
Expand Down
2 changes: 1 addition & 1 deletion nvm.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define MyAppName "NVM for Windows"
#define MyAppShortName "nvm"
#define MyAppLCShortName "nvm"
#define MyAppVersion "1.1.4"
#define MyAppVersion "1.1.5"
#define MyAppPublisher "Ecor Ventures LLC"
#define MyAppURL "http://github.com/coreybutler/nvm"
#define MyAppExeName "nvm.exe"
Expand Down
2 changes: 1 addition & 1 deletion src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

const (
NvmVersion = "1.1.4"
NvmVersion = "1.1.5"
)

type Environment struct {
Expand Down
18 changes: 10 additions & 8 deletions src/nvm/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import(
"../arch"
"../file"
"../web"
"../semver"
// "../semver"
"github.com/blang/semver"
)

/**
Expand Down Expand Up @@ -102,8 +103,8 @@ func (s BySemanticVersion) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s BySemanticVersion) Less(i, j int) bool {
v1, _ := semver.New(s[i])
v2, _ := semver.New(s[j])
v1, _ := semver.Make(s[i])
v2, _ := semver.Make(s[j])
return v1.GTE(v2)
}

Expand All @@ -124,14 +125,15 @@ func isCurrent(element map[string]interface{}) bool {
return false
}

version, _ := semver.New(element["version"].(string)[1:])
benchmark, _ := semver.New("1.0.0")
version, _ := semver.Make(element["version"].(string)[1:])
benchmark, _ := semver.Make("1.0.0")

if version.LT(benchmark) {
return false
}

return version.Major%2 == 1
return true
// return version.Major%2 == 1
}

// Identifies a stable old version.
Expand All @@ -140,7 +142,7 @@ func isStable(element map[string]interface{}) bool {
return false
}

version, _ := semver.New(element["version"].(string)[1:])
version, _ := semver.Make(element["version"].(string)[1:])

if (version.Major != 0) {
return false
Expand All @@ -155,7 +157,7 @@ func isUnstable(element map[string]interface{}) bool {
return false
}

version, _ := semver.New(element["version"].(string)[1:])
version, _ := semver.Make(element["version"].(string)[1:])

if (version.Major != 0) {
return false
Expand Down

0 comments on commit 472411e

Please sign in to comment.