Skip to content

Commit 998df2e

Browse files
author
Predix Robot
committed
Release 1.0.17
1 parent b2f6bca commit 998df2e

File tree

4 files changed

+56
-18
lines changed

4 files changed

+56
-18
lines changed

downloadFile.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
$netAssembly = [Reflection.Assembly]::GetAssembly([System.Net.Configuration.SettingsSection])
2+
3+
function DownloadFile($url, $pathToFile) {
4+
SetAllowUnsafeHeaderParsing20;
5+
$wc=(new-object System.Net.WebClient);
6+
$wc.Headers.Add('user-agent', 'ASP.NET WebClient');
7+
echo $url
8+
echo $pathToFile
9+
$wc.DownloadFile("$url", "$pathToFile");
10+
}
11+
12+
function SetAllowUnsafeHeaderParsing20
13+
{
14+
if($netAssembly)
15+
{
16+
$bindingFlags = [Reflection.BindingFlags] "Static,GetProperty,NonPublic"
17+
$settingsType = $netAssembly.GetType("System.Net.Configuration.SettingsSectionInternal")
18+
19+
$instance = $settingsType.InvokeMember("Section", $bindingFlags, $null, $null, @())
20+
21+
if($instance)
22+
{
23+
$bindingFlags = "NonPublic","Instance"
24+
$useUnsafeHeaderParsingField = $settingsType.GetField("useUnsafeHeaderParsing", $bindingFlags)
25+
26+
if($useUnsafeHeaderParsingField)
27+
{
28+
$useUnsafeHeaderParsingField.SetValue($instance, $true)
29+
}
30+
}
31+
}
32+
}

setup-mac.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ function install_mobilecli() {
250250
#cli_url=$(curl -g -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases | jq -r '.' )
251251
cli_url=$(curl -g -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases | jq -r '[ .[] | select(.prerelease==false) ] | .[0].assets[] | select(.name | contains("Mac")) | .browser_download_url' )
252252
cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/mobile-cli-install.sh"
253-
#cli_install_url="https://github.build.ge.com/raw/adoption/local-setup/develop/mobile-cli-install.sh"
253+
#cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/develop/mobile-cli-install.sh"
254254
echo "Downloading latest Predix Mobile CLI: $cli_url"
255255
curl -L "$cli_url" -o pm.zip
256256
mkdir -p mobile-cli && tar -xf pm.zip -C mobile-cli

setup-windows.bat

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
SETLOCAL ENABLEDELAYEDEXPANSION
33

44
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
56

67
GOTO START
78

@@ -23,7 +24,8 @@ IF /I "%1"=="/putty" SET install[putty]=1
2324
IF /I "%1"=="/jdk" SET install[jdk]=1
2425
IF /I "%1"=="/maven" SET install[maven]=1
2526
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
2729
IF /I "%1"=="/nodejs" SET install[nodejs]=1
2830
IF /I "%1"=="/python2" SET install[python2]=1
2931
IF /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')"
4347
GOTO :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
126131
GOTO :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\
143149
GOTO :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
183189
SET install[jdk]=0
184190
SET install[maven]=0
185191
SET install[sts]=0
186-
SET install[curl]=0
192+
rem SET install[curl]=0
187193
SET install[nodejs]=0
188194
SET install[python2]=0
189195
SET install[python3]=0
@@ -199,7 +205,7 @@ SET install[putty]=1
199205
SET install[jdk]=1
200206
SET install[maven]=1
201207
SET install[sts]=1
202-
SET install[curl]=1
208+
rem SET install[curl]=1
203209
SET install[nodejs]=1
204210
SET install[python2]=1
205211
SET install[python3]=1
@@ -221,13 +227,13 @@ SET putty=2
221227
SET jdk=3
222228
SET maven=4
223229
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
231237

232238
CALL :PROCESS_ARGS %*
233239

@@ -265,7 +271,7 @@ IF !install[jdk]! EQU 1 CALL :CHOCO_INSTALL jdk8 javac
265271
IF !install[maven]! EQU 1 CALL :CHOCO_INSTALL maven mvn
266272
REM TODO - Uncomment once the chocolatey package is fixed
267273
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
269275

270276
IF !install[nodejs]! EQU 1 CALL :CHOCO_INSTALL nodejs.install node
271277
CALL :RELOAD_ENV

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "local setup",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"private": true,
55
"dependencies": {},
66
"author": "rishabhtulsian"

0 commit comments

Comments
 (0)