This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
install.vbs
51 lines (44 loc) · 1.89 KB
/
install.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Option Explicit
On Error Resume Next
' *** ***
' * *
' * ATTENTION: Windows Users *
' * *
' * Run this script to initialize the submodules of your repository
' * From the command line: cscript install.vbs *
' *** ***
Dim strWorkingDirectory, objShell, intReturnVal
' Set the working folder to the script location (i.e. the repo root)
strWorkingDirectory = GetDirectoryName(WScript.ScriptFullName)
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.CurrentDirectory = strWorkingDirectory
' Initialze and update the submodules.
intReturnVal = objShell.Run("git submodule init", 1, True)
If intReturnVal <> 0 Then
WScript.Echo "Error initializing the submodules!"
WScript.Quit 2
End If
intReturnVal = objShell.Run("git submodule sync", 1, True)
If intReturnVal <> 0 Then
WScript.Echo "Error syncing the submodules!"
WScript.Quit 6
End If
intReturnVal = objShell.Run("git submodule update", 1, True)
If intReturnVal <> 0 Then
WScript.Echo "Error updating the submodules!"
WScript.Quit 3
End If
WScript.Echo vbCrLf & "Successfully initialized submodules."
WScript.Quit 0
' -------------------------------------------------------------------
' - Gets the directory name, from a file path.
' -------------------------------------------------------------------
Function GetDirectoryName(ByVal strFilePath)
Dim strFinalSlash
strFinalSlash = InStrRev(strFilePath, "\")
If strFinalSlash = 0 Then
GetDirectoryName = strFilePath
Else
GetDirectoryName = Left(strFilePath, strFinalSlash)
End If
End Function