Skip to content

Commit

Permalink
Add install.vbs and update readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal Chitalia committed Feb 3, 2016
1 parent a75481d commit 5c7df35
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SmartSyncExplorer application written using React Native

## To get started do the following from the root directory
``` shell
./install.sh
./install.sh (Windows users, please use "cscript install.vbs" instead of ./install.sh)
cd app
npm start
```
Expand Down
70 changes: 70 additions & 0 deletions install.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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.
WScript.Echo "Getting git 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 --init --recursive", 1, True)
If intReturnVal <> 0 Then
WScript.Echo "Error updating the submodules!"
WScript.Quit 3
End If

'Install npm dependencies.
WScript.Echo vbCrLf & "Installing npm dependencies"
'The following line is the equivalent of "cd app"
objShell.CurrentDirectory = strWorkingDirectory & "\app"
intReturnVal = objShell.Run("npm install", 1, True)
If intReturnVal <> 0 Then
WScript.Echo "Error in running npm install!"
WScript.Quit 6
End If

'Copy js files to app/js folder'
'The following line is the equivalent of "cd .."
objShell.CurrentDirectory = strWorkingDirectory
WScript.Echo vbCrLf & "Getting js files"
intReturnVal = objShell.Run("copy external\shared\libs\react.* app\js\", 1, True)
If intReturnVal <> 0 Then
WScript.Echo "Error in copying js files!"
WScript.Quit 3
End If
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

0 comments on commit 5c7df35

Please sign in to comment.