2 Title : The Ring Package Manager
4 Author: Mahmoud Fayed <msfclipper@yahoo.com>
7 # Load Global Libraries
10 # Load Application Files
18 func TestProcessVersion
19 ? 1.9 > 1.10 # 1 (True)
20 ? ProcessVersion("1.9") # "1.9" --> "001009" --> 1009
21 ? ProcessVersion("1.10") # "1.10" ---> "001010" --> 1010
22 ? ProcessVersion("1.9") > ProcessVersion("1.10") # 0 (False)
24 func CheckRingVersion aPackageInfo
25 # 1.0 1.1 .... 1.8 1.9 1.10
28 if ProcessVersion(version()) >= ProcessVersion(aPackageInfo[:ringversion])
32 func ProcessVersion cVersion
35 // 1.9 < 1.10 ----> Ring Output (False)
36 // 001009 < 001010 ----> Ring Output (True)
37 # "1.9" ---> ["1","9"]
38 aVersion = Split(cVersion,".") # List of Numbers
39 # 1.9 ---> [ "001" , "009"]
40 for cNumber in aVersion
42 if nSize < C_VERSIONSECTIONSIZE
43 cNumber = Copy("0",C_VERSIONSECTIONSIZE-nSize) + cNumber
46 cVersion = List2Str(aVersion) # [ "001" , "009"] ---> "001" + nl + "009"
47 cVersion = substr(cVersion,nl,"")
48 return 0+cVersion # "001009" ---> 1009
50 func GetMajorVersionNumber cVersion
51 nPos = substr(cVersion,".")
53 cVersion = left(cVersion,nPos-1)
57 func GetMajorVersionText cVersion
58 # Before version 1.0.0 ---> We return the package version
59 # From version 1.0.0 < 2.0.0 ---> We return empty string
60 # From 2.0.0 ---> We return the major version (v2, v3, etc)
61 nMajor = GetMajorVersionNumber(cVersion)
70 func IsCompatible cVersion1,cVersion2
71 if cVersion1 != cVersion2
72 if GetMajorVersionNumber(cVersion1) = 0 or
73 GetMajorVersionNumber(cVersion1) != GetMajorVersionNumber(cVersion2)