Skip to content

Commit b78602f

Browse files
Release 1.0.83
1 parent f22f79f commit b78602f

File tree

4 files changed

+148
-85
lines changed

4 files changed

+148
-85
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ bash <( curl https://raw.githubusercontent.com/PredixDev/local-setup/master/setu
1919
Tool | Flag | Notes
2020
--- | --- | ---
2121
[brew](http://brew.sh), [cask] (http://caskroom.io) | | Required to manage the installation of tools
22-
[Git](https://git-scm.com) | --git |
22+
[Android Studio & Platform Tools](https://developer.android.com/studio/index.html) | --androidstudio |
2323
[Cloud Foundry CLI](http://docs.cloudfoundry.org/cf-cli) | --cf |
24+
[Eclipse STS](https://spring.io/tools/sts) | --sts |
25+
[Git](https://git-scm.com) | --git |
2426
[Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | --jdk |
2527
[JQ)](https://stedolan.github.io/jq/) | installed in all cases |
2628
[Maven](https://maven.apache.org) | --maven |
27-
[Eclipse STS](https://spring.io/tools/sts) | --sts |
2829
[Node.js](https://nodejs.org), [Bower](http://bower.io/), [Grunt CLI](http://gruntjs.com), [Gulp CLI](http://gulpjs.com),[node gyp]https://github.com/nodejs/node-gyp,[windows-build-tools] (npm install --global --production windows-build-tools) | --nodejs |
2930
[Predix CLI](https://github.com/PredixDev/predix-cli) | --predixcli |
3031
[Predix Mobile CLI](https://github.com/PredixDev/predix-mobile-cli) | --mobilecli |
3132
[Python2](https://www.python.org) | --python2 |
3233
[Python3](https://www.python.org) | --python3 |
33-
[Android Studio](https://developer.android.com/studio/index.html) | --androidstudio |
3434
[rbenv](http://rbenv.org), [ruby-build](https://github.com/rbenv/ruby-build), [ruby](https://www.ruby-lang.org), [cf-uaac] (https://github.com/cloudfoundry/cf-uaac) | --uaac | This is not installed by default
3535

3636
### On Windows
@@ -47,19 +47,19 @@ For example: to install git and cf-cli only run
4747
Tool | Flag | Notes
4848
--- | --- | ---
4949
[chocolatey](https://chocolatey.org) | | Required to manage the installation of tools
50-
[Git](https://git-scm.com) | /git |
50+
[Android Studio & ADB](https://developer.android.com/studio/index.html) | /androidstudio |
5151
[Cloud Foundry CLI](http://docs.cloudfoundry.org/cf-cli) | /cf |
52-
[putty](http://www.putty.org) | /putty |
52+
[cURL](https://curl.haxx.se) | /curl |
53+
[Eclipse STS](https://spring.io/tools/sts) | /sts |
54+
[Git](https://git-scm.com) | /git |
5355
[Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | /jdk |
5456
[JQ)](https://stedolan.github.io/jq/) | installed in all cases |
5557
[Maven](https://maven.apache.org) | /maven |
56-
[Eclipse STS](https://spring.io/tools/sts) | /sts |
57-
[cURL](https://curl.haxx.se) | /curl |
5858
[Node.js](https://nodejs.org), [Bower](http://bower.io/), [Grunt CLI](http://gruntjs.com), [Gulp CLI](http://gulpjs.com) | /nodejs |
5959
[Predix CLI](https://github.com/PredixDev/predix-cli) | /predixcli |
6060
[Predix Mobile CLI](https://github.com/PredixDev/predix-mobile-cli) | /mobilecli |
6161
[Python2](https://www.python.org) | /python2 |
6262
[Python3](https://www.python.org) | /python3 |
63-
[Android Studio](https://developer.android.com/studio/index.html) | /androidstudio |
63+
[putty](http://www.putty.org) | /putty |
6464

6565
[![Analytics](https://ga-beacon.appspot.com/UA-82773213-1/local-setup/readme?pixel)](https://github.com/PredixDev)

setup-mac.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ function install_android_studio() {
160160

161161
# Install Android Studio dependencies
162162
brew_cask_install android-studio
163+
brew cask install android-platform-tools
163164
}
164165

165166
function install_nodejs() {

setup-windows.bat

Lines changed: 138 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
@ECHO OFF
22
SETLOCAL ENABLEDELAYEDEXPANSION
33

4+
echo branch=!BRANCH!
5+
REM SET RESETVARS=https://raw.githubusercontent.com/PredixDev/local-setup/!BRANCH!/resetvars.vbs
46
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
67

78
GOTO START
89

@@ -41,10 +42,7 @@ GOTO :eof
4142

4243
:GET_DEPENDENCIES
4344
ECHO Getting Dependencies
44-
ECHO !RESETVARS!
45-
@powershell -Command "(new-object net.webclient).DownloadFile('!RESETVARS!','%TEMP%\resetvars.vbs')"
46-
ECHO !DOWNLOADFILE!
47-
@powershell -Command "(new-object net.webclient).DownloadFile('!DOWNLOADFILE!','downloadFile.ps1')"
45+
CALL :DOWNLOAD_TO_FILE !RESETVARS! , %TEMP%\resetvars.vbs
4846
GOTO :eof
4947

5048
:RELOAD_ENV
@@ -55,7 +53,7 @@ GOTO :eof
5553

5654
:CHECK_INTERNET_CONNECTION
5755
ECHO Checking internet connection...
58-
@powershell -Command "(new-object net.webclient).DownloadString('http://www.github.com')" >$null 2>&1
56+
@powershell -Command "iwr http://bing.com" >$null 2>&1
5957
IF NOT !errorlevel! EQU 0 (
6058
ECHO Unable to connect to internet, make sure you are connected to a network and check your proxy settings if behind a corporate proxy. For detailed info about setting up your proxy please see this tutorial https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1565
6159
exit /b !errorlevel!
@@ -90,30 +88,99 @@ IF NOT !errorlevel! EQU 0 (
9088
)
9189
ENDLOCAL & GOTO :eof
9290

91+
:DOWNLOAD_TO_FILE
92+
ECHO download to file
93+
ECHO %~1 %~2
94+
REM arg1 is URL, arg2 is filename to redirect output to
95+
@powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $response = iwr -uri %~1; write-output $response.Content | Out-File %~2 ASCII -Width 9999"
96+
CALL :CHECK_FAIL
97+
REM echo return from check_fail
98+
GOTO :eof
99+
100+
:DOWNLOAD_BINARY_TO_FILE
101+
ECHO download binary to file
102+
ECHO %~1 %~2
103+
REM arg1 is URL, arg2 is filename to redirect output to
104+
@powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object net.webclient).DownloadFile('%~1','%~2')
105+
CALL :CHECK_FAIL
106+
GOTO :eof
107+
108+
:CHECK_FAIL
109+
IF NOT !errorlevel! EQU 0 (
110+
ECHO FAILED
111+
ECHO Any changes to the PATH will not take affect unless you reopen a new Admin command window, please open a new window now.
112+
exit /b !errorlevel!
113+
)
114+
GOTO :EOF
115+
116+
:INSTALL_NOTHING
117+
SET install[git]=0
118+
SET install[cf]=0
119+
SET install[putty]=0
120+
SET install[jdk]=0
121+
SET install[maven]=0
122+
SET install[sts]=0
123+
rem SET install[curl]=0
124+
SET install[nodejs]=0
125+
SET install[python2]=0
126+
SET install[python3]=0
127+
SET install[jq]=0
128+
SET install[predixcli]=0
129+
SET install[mobilecli]=0
130+
SET install[androidstudio]=0
131+
GOTO :eof
132+
133+
:INSTALL_EVERYTHING
134+
SET install[git]=1
135+
SET install[cf]=1
136+
SET install[putty]=1
137+
SET install[jdk]=1
138+
SET install[maven]=1
139+
SET install[sts]=1
140+
rem SET install[curl]=1
141+
SET install[nodejs]=1
142+
SET install[python2]=1
143+
SET install[python3]=1
144+
SET install[jq]=1
145+
SET install[predixcli]=1
146+
SET install[mobilecli]=1
147+
SET install[androidstudio]=0
148+
GOTO :eof
149+
150+
93151
:INSTALL_PREDIXCLI
152+
ECHO.
94153
ECHO Installing predixcli...
95154
where predix >$null 2>&1
96155
IF NOT !errorlevel! EQU 0 (
97156
ECHO Downloading installer
98-
CALL :GET_DEPENDENCIES
99157
CALL :CHOCO_INSTALL 7zip.commandline 7z
100158
REM get the url of the release file
101-
@powershell -Command "& { . .\downloadFile.ps1; DownloadFile 'https://api.github.com/repos/PredixDev/predix-cli/releases' 'output.tmp' }"
102-
<output.tmp ( jq -r ".[0].assets[0].browser_download_url" >output2.tmp )
103-
SET /p cli_url=<output2.tmp
104-
@powershell -Command "(new-object net.webclient).DownloadFile('!cli_url!','predix-cli.tar.gz')"
159+
CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-cli/releases , predix-cli-output.tmp
160+
<predix-cli-output.tmp ( jq -r ".[0].assets[0].browser_download_url" >predix-cli-output2.tmp )
161+
SET /p cli_url=<predix-cli-output2.tmp
162+
CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-cli/releases , predix-cli-output.tmp
163+
164+
CALL :DOWNLOAD_BINARY_TO_FILE !cli_url! , predix-cli.tar.gz
105165
7z x "predix-cli.tar.gz" -so | 7z x -aoa -si -ttar -o"predix-cli"
106166
REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
107-
copy predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE%\chocolatey\bin\
167+
copy /Y predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE%\chocolatey\bin\
108168
echo "mklink if not already there"
109169
mklink %ALLUSERSPROFILE%\chocolatey\bin\px.exe %ALLUSERSPROFILE%\chocolatey\bin\predix.exe
170+
echo mkdir C:\Progra~1\Git\etc\bash_completion.d\predix
171+
mkdir C:\Progra~1\Git\etc\bash_completion.d\predix
172+
echo copy /Y predix-cli\autocomplete\bash_autocomplete C:\Progra~1\Git\etc\bash_completion.d\predix\bash_autocomplete.sh
173+
copy /Y predix-cli\autocomplete\bash_autocomplete C:\Progra~1\Git\etc\bash_completion.d\predix\bash_autocomplete.sh
174+
echo add to %HOMEPATH%\.bashrc
175+
echo . /etc/bash_completion.d/predix/bash_autocomplete.sh >> %HOMEPATH%\.bashrc
110176
ECHO Predix CLI installed here: %ALLUSERSPROFILE%\chocolatey\bin\
111177
) ELSE (
178+
ECHO check for upgrade
112179
predix -v >pxcliv.tmp
113180
SET /p predixcli_current_version=<pxcliv.tmp
114-
@powershell -Command "& { . .\downloadFile.ps1; DownloadFile 'https://api.github.com/repos/PredixDev/predix-cli/releases' 'releaseresponse.tmp' }"
115-
<releaseresponse.tmp (jq -r ".[0].tag_name" >releaseresponsename.tmp)
116-
<releaseresponsename.tmp (SET /p cli_latest_tag=)
181+
CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-cli/releases , predix-cli-release-response.tmp
182+
<predix-cli-release-response.tmp (jq -r ".[0].tag_name" >predix-cli-release-response-name.tmp)
183+
<predix-cli-release-response-name.tmp (SET /p cli_latest_tag=)
117184
SET cli_latest_tag=!cli_latest_tag:~1!
118185
echo.!predixcli_current_version!|findstr /C:!cli_latest_tag! >nul 2>&1
119186
if not errorlevel 1 (
@@ -134,44 +201,48 @@ GOTO :eof
134201
:UPGRADE_PREDIXCLI
135202
ECHO Upgrading predixcli...
136203
ECHO Downloading installer
137-
CALL :GET_DEPENDENCIES
138204
CALL :CHOCO_INSTALL 7zip.commandline 7z
139205
REM get the url of the release file
140-
@powershell -Command "& { . .\downloadFile.ps1; DownloadFile 'https://api.github.com/repos/PredixDev/predix-cli/releases' 'output.tmp' }"
141-
<output.tmp ( jq -r ".[0].assets[0].browser_download_url" >output2.tmp )
142-
SET /p cli_url=<output2.tmp
143-
@powershell -Command "(new-object net.webclient).DownloadFile('!cli_url!','predix-cli.tar.gz')"
206+
CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-cli/releases , predix-cli-output.tmp
207+
<predix-cli-output.tmp ( jq -r ".[0].assets[0].browser_download_url" >predix-cli-output2.tmp )
208+
SET /p cli_url=<predix-cli-output2.tmp
209+
CALL :DOWNLOAD_BINARY_TO_FILE !cli_url! , predix-cli.tar.gz
144210
7z x "predix-cli.tar.gz" -so | 7z x -aoa -si -ttar -o"predix-cli"
145211
REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
146-
copy predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE%\chocolatey\bin\
212+
copy /Y predix-cli\bin\win64\predix.exe %ALLUSERSPROFILE%\chocolatey\bin\
147213
echo "mklink if not already there"
148214
mklink %ALLUSERSPROFILE%\chocolatey\bin\px.exe %ALLUSERSPROFILE%\chocolatey\bin\predix.exe
215+
mkdir C:\Progra~1\Git\etc\bash_completion.d\predix
216+
copy /Y predix-cli\autocomplete\bash_autocomplete C:\Progra~1\Git\etc\bash_completion.d\predix\bash_autocomplete.sh
217+
echo . /etc/bash_completion.d/predix/bash_autocomplete.sh >> %HOMEPATH%\.bashrc
149218
ECHO Predix CLI installed here: %ALLUSERSPROFILE%\chocolatey\bin\
150219
GOTO :eof
151220

152221
:INSTALL_ANDROID_STUDIO
222+
ECHO.
153223
ECHO Installing Android Studio...
154-
CALL :CHOCO_INSTALL maven mvn
224+
CALL :CHOCO_INSTALL maven
155225
CALL :CHOCO_INSTALL ant
156226
CALL :CHOCO_INSTALL gradle
157227

158-
CALL :CHOCO_INSTALL androidstudio
159-
CALL :CHECK_FAIL
228+
CALL :CHOCO_INSTALL androidstudio -y
229+
CALL :CHOCO_INSTALL adb
230+
ECHO Installing Android Studio complete...
160231
GOTO :eof
161232

162233
:INSTALL_MOBILECLI
234+
ECHO.
163235
ECHO Installing mobilecli...
164236
where pm >$null 2>&1
165237
IF NOT !errorlevel! EQU 0 (
166238
ECHO Downloading installer
167-
CALL :GET_DEPENDENCIES
168239
CALL :CHOCO_INSTALL 7zip.commandline 7z
169240
REM get the url of the release file
170-
@powershell -Command "& { . .\downloadFile.ps1; DownloadFile 'https://api.github.com/repos/PredixDev/predix-mobile-cli/releases' 'output.tmp' }"
171-
<output.tmp ( jq -r "[ .[] | select(.prerelease==false) ] | .[0].assets[] | select(.name | contains(\"win\")) | .browser_download_url" >output2.tmp )
172-
<output.tmp ( jq -r ".[0].assets[0].browser_download_url" >output2.tmp )
173-
<output2.tmp (SET /p cli_url=)
174-
@powershell -Command "(new-object net.webclient).DownloadFile('!cli_url!','pm.zip')"
241+
CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-mobile-cli/releases , mobile-output.tmp
242+
<mobile-output.tmp ( jq -r "[ .[] | select(.prerelease==false) ] | .[0].assets[] | select(.name | contains(\"win\")) | .browser_download_url" >mobile-output2.tmp )
243+
<mobile-output2.tmp (SET /p cli_url=)
244+
CALL :DOWNLOAD_BINARY_TO_FILE !cli_url! , pm.zip
245+
del /Q /S mobile-cli
175246
7z x "pm.zip" -o"mobile-cli"
176247
REM Just put in the chocolatey/bin directory, since we know that's on the PATH env var.
177248
copy mobile-cli\pm.exe %ALLUSERSPROFILE%\chocolatey\bin\
@@ -184,47 +255,6 @@ IF NOT !errorlevel! EQU 0 (
184255
rem pm -v
185256
GOTO :eof
186257

187-
:CHECK_FAIL
188-
IF NOT !errorlevel! EQU 0 (
189-
ECHO FAILED
190-
ECHO Any changes to the PATH will not take affect unless you reopen a new Admin command window, please open a new window now.
191-
exit /b !errorlevel!
192-
)
193-
GOTO :eof
194-
195-
:INSTALL_NOTHING
196-
SET install[git]=0
197-
SET install[cf]=0
198-
SET install[putty]=0
199-
SET install[jdk]=0
200-
SET install[maven]=0
201-
SET install[sts]=0
202-
rem SET install[curl]=0
203-
SET install[nodejs]=0
204-
SET install[python2]=0
205-
SET install[python3]=0
206-
SET install[jq]=0
207-
SET install[predixcli]=0
208-
SET install[mobilecli]=0
209-
SET install[androidstudio]=0
210-
GOTO :eof
211-
212-
:INSTALL_EVERYTHING
213-
SET install[git]=1
214-
SET install[cf]=1
215-
SET install[putty]=1
216-
SET install[jdk]=1
217-
SET install[maven]=1
218-
SET install[sts]=1
219-
rem SET install[curl]=1
220-
SET install[nodejs]=1
221-
SET install[python2]=1
222-
SET install[python3]=1
223-
SET install[jq]=1
224-
SET install[predixcli]=1
225-
SET install[mobilecli]=1
226-
SET install[androidstudio]=0
227-
GOTO :eof
228258

229259
:START
230260
PUSHD "%~dp0"
@@ -287,28 +317,60 @@ REM TODO - Uncomment once the chocolatey package is fixed
287317
REM IF !install[sts]! EQU 1 CALL :CHOCO_INSTALL springtoolsuite
288318
rem IF !install[curl]! EQU 1 CALL :CHOCO_INSTALL curl
289319

290-
IF !install[nodejs]! EQU 1 CALL :CHOCO_INSTALL nodejs.install node
320+
IF !install[nodejs]! EQU 1 (
321+
ECHO.
322+
ECHO Install Node.js
323+
CALL :CHOCO_INSTALL nodejs.install node
324+
)
291325
CALL :RELOAD_ENV
292326
SET "PATH=%PATH%;%APPDATA%\npm"
293327
IF !install[nodejs]! EQU 1 (
328+
ECHO "ensure npm global location (typically C:\Users\YourUserName\AppData\Roaming\npm) is in the path. If not, please add manually in System and reopen this Admin Command window."
329+
path
330+
ECHO.
331+
ECHO 'If you get a certificate error, it could mean your company network and/or proxy server is using self signed certificates. You can temporily use npm config set strict-ssl false to allow the download or also try npm config set cafile="C:\mycacert.pem"'
332+
ECHO.
294333
where bower >$null 2>&1
295334
IF NOT !errorlevel! EQU 0 (
335+
ECHO npm install -g bower
296336
npm install -g bower
337+
CALL :CHECK_FAIL
297338
)
298339
where grunt >$null 2>&1
299340
IF NOT !errorlevel! EQU 0 (
341+
ECHO npm install -g grunt
300342
npm install -g grunt-cli
343+
CALL :CHECK_FAIL
301344
)
302345
where gulp >$null 2>&1
303346
IF NOT !errorlevel! EQU 0 (
347+
ECHO npm install -g gulp
348+
path
304349
npm install -g gulp-cli
350+
CALL :CHECK_FAIL
351+
)
352+
where node-gyp >$null 2>&1
353+
IF NOT !errorlevel! EQU 0 (
354+
ECHO npm install -g node-gyp
355+
path
356+
npm install -g node-gyp
357+
CALL :CHECK_FAIL
358+
ECHO npm install -g --production windows-build-tools
359+
npm install --g --production windows-build-tools
360+
CALL :CHECK_FAIL
305361
)
306-
npm install -g node-gyp
307-
npm install --global --production windows-build-tools
308362
)
309363

310-
IF !install[python2]! EQU 1 CALL :CHOCO_INSTALL python2 python
311-
IF !install[python3]! EQU 1 CALL :CHOCO_INSTALL python3 python3
364+
IF !install[python2]! EQU 1 (
365+
ECHO.
366+
ECHO install python2
367+
CALL :CHOCO_INSTALL python2 python
368+
)
369+
IF !install[python3]! EQU 1 (
370+
ECHO.
371+
ECHO install python3
372+
CALL :CHOCO_INSTALL python3 python3
373+
)
312374

313375
IF !install[predixcli]! EQU 1 (
314376
CALL :INSTALL_PREDIXCLI

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.80",
3+
"version": "1.0.83",
44
"private": true,
55
"dependencies": {},
66
"author": "rishabhtulsian"

0 commit comments

Comments
 (0)