From 5c7df35d5b975d3e3919698de6384a1bde559fca Mon Sep 17 00:00:00 2001 From: Kunal Chitalia Date: Wed, 3 Feb 2016 15:43:44 -0800 Subject: [PATCH] Add install.vbs and update readme file --- README.md | 2 +- install.vbs | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 install.vbs diff --git a/README.md b/README.md index cea914a1..ce0aa237 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/install.vbs b/install.vbs new file mode 100644 index 00000000..d2b7d497 --- /dev/null +++ b/install.vbs @@ -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