diff --git a/src/main.go b/src/main.go index c9e766d..257799c 100644 --- a/src/main.go +++ b/src/main.go @@ -1,4 +1,4 @@ -package main +package main import ( "crypto/md5" @@ -11,7 +11,7 @@ import ( ) var ( - VERSION = "1.5.54" + VERSION = "1.5.55" ) var ( diff --git a/version.bat b/version.bat new file mode 100644 index 0000000..6cc0bde --- /dev/null +++ b/version.bat @@ -0,0 +1,5 @@ +@echo off +for /f "delims=" %%i in ('type .version') do set v=%%i +echo version=%v% +cscript //nologo "version.vbs" ".\src\main.go" "%v%" +exit /b 0 diff --git a/version.vbs b/version.vbs new file mode 100644 index 0000000..77eaf46 --- /dev/null +++ b/version.vbs @@ -0,0 +1,23 @@ +Dim objFSO, objFile, strContent, objRegEx, args, adodbStream + +Set objFSO = CreateObject("Scripting.FileSystemObject") +Set args = WScript.Arguments +Set adodbStream = CreateObject("ADODB.Stream") + +adodbStream.Charset = "utf-8" +adodbStream.Open +adodbStream.LoadFromFile args(0) +strContent = adodbStream.ReadText +adodbStream.Close + +Set objRegEx = New RegExp +objRegEx.Global = True +objRegEx.IgnoreCase = True +objRegEx.Pattern = "VERSION\s+=\s+\""[\d\.]+\""" +strContent = objRegEx.Replace(strContent, "VERSION = """ & args(1) & """") + +adodbStream.Charset = "utf-8" +adodbStream.Open +adodbStream.WriteText strContent +adodbStream.SaveToFile args(0), 2 +adodbStream.Close \ No newline at end of file