|
- Option Explicit
- Dim DeployMachine:DeployMachine = "KCI-APP01"
- Dim remoteDeployPath:remoteDeployPath = "C:\inetpub\tracking"
- Dim ScriptDirectory:ScriptDirectory = Replace(WScript.ScriptFullName,WScript.ScriptName,"")
- Dim DeployRoot:DeployRoot = "F:\Development\Tracking_Kits\CiCd\" '"C:\inetpub\wwwroot\"
-
- Dim fso:Set fso = WScript.CreateObject("Scripting.Filesystemobject")
- Dim WshShell:Set WshShell = WScript.CreateObject("Wscript.Shell")
- Dim objShell:Set objShell = CreateObject("Shell.Application")
- Dim transferFolder:transferFolder = "\\KCI-SYN-CL01\PC Transfer\"
- If fso.FolderExists(DeployRoot & "test") Then
- WshShell.Run "cmd.exe /c rmdir /s /q """ & DeployRoot & "test""" , 0,True
- End If
-
- CloneRepo
- ZipRepo
- Cleanup
- Deploy
-
- Sub Deploy
- Debug.WriteLine ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* cmd.exe copy """ & _
- transferFolder & "zzip.zip"" " & """" & remoteDeployPath & "\zzip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking"""
-
- WshShell.Run ScriptDirectory & "PsExec64.exe -i \\" & DeployMachine & " -u ntp\daniel_admin -p BarkHornSlam4* cmd.exe /C copy """ & _
- transferFolder & "\zzip.zip"" " & """" & remoteDeployPath & "\zip.zip""" & " & tar -xf ""C:\inetpub\tracking\zip.zip"" -C ""C:\inetpub\tracking""",1,True
-
-
- End Sub
-
-
- Sub Cleanup
- WshShell.CurrentDirectory = DeployRoot
- WshShell.Run "cmd.exe /c rmdir /s /q """ & DeployRoot & "test\""" , 0,True
- WScript.Sleep 2500
- WScript.Sleep 2500
- fso.DeleteFile DeployRoot & "\zzip.zip"
-
- End Sub
-
- Sub ZipRepo
- WScript.Sleep 2500
- WScript.Sleep 2500
- fso.OpenTextFile(DeployRoot & "zzip.zip", 2, True).Write "PK" & Chr(5) & Chr(6) _
- & String(18, Chr(0))
- WScript.Sleep 2500
- WScript.Sleep 2500
- Dim objZip
- Set objZip = objShell.NameSpace(DeployRoot & "zzip.zip")
- Dim objFolder:Set objFolder = objShell.NameSpace(DeployRoot & "test\")
-
- objZip.CopyHere objFolder.Items
- Do Until objZip.Items.Count = objFolder.Items.Count
- WScript.Sleep 200
- Loop
- fso.CopyFile DeployRoot & "zzip.zip", transferFolder & "zzip.zip", True
- Set objFolder = nothing
- End Sub
-
- Sub CloneRepo
- WshShell.Exec("git init test")
- WScript.Sleep 2500
- WshShell.CurrentDirectory = DeployRoot & "test"
- WshShell.Exec("git remote add -f origin https://dcovington:_3ggUSA6YELP@onefortheroadgit.sytes.net/dcovington/tracking_kits")
- WshShell.Exec("git config core.sparseCheckout true")
- Dim objFile
- Set objFile = fso.CreateTextFile(".git/info/sparse-checkout")
- objFile.WriteLine("App/")
- objFile.WriteLine("Data/arrow ne.jpg")
- objFile.WriteLine("Data/Label_Report.rep")
- objFile.WriteLine("Data/png-transparent-arrow-arrow-angle-triangle-black-thumbnail.jpg")
- objFile.WriteLine("dist/")
- objFile.WriteLine("MVC/")
- objFile.WriteLine("Dependancies/")
- objFile.WriteLine("index.asp")
- objFile.WriteLine("web.config")
- WshShell.Exec("git pull origin master")
- objFile.Close
- WScript.Sleep 10000
- Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",1)
- Dim readConfigFile:readConfigFile = objFile.ReadAll
- objFile.Close
- Dim devToFalseSetting:devToFalseSetting = Replace(readConfigFile,"dev = true","dev = false")
- Set objFile = fso.OpenTextFile(DeployRoot & "test\App\app.config.asp",2)
- objFile.Write(devToFalseSetting)
- End Sub
-
- '"F:\Development\Tracking_Kits\CiCd\test\App\app.config.asp"
|