From 472411ed65a4e7bedc8b6f5d1cb26def38aef737 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Wed, 31 May 2017 08:40:50 -0500 Subject: [PATCH] Replaced semver and updated logic to support newer node versioning logic. Closes #276 --- build.bat | 2 +- nvm.iss | 2 +- src/nvm.go | 2 +- src/nvm/node/node.go | 18 ++++++++++-------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/build.bat b/build.bat index e037c6fd..35f1c290 100644 --- a/build.bat +++ b/build.bat @@ -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 diff --git a/nvm.iss b/nvm.iss index 1f2164a9..5d621867 100644 --- a/nvm.iss +++ b/nvm.iss @@ -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" diff --git a/src/nvm.go b/src/nvm.go index d7f0cda6..bd213e0c 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -17,7 +17,7 @@ import ( ) const ( - NvmVersion = "1.1.4" + NvmVersion = "1.1.5" ) type Environment struct { diff --git a/src/nvm/node/node.go b/src/nvm/node/node.go index 55a3064c..1e69dfb9 100644 --- a/src/nvm/node/node.go +++ b/src/nvm/node/node.go @@ -9,7 +9,8 @@ import( "../arch" "../file" "../web" - "../semver" + // "../semver" + "github.com/blang/semver" ) /** @@ -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) } @@ -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. @@ -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 @@ -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