2
2
SETLOCAL ENABLEDELAYEDEXPANSION
3
3
4
4
SET RESETVARS = https://raw.githubusercontent.com/PredixDev/local-setup/master/resetvars.vbs
5
+ SET DOWNLOADFILE = https://raw.githubusercontent.com/PredixDev/local-setup/master/downloadFile.ps1
5
6
6
7
GOTO START
7
8
@@ -23,7 +24,8 @@ IF /I "%1"=="/putty" SET install[putty]=1
23
24
IF /I " %1 " == " /jdk" SET install[jdk] = 1
24
25
IF /I " %1 " == " /maven" SET install[maven] = 1
25
26
IF /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
27
29
IF /I " %1 " == " /nodejs" SET install[nodejs] = 1
28
30
IF /I " %1 " == " /python2" SET install[python2] = 1
29
31
IF /I " %1 " == " /python3" SET install[python3] = 1
@@ -40,6 +42,8 @@ GOTO :eof
40
42
ECHO Getting Dependencies
41
43
ECHO !RESETVARS!
42
44
@ 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')"
43
47
GOTO :eof
44
48
45
49
:RELOAD_ENV
@@ -93,19 +97,20 @@ IF NOT !errorlevel! EQU 0 (
93
97
CALL :GET_DEPENDENCIES
94
98
CALL :CHOCO_INSTALL 7zip.commandline 7z
95
99
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' } "
97
101
< output.tmp ( jq -r " .[0].assets[0].browser_download_url" > output2.tmp )
98
102
SET /p cli_url = < output2.tmp
99
103
@ powershell -Command " (new-object net.webclient).DownloadFile('!cli_url! ','predix-cli.tar.gz')"
100
104
7z x " predix-cli.tar.gz" -so | 7z x -aoa -si -ttar -o" predix-cli"
101
105
REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
102
106
copy predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE% \chocolatey\bin\
107
+ echo " mklink if not already there"
103
108
mklink %ALLUSERSPROFILE% \chocolatey\bin\px.exe %ALLUSERSPROFILE% \chocolatey\bin\predix.exe
104
109
ECHO Predix CLI installed here: %ALLUSERSPROFILE% \chocolatey\bin\
105
110
) ELSE (
106
111
predix -v > pxcliv.tmp
107
112
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' } "
109
114
< releaseresponse.tmp (jq -r " .[0].tag_name" > releaseresponsename.tmp)
110
115
< releaseresponsename.tmp (SET /p cli_latest_tag=)
111
116
SET cli_latest_tag = !cli_latest_tag:~1 !
@@ -126,18 +131,19 @@ predix -v
126
131
GOTO :eof
127
132
128
133
:UPGRADE_PREDIXCLI
129
- ECHO Installing predixcli...
134
+ ECHO Upgrading predixcli...
130
135
ECHO Downloading installer
131
136
CALL :GET_DEPENDENCIES
132
137
CALL :CHOCO_INSTALL 7zip.commandline 7z
133
138
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' } "
135
140
< output.tmp ( jq -r " .[0].assets[0].browser_download_url" > output2.tmp )
136
141
SET /p cli_url = < output2.tmp
137
142
@ powershell -Command " (new-object net.webclient).DownloadFile('!cli_url! ','predix-cli.tar.gz')"
138
143
7z x " predix-cli.tar.gz" -so | 7z x -aoa -si -ttar -o" predix-cli"
139
144
REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
140
145
copy predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE% \chocolatey\bin\
146
+ echo " mklink if not already there"
141
147
mklink %ALLUSERSPROFILE% \chocolatey\bin\px.exe %ALLUSERSPROFILE% \chocolatey\bin\predix.exe
142
148
ECHO Predix CLI installed here: %ALLUSERSPROFILE% \chocolatey\bin\
143
149
GOTO :eof
@@ -152,7 +158,7 @@ IF NOT !errorlevel! EQU 0 (
152
158
CALL :GET_DEPENDENCIES
153
159
CALL :CHOCO_INSTALL 7zip.commandline 7z
154
160
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' } "
156
162
< output.tmp ( jq -r " [ .[] | select(.prerelease==false) ] | .[0].assets[] | select(.name | contains(\" win\" )) | .browser_download_url" > output2.tmp )
157
163
< output.tmp ( jq -r " .[0].assets[0].browser_download_url" > output2.tmp )
158
164
< output2.tmp (SET /p cli_url=)
@@ -183,7 +189,7 @@ SET install[putty]=0
183
189
SET install[jdk] = 0
184
190
SET install[maven] = 0
185
191
SET install[sts] = 0
186
- SET install[curl] = 0
192
+ rem SET install[curl]=0
187
193
SET install[nodejs] = 0
188
194
SET install[python2] = 0
189
195
SET install[python3] = 0
@@ -199,7 +205,7 @@ SET install[putty]=1
199
205
SET install[jdk] = 1
200
206
SET install[maven] = 1
201
207
SET install[sts] = 1
202
- SET install[curl] = 1
208
+ rem SET install[curl]=1
203
209
SET install[nodejs] = 1
204
210
SET install[python2] = 1
205
211
SET install[python3] = 1
@@ -221,13 +227,13 @@ SET putty=2
221
227
SET jdk = 3
222
228
SET maven = 4
223
229
SET 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
231
237
232
238
CALL :PROCESS_ARGS %*
233
239
@@ -265,7 +271,7 @@ IF !install[jdk]! EQU 1 CALL :CHOCO_INSTALL jdk8 javac
265
271
IF !install[maven]! EQU 1 CALL :CHOCO_INSTALL maven mvn
266
272
REM TODO - Uncomment once the chocolatey package is fixed
267
273
REM 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
269
275
270
276
IF !install[nodejs]! EQU 1 CALL :CHOCO_INSTALL nodejs.install node
271
277
CALL :RELOAD_ENV
0 commit comments