Update RingPM - installcommand.ring - GetMajorVersion() Function - Semantic Versioning
@@ -162,7 +162,7 @@ class InstallCommand
func GetPackageFolderName aPackageInfo
if cBranchName = "master"
- return aPackageInfo[:folder]
+ return aPackageInfo[:folder] + GetMajorVersion(aPackageInfo)
ok
return aPackageInfo[:folder] + cBranchName
@@ -174,3 +174,21 @@ class InstallCommand
cPackageInfo = "aPackageInfo = " + List2Code(aPackageInfo)
}
return cPackageInfo
+
+ func GetMajorVersion aPackageInfo
+ # Before version 1.0.0 ---> We return the package version
+ # From version 1.0.0 < 2.0.0 ---> We return empty string
+ # From 2.0.0 ---> We return the major version (v2, v3, etc)
+ cVersion = aPackageInfo[:version]
+ nPos = substr(cVersion,".")
+ if nPos
+ cVersion = left(cVersion,nPos-1)
+ ok
+ nMajor = 0 + cVersion
+ if nMajor = 0
+ return "v"+aPackageInfo[:version]
+ but nMajor = 1
+ return
+ else
+ return "v"+nMajor
+ ok
