22SETLOCAL ENABLEDELAYEDEXPANSION
33
44SET RESETVARS = https://raw.githubusercontent.com/PredixDev/local-setup/master/resetvars.vbs
5+ SET DOWNLOADFILE = https://raw.githubusercontent.com/PredixDev/local-setup/master/downloadFile.ps1
56
67GOTO START
78
@@ -23,7 +24,8 @@ IF /I "%1"=="/putty" SET install[putty]=1
2324IF /I " %1 " == " /jdk" SET install[jdk] = 1
2425IF /I " %1 " == " /maven" SET install[maven] = 1
2526IF /I " %1 " == " /sts" SET install[sts] = 1
26- IF /I " %1 " == " /curl" SET install[curl] = 1
27+ rem curl is not reliable on windows command window
28+ rem IF /I "%1"=="/curl" SET install[curl]=1
2729IF /I " %1 " == " /nodejs" SET install[nodejs] = 1
2830IF /I " %1 " == " /python2" SET install[python2] = 1
2931IF /I " %1 " == " /python3" SET install[python3] = 1
@@ -40,6 +42,8 @@ GOTO :eof
4042 ECHO Getting Dependencies
4143 ECHO !RESETVARS!
4244 @ powershell -Command " (new-object net.webclient).DownloadFile('!RESETVARS! ','%TEMP% \resetvars.vbs')"
45+ ECHO !DOWNLOADFILE!
46+ @ powershell -Command " (new-object net.webclient).DownloadFile('!DOWNLOADFILE! ','downloadFile.ps1')"
4347GOTO :eof
4448
4549:RELOAD_ENV
@@ -93,19 +97,20 @@ IF NOT !errorlevel! EQU 0 (
9397 CALL :GET_DEPENDENCIES
9498 CALL :CHOCO_INSTALL 7zip.commandline 7z
9599 REM get the url of the release file
96- (curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases > output.tmp )
100+ @ powershell -Command " & { . .\downloadFile.ps1; DownloadFile ' https://api.github.com/repos/PredixDev/predix-cli/releases' ' output.tmp' } "
97101 < output.tmp ( jq -r " .[0].assets[0].browser_download_url" > output2.tmp )
98102 SET /p cli_url = < output2.tmp
99103 @ powershell -Command " (new-object net.webclient).DownloadFile('!cli_url! ','predix-cli.tar.gz')"
100104 7z x " predix-cli.tar.gz" -so | 7z x -aoa -si -ttar -o" predix-cli"
101105 REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
102106 copy predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE% \chocolatey\bin\
107+ echo " mklink if not already there"
103108 mklink %ALLUSERSPROFILE% \chocolatey\bin\px.exe %ALLUSERSPROFILE% \chocolatey\bin\predix.exe
104109 ECHO Predix CLI installed here: %ALLUSERSPROFILE% \chocolatey\bin\
105110) ELSE (
106111 predix -v > pxcliv.tmp
107112 SET /p predixcli_current_version = < pxcliv.tmp
108- (curl -s -L -k https://api.github.com/repos/PredixDev/predix-cli/releases > releaseresponse.tmp )
113+ @ powershell -Command " & { . .\downloadFile.ps1; DownloadFile ' https://api.github.com/repos/PredixDev/predix-cli/releases' ' releaseresponse.tmp' } "
109114 < releaseresponse.tmp (jq -r " .[0].tag_name" > releaseresponsename.tmp)
110115 < releaseresponsename.tmp (SET /p cli_latest_tag=)
111116 SET cli_latest_tag = !cli_latest_tag:~1 !
@@ -126,18 +131,19 @@ predix -v
126131GOTO :eof
127132
128133:UPGRADE_PREDIXCLI
129- ECHO Installing predixcli...
134+ ECHO Upgrading predixcli...
130135 ECHO Downloading installer
131136 CALL :GET_DEPENDENCIES
132137 CALL :CHOCO_INSTALL 7zip.commandline 7z
133138 REM get the url of the release file
134- (curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases > output.tmp )
139+ @ powershell -Command " & { . .\downloadFile.ps1; DownloadFile ' https://api.github.com/repos/PredixDev/predix-cli/releases' ' output.tmp' } "
135140 < output.tmp ( jq -r " .[0].assets[0].browser_download_url" > output2.tmp )
136141 SET /p cli_url = < output2.tmp
137142 @ powershell -Command " (new-object net.webclient).DownloadFile('!cli_url! ','predix-cli.tar.gz')"
138143 7z x " predix-cli.tar.gz" -so | 7z x -aoa -si -ttar -o" predix-cli"
139144 REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
140145 copy predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE% \chocolatey\bin\
146+ echo " mklink if not already there"
141147 mklink %ALLUSERSPROFILE% \chocolatey\bin\px.exe %ALLUSERSPROFILE% \chocolatey\bin\predix.exe
142148 ECHO Predix CLI installed here: %ALLUSERSPROFILE% \chocolatey\bin\
143149GOTO :eof
@@ -152,7 +158,7 @@ IF NOT !errorlevel! EQU 0 (
152158 CALL :GET_DEPENDENCIES
153159 CALL :CHOCO_INSTALL 7zip.commandline 7z
154160 REM get the url of the release file
155- (curl -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases > output.tmp )
161+ @ powershell -Command " & { . .\downloadFile.ps1; DownloadFile ' https://api.github.com/repos/PredixDev/predix-mobile-cli/releases' ' output.tmp' } "
156162 < output.tmp ( jq -r " [ .[] | select(.prerelease==false) ] | .[0].assets[] | select(.name | contains(\" win\" )) | .browser_download_url" > output2.tmp )
157163 < output.tmp ( jq -r " .[0].assets[0].browser_download_url" > output2.tmp )
158164 < output2.tmp (SET /p cli_url=)
@@ -183,7 +189,7 @@ SET install[putty]=0
183189SET install[jdk] = 0
184190SET install[maven] = 0
185191SET install[sts] = 0
186- SET install[curl] = 0
192+ rem SET install[curl]=0
187193SET install[nodejs] = 0
188194SET install[python2] = 0
189195SET install[python3] = 0
@@ -199,7 +205,7 @@ SET install[putty]=1
199205SET install[jdk] = 1
200206SET install[maven] = 1
201207SET install[sts] = 1
202- SET install[curl] = 1
208+ rem SET install[curl]=1
203209SET install[nodejs] = 1
204210SET install[python2] = 1
205211SET install[python3] = 1
@@ -221,13 +227,13 @@ SET putty=2
221227SET jdk = 3
222228SET maven = 4
223229SET sts = 5
224- SET curl = 6
225- SET nodejs = 7
226- SET python2 = 8
227- SET python3 = 9
228- SET jq = 10
229- SET predixcli = 11
230- SET mobilecli = 12
230+ rem SET curl=6
231+ SET nodejs = 6
232+ SET python2 = 7
233+ SET python3 = 8
234+ SET jq = 9
235+ SET predixcli = 10
236+ SET mobilecli = 11
231237
232238CALL :PROCESS_ARGS %*
233239
@@ -265,7 +271,7 @@ IF !install[jdk]! EQU 1 CALL :CHOCO_INSTALL jdk8 javac
265271IF !install[maven]! EQU 1 CALL :CHOCO_INSTALL maven mvn
266272REM TODO - Uncomment once the chocolatey package is fixed
267273REM IF !install[sts]! EQU 1 CALL :CHOCO_INSTALL springtoolsuite
268- IF !install[curl]! EQU 1 CALL :CHOCO_INSTALL curl
274+ rem IF !install[curl]! EQU 1 CALL :CHOCO_INSTALL curl
269275
270276IF !install[nodejs]! EQU 1 CALL :CHOCO_INSTALL nodejs.install node
271277CALL :RELOAD_ENV
0 commit comments