├── .gitattributes ├── version.json ├── COPYRIGHT.md ├── mobile-cli-install ├── resetvars.vbs ├── downloadFile.ps1 ├── mobile-cli-root-install ├── Jenkinsfile-windows ├── README.md ├── setup-devbox.sh ├── LICENSE.md ├── setup-ubuntu.sh ├── setup-mac.sh └── setup-windows.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=lf 2 | *.bat text eol=crlf 3 | -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "local setup", 3 | "version": "1.0.107", 4 | "private": true, 5 | "dependencies": {}, 6 | "author": "rishabhtulsian" 7 | } 8 | -------------------------------------------------------------------------------- /COPYRIGHT.md: -------------------------------------------------------------------------------- 1 | The dependencies in this project are resolved by Maven pom.xml. Copyrights from those projects are included [here](http://predixdev.github.io/rmd-ref-app-copyright/). This list may be a superset of projects actually referenced by this project. 2 | -------------------------------------------------------------------------------- /mobile-cli-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if cf_path=$(type -p cf); then 4 | echo "ensure that ~/.cf folder (if not exists yet) gets created with current user privs (not root)" 5 | `cf --version` 6 | fi 7 | 8 | echo "Please enter your system password, so the Mobile CLI can be installed using sudo." 9 | sudo ./mobile-cli-root-install `cf --version` 10 | -------------------------------------------------------------------------------- /resetvars.vbs: -------------------------------------------------------------------------------- 1 | Set oShell = WScript.CreateObject("WScript.Shell") 2 | filename = oShell.ExpandEnvironmentStrings("%TEMP%\resetvars.bat") 3 | Set objFileSystem = CreateObject("Scripting.fileSystemObject") 4 | Set oFile = objFileSystem.CreateTextFile(filename, TRUE) 5 | 6 | set oEnv=oShell.Environment("System") 7 | for each sitem in oEnv 8 | oFile.WriteLine("SET " & sitem) 9 | next 10 | path = oEnv("PATH") 11 | 12 | set oEnv=oShell.Environment("User") 13 | for each sitem in oEnv 14 | oFile.WriteLine("SET " & sitem) 15 | next 16 | 17 | path = path & ";" & oEnv("PATH") 18 | oFile.WriteLine("SET PATH=" & path) 19 | oFile.Close 20 | -------------------------------------------------------------------------------- /downloadFile.ps1: -------------------------------------------------------------------------------- 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 | } 33 | -------------------------------------------------------------------------------- /mobile-cli-root-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | checkRoot() { 6 | if (( `whoami` != "root" )); then 7 | echo "This script needs root privileges to run." 8 | echo "Use 'sudo $0'" 9 | exit 1 10 | fi 11 | } 12 | 13 | requireCfCli() { 14 | echo "Mobile CLI requires Cloud Foundry CLI version 6.17 or later." 15 | echo "Install the latest Cloud Foundry CLI from https://github.com/cloudfoundry/cli/releases" 16 | exit 1 17 | } 18 | 19 | checkRoot 20 | readonly DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 21 | 22 | if ! cf_path=$(type -p cf); then 23 | requireCfCli 24 | else 25 | version=$3 26 | majorversion=`echo "$version" | sed 's/^[^0-9]*\([0-9][0-9]*\)\..*$/\1/'` 27 | minorversion=`echo "$version" | sed 's/^[^0-9]*[0-9][0-9]*\.\([0-9][0-9]*\).*$/\1/'` 28 | if ! [[ $majorversion =~ ^[0-9]+$ ]] || ! [[ $minorversion =~ ^[0-9]+$ ]]; then 29 | requireCfCli 30 | fi 31 | if [[ $majorversion < 6 ]] || [[ $majorversion == 6 && $minorversion < 17 ]]; then 32 | requireCfCli 33 | fi 34 | fi 35 | 36 | echo "Installing Predix Mobile CLI ..." 37 | 38 | if [ ! -d "/usr/local/PredixMobile" ]; then 39 | mkdir /usr/local/PredixMobile 40 | fi 41 | if [ ! -d "/usr/local/PredixMobile/bin" ]; then 42 | mkdir /usr/local/PredixMobile/bin 43 | fi 44 | 45 | if [ "$(uname)" == "Darwin" ]; then 46 | PLATFORM=osx 47 | elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then 48 | PLATFORM=linux64 49 | fi 50 | cp -f "$DIR/pm" /usr/local/PredixMobile/bin/ 51 | 52 | ln -sf /usr/local/PredixMobile/bin/pm /usr/local/bin/pm 53 | 54 | chown -R root:0 /usr/local/PredixMobile 55 | chmod -R 755 /usr/local/PredixMobile 56 | 57 | echo "The Predix Mobile CLI has been installed successfully." 58 | echo "Run 'pm help'." 59 | echo "Open a new terminal to get PATH changes." 60 | -------------------------------------------------------------------------------- /Jenkinsfile-windows: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | @Library('devrel') _ 3 | def complianceEnabled = true; 4 | def pullRequest = env.CHANGE_ID 5 | def pullTarget = env.CHANGE_TARGET 6 | def org = "adoption" 7 | def repoName = "local-setup" 8 | def branchName = env.BRANCH_NAME 9 | def pop = "uswest" 10 | def jobName = "util-local-setup" 11 | def buildDependencyJobs = "" 12 | def dependencyRepos = "" 13 | def dependencyJobs = "" 14 | def quickstartScript = "" 15 | def uiAppName = "" 16 | def uiTestJobName = "" 17 | 18 | pipeline { 19 | agent none 20 | options { 21 | buildDiscarder(logRotator(artifactDaysToKeepStr: '1', artifactNumToKeepStr: '1', daysToKeepStr: '5', numToKeepStr: '10')) 22 | } 23 | environment { 24 | COMPLIANCEENABLED = true 25 | CF_AWS_CREDS = credentials('cf_aws_creds') 26 | DEVCLOUD_ARTIFACTORY_CREDS = credentials('devcloud_artifactory_creds') 27 | EXT_GITHUB_CREDS = credentials('external_git_creds') 28 | EXT_ARTIFACTORY_USER_CREDS = credentials('external_artifactory_user_creds') 29 | } 30 | parameters { 31 | string(name: 'BUILD', defaultValue: 'true', description: 'checkout, build, test and/or deploy') 32 | string(name: 'INCREMENT', defaultValue: 'none', description: 'increment version - patch | major | minor') 33 | string(name: 'INCREMENT_DEPENDENCIES', defaultValue: 'false', description: 'point at latest dependencies in develop') 34 | string(name: 'MERGE_MASTER', defaultValue: 'false', description: 'merge to master') 35 | string(name: 'RELEASE', defaultValue: 'false', description: 'release master to production') 36 | string(name: 'SMOKE_TEST', defaultValue: 'false', description: 'run smoketests in production') 37 | } 38 | stages { 39 | stage("Build, Test, and/or Deploy" ) { 40 | when { 41 | allOf { environment name: 'BUILD', value: 'true'; environment name: 'MERGE_MASTER', value: 'false'; environment name: 'INCREMENT', value: 'none'; environment name: 'INCREMENT_DEPENDENCIES', value: 'false'; environment name: 'RELEASE', value: 'false'; environment name: 'SMOKE_TEST', value: 'false'; } 42 | } 43 | agent { 44 | label 'windows2016-raw' 45 | } 46 | steps { 47 | echo "The workspace is ${env.WORKSPACE}" 48 | script { 49 | echo 'Stage Build, Test, Deploy' 50 | bat "dir" 51 | // bat "del /s /q *" 52 | // bat "dir" 53 | def status = powershell(returnStatus: true, script: "cd") 54 | // status = powershell(returnStatus: true, script: "(new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/PredixDev/local-setup/master/setup-windows.bat','setup-windows.bat')") 55 | if (status == 0) { 56 | echo "powershell1 success" 57 | bat "echo %cd%" 58 | bat "dir" 59 | status = powershell(returnStatus: true, script: "${workspace}\\setup-windows.bat") 60 | if (status == 0) { 61 | echo "powershell2 success" 62 | } 63 | else { 64 | echo "powershell2 failed status=${status}" 65 | error("powershell2 failed") 66 | } 67 | } 68 | else { 69 | echo "powershell1 failed" 70 | error("powershell1 failed") 71 | } 72 | } 73 | } 74 | post { 75 | success { 76 | echo "Build, Test, Deploy stage completed successfully" 77 | } 78 | failure { 79 | script { 80 | echo "Build, Test, Deploy stage failed" 81 | } 82 | } 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Local setup of development tools 2 | 3 | Scripts to install the tools required for development on the Predix Platform. 4 | 5 | ## Installation 6 | 7 | ### On Mac OS X 8 | 9 | * Run the command below in a terminal window to install all the standard tools 10 | ``` 11 | bash <( curl https://raw.githubusercontent.com/PredixDev/local-setup/master/setup-mac.sh ) 12 | ``` 13 | * You can choose to install selected tools by providing flags for the corresponding tools. 14 | For example: to install git, cf-cli, and predix-cli only run 15 | ``` 16 | bash <( curl https://raw.githubusercontent.com/PredixDev/local-setup/master/setup-mac.sh ) --git --cf --predixcli 17 | ``` 18 | 19 | Tool | Flag | Notes 20 | --- | --- | --- 21 | [brew](http://brew.sh), [cask] (http://caskroom.io) | | Required to manage the installation of tools 22 | [Android Studio & Platform Tools](https://developer.android.com/studio/index.html) | --androidstudio | 23 | [Cloud Foundry CLI](http://docs.cloudfoundry.org/cf-cli) | --cf | 24 | [Docker](https://docs.docker.com/docker-for-mac/install/) | --docker | 25 | [Eclipse STS](https://spring.io/tools/sts) | --sts | 26 | [Git](https://git-scm.com) | --git | 27 | [Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | --jdk | 28 | [JQ)](https://stedolan.github.io/jq/) | installed in all cases | 29 | [Maven](https://maven.apache.org) | --maven | 30 | [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 | 31 | [Predix CLI](https://github.com/PredixDev/predix-cli) | --predixcli | 32 | [Predix Mobile CLI](https://github.com/PredixDev/predix-mobile-cli) | --mobilecli | 33 | [Python2](https://www.python.org) | --python2 | 34 | [Python3](https://www.python.org) | --python3 | 35 | [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 36 | [VMWare](https://www.vmware.com/products/fusion/fusion-evaluation.html) | --vmware | 37 | 38 | ### On Windows 39 | * Open a Command Window as Administrator (Right click 'Run as Administrator') and run the command below 40 | ``` 41 | @powershell -Command "(new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/PredixDev/local-setup/master/setup-windows.bat','%TEMP%/setup-windows.bat')" && %TEMP%/setup-windows.bat 42 | ``` 43 | * You can choose to install selected tools by providing flags for the corresponding tools. 44 | For example: to install git, cf-cli and predix-cli only run 45 | ``` 46 | @powershell -Command "(new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/PredixDev/local-setup/master/setup-windows.bat','%TEMP%/setup-windows.bat')" && %TEMP%/setup-windows.bat /git /cf /predixcli 47 | ``` 48 | 49 | Tool | Flag | Notes 50 | --- | --- | --- 51 | [chocolatey](https://chocolatey.org) | | Required to manage the installation of tools 52 | [Android Studio & ADB](https://developer.android.com/studio/index.html) | /androidstudio | 53 | [Cloud Foundry CLI](http://docs.cloudfoundry.org/cf-cli) | /cf | 54 | [cURL](https://curl.haxx.se) | /curl | 55 | [Docker](https://docs.docker.com/docker-for-windows/install/) | /docker | 56 | [Eclipse STS](https://spring.io/tools/sts) | /sts | 57 | [Git](https://git-scm.com) | /git | 58 | [Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) | /jdk | 59 | [JQ)](https://stedolan.github.io/jq/) | installed in all cases | 60 | [Maven](https://maven.apache.org) | /maven | 61 | [Node.js](https://nodejs.org), [Bower](http://bower.io/), [Grunt CLI](http://gruntjs.com), [Gulp CLI](http://gulpjs.com) | /nodejs | 62 | [Predix CLI](https://github.com/PredixDev/predix-cli) | /predixcli | 63 | [Predix Mobile CLI](https://github.com/PredixDev/predix-mobile-cli) | /mobilecli | 64 | [Python2](https://www.python.org) | /python2 | 65 | [Python3](https://www.python.org) | /python3 | 66 | [putty](http://www.putty.org) | /putty | 67 | [VMWare](https://www.vmware.com/products/workstation-pro/workstation-pro-evaluation.html) | /vmware | 68 | 69 | [![Analytics](https://predix-beacon.appspot.com/UA-82773213-1/local-setup/readme?pixel)](https://github.com/PredixDev) 70 | -------------------------------------------------------------------------------- /setup-devbox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | git=0 5 | cf=1 6 | jdk=2 7 | maven=3 8 | nodejs=4 9 | python2=5 10 | python3=6 11 | uaac=7 12 | jq=8 13 | predixcli=9 14 | mobilecli=10 15 | androidstudio=11 16 | docker=12 17 | vmware=13 18 | 19 | declare -a install 20 | 21 | function prefix_to_path() { 22 | if [[ ":$PATH:" != *":$1:"* ]]; then 23 | echo 'export PATH="$1${PATH:+":$PATH"}"' >> ~/.bash_profile 24 | source ~/.bash_profile 25 | fi 26 | } 27 | 28 | function check_internet() { 29 | set +e 30 | echo "" 31 | echo "Checking internet connection..." 32 | curl "http://github.com" > /dev/null 2>&1 33 | if [ $? -ne 0 ]; then 34 | echo "Unable to connect to internet, make sure you are connected to a network and check your proxy settings if behind a corporate proxy. Please read this tutorial for detailed info about setting your proxy https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1565" 35 | echo "" 36 | exit 1 37 | fi 38 | echo "OK" 39 | echo "" 40 | set -e 41 | } 42 | 43 | function check_bash_profile() { 44 | # Ensure bash profile exists 45 | if [ ! -e ~/.bash_profile ]; then 46 | printf "#!/bin/bash\n" >> ~/.bash_profile 47 | fi 48 | } 49 | 50 | function get_proxy_scripts() { 51 | VERIFY_PROXY_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/verify-proxy.sh 52 | TOGGLE_PROXY_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/toggle-proxy.sh 53 | ENABLE_XSL_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/enable-proxy.xsl 54 | DISABLE_XSL_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/disable-proxy.xsl 55 | 56 | if [ -f "verify-proxy.sh" ]; then 57 | rm verify-proxy.sh 58 | fi 59 | if [ -f "toggle-proxy.sh" ]; then 60 | rm toggle-proxy.sh 61 | fi 62 | if [ -f "enable-proxy.xsl" ]; then 63 | rm enable-proxy.xsl 64 | fi 65 | if [ -f "disable-proxy.xsl" ]; then 66 | rm disable-proxy.xsl 67 | fi 68 | 69 | if [ ! -f "verify-proxy.sh" ]; then 70 | curl -s -O $VERIFY_PROXY_URL 71 | fi 72 | if [ ! -f "toggle-proxy.sh" ]; then 73 | curl -s -O $TOGGLE_PROXY_URL 74 | fi 75 | if [ ! -f "enable-proxy.xsl" ]; then 76 | curl -s -O $ENABLE_XSL_URL 77 | fi 78 | if [ ! -f "disable-proxy.xsl" ]; then 79 | curl -s -O $DISABLE_XSL_URL 80 | fi 81 | } 82 | 83 | 84 | function install_everything() { 85 | install[git]=1 86 | install[cf]=1 87 | install[jdk]=1 88 | install[maven]=1 89 | install[nodejs]=1 90 | install[python2]=1 91 | install[python3]=1 92 | install[uaac]=0 # Install UAAC only if the --uaac flag is provided 93 | install[jq]=1 94 | install[yq]=1 95 | install[predixcli]=1 96 | install[mobilecli]=1 97 | install[androidstudio]=0 # Install Android Studio only if --androidstudio flag is provided 98 | install[docker]=1 99 | install[vmware]=0 # Install Android Studio only if --vmware flag is provided 100 | } 101 | 102 | function install_nothing() { 103 | install[git]=0 104 | install[cf]=0 105 | install[jdk]=0 106 | install[maven]=0 107 | install[nodejs]=0 108 | install[python2]=0 109 | install[python3]=0 110 | install[uaac]=0 111 | install[jq]=0 112 | install[yq]=0 113 | install[predixcli]=0 114 | install[mobilecli]=0 115 | install[androidstudio]=0 116 | install[docker]=0 117 | install[vmware]=0 118 | } 119 | 120 | function install_yq() { 121 | sudo pip install yq 122 | yq --version 123 | } 124 | 125 | 126 | function install_predixcli() { 127 | export DYLD_INSERT_LIBRARIES=; 128 | if which predix > /dev/null; then 129 | echo "Predix CLI already installed." 130 | predix -v 131 | PREDIX_VERSION=$(predix -v | awk -F" " '{print $3}') 132 | update_predixcli $PREDIX_VERSION 133 | else 134 | cli_url=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].assets[0].browser_download_url") 135 | echo "Downloading latest Predix CLI: $cli_url" 136 | curl -L -O "$cli_url" 137 | mkdir -p predix-cli && tar -xf predix-cli.tar.gz -C predix-cli 138 | if [ -e predix-cli ]; then 139 | #tar -C is supposed to change directory but it doesn't sometimes 140 | cd predix-cli 141 | fi 142 | ./install 143 | fi 144 | } 145 | 146 | 147 | function update_predixcli() { 148 | #echo "Predix CLI updgrade"$1 149 | existing_version=$1 150 | cli_version_name=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].tag_name") 151 | cli_version_name=${cli_version_name:1} 152 | echo "Predix CLI already installed version."$existing_version 153 | echo "Predix CLI new installed version."$cli_version_name 154 | echo "checking for upgrade" 155 | if [[ "$existing_version" != *"$cli_version_name"* ]]; then 156 | echo "Upgrading Predix CLI to version" $cli_version_name 157 | cli_url=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].assets[0].browser_download_url") 158 | echo "Downloading latest Predix CLI: $cli_url" 159 | curl -L -O "$cli_url" 160 | mkdir -p predix-cli && tar -xf predix-cli.tar.gz -C predix-cli 161 | if [ -e predix-cli ]; then 162 | #tar -C is supposed to change directory but it doesn't sometimes 163 | cd predix-cli 164 | fi 165 | ./install 166 | fi 167 | 168 | } 169 | 170 | function install_mobilecli() { 171 | if which pm > /dev/null; then 172 | echo "Predix Mobile CLI already installed." 173 | pm 174 | else 175 | #cli_url=$(curl -g -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases | jq -r '.' ) 176 | 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' ) 177 | cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/master/mobile-cli-install" 178 | cli_install_root_url="https://raw.githubusercontent.com/PredixDev/local-setup/master/mobile-cli-root-install" 179 | #cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/develop/mobile-cli-install.sh" 180 | echo "Downloading latest Predix Mobile CLI: $cli_url" 181 | curl -L "$cli_url" -o pm.zip 182 | mkdir -p mobile-cli && tar -xf pm.zip -C mobile-cli 183 | cd mobile-cli 184 | echo $cli_install_url 185 | curl -L -O "$cli_install_url" 186 | echo $cli_install_root_url 187 | curl -L -O "$cli_install_root_url" 188 | chmod +x mobile-cli-install 189 | chmod +x mobile-cli-root-install 190 | ./mobile-cli-install 191 | fi 192 | } 193 | 194 | function run_setup() { 195 | echo "--------------------------------------------------------------" 196 | echo "This script will install tools required for Predix development" 197 | echo "You may be asked to provide your password during the installation process" 198 | echo "--------------------------------------------------------------" 199 | echo "" 200 | if [ -z "$1" ]; then 201 | echo "Installing all the tools..." 202 | install_everything 203 | else 204 | echo "Installing only tools specified in parameters..." 205 | install_nothing 206 | while [ ! -z "$1" ]; do 207 | [ "$1" == "--git" ] && install[git]=1 208 | [ "$1" == "--cf" ] && install[cf]=1 209 | [ "$1" == "--jdk" ] && install[jdk]=1 210 | [ "$1" == "--maven" ] && install[maven]=1 211 | [ "$1" == "--nodejs" ] && install[nodejs]=1 212 | [ "$1" == "--python2" ] && install[python2]=1 213 | [ "$1" == "--python3" ] && install[python3]=1 214 | [ "$1" == "--uaac" ] && install[uaac]=1 215 | [ "$1" == "--jq" ] && install[jq]=1 216 | [ "$1" == "--yq" ] && install[yq]=1 217 | [ "$1" == "--predixcli" ] && install[predixcli]=1 218 | [ "$1" == "--mobilecli" ] && install[mobilecli]=1 219 | [ "$1" == "--androidstudio" ] && install[androidstudio]=1 220 | [ "$1" == "--docker" ] && install[docker]=1 221 | [ "$1" == "--vmware" ] && install[vmware]=1 222 | shift 223 | done 224 | install[jq]=1 225 | fi 226 | 227 | check_internet 228 | check_bash_profile 229 | 230 | if [ ${install[jq]} -eq 1 ]; then 231 | echo "jq already installed" 232 | fi 233 | 234 | if [ ${install[yq]} -eq 1 ]; then 235 | install_yq 236 | fi 237 | 238 | if [ ${install[git]} -eq 1 ]; then 239 | echo "git already installed" 240 | fi 241 | 242 | if [ ${install[cf]} -eq 1 ]; then 243 | echo "cf already installed" 244 | fi 245 | 246 | if [ ${install[jdk]} -eq 1 ]; then 247 | echo "jdk already installed" 248 | fi 249 | 250 | if [ ${install[maven]} -eq 1 ]; then 251 | echo "maven already installed" 252 | fi 253 | 254 | if [ ${install[nodejs]} -eq 1 ]; then 255 | echo "nodejs already installed" 256 | fi 257 | 258 | if [ ${install[python3]} -eq 1 ]; then 259 | echo "python3 already installed" 260 | fi 261 | if [ ${install[python2]} -eq 1 ]; then 262 | echo "python2 already installed" 263 | fi 264 | 265 | if [ ${install[uaac]} -eq 1 ]; then 266 | echo "uaac not supported" 267 | fi 268 | 269 | if [ ${install[predixcli]} -eq 1 ]; then 270 | install_predixcli 271 | fi 272 | 273 | if [ ${install[mobilecli]} -eq 1 ]; then 274 | echo "mobile cli already installed" 275 | fi 276 | 277 | if [ ${install[androidstudio]} -eq 1 ]; then 278 | echo "android studio already installed" 279 | fi 280 | 281 | if [ ${install[docker]} -eq 1 ]; then 282 | echo "docker already installed" 283 | fi 284 | 285 | } 286 | 287 | function check_status() { 288 | if [ $STATUS != 0 ]; then 289 | echo 290 | echo "install for $TOOL failed" 291 | read -p "Would you like to keep going? (y/n) > " -t 300 answer 292 | if [[ -z $answer ]]; then 293 | echo -n "Specify (yes/no)> " 294 | read answer 295 | fi 296 | if [[ ${answer:0:1} == "y" ]] || [[ ${answer:0:1} == "Y" ]]; then 297 | echo 298 | echo "Continuing to next tool installation" 299 | else 300 | echo 301 | echo "Exiting ..." 302 | exit 1 303 | fi 304 | fi 305 | } 306 | 307 | 308 | run_setup $@ 309 | # Running Proxy Scripts 310 | echo 311 | echo "Pulling proxy scripts from predix-scripts" 312 | get_proxy_scripts 313 | echo 314 | echo "Running verify-proxy.sh" 315 | source verify-proxy.sh 316 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | ### GE Software Development License Agreement – General Release 2 | 3 | THIS SOFTWARE LICENSE AGREEMENT (the “License”) describes the rights granted by the General Electric Company, operating through GE Digital (also referred to as “GE Software”), located at 2623 Camino Ramon, San Ramon, CA 94583 (herein referred to as “Licensor”) to any entity (the “Licensee”) receiving a copy of any of the following GE Digital development materials: Predix DevBox; Predix Reference Application (“RefApp”); Predix Dashboard Seed; Predix Px, Predix Security Service redistributable .jar files; Predix Machine redistributable .jar files; and Predix Machine SDK . These materials may include scripts, compiled code, supporting components, and documentation and are collectively referred to as the “Licensed Programs”. Both Licensor and Licensee are referred to hereinafter as a “Party” and collectively as the “Parties” to this License 4 | 5 | ### Section 1 – Conditional Grant. 6 | 7 | No Licensee is required to accept this License for use of the Licensed Programs. In the absence of a signed license agreement between Licensor and Licensee specifying alternate terms, any use of the Licensed Programs by the Licensee shall be considered acceptance of these terms. The Licensed Programs are copyrighted and are licensed, not sold, to you. If you are not willing to be bound by the terms of this License, do not install, copy or use the Licensed Programs. If you received this software from any source other than the Licensor, your access to the Licensed Programs is NOT permitted under this License, and you must delete the software and any copies from your systems. 8 | 9 | ### Section 2 – Warranty Disclaimer. 10 | 11 | NO WARRANTIES. LICENSOR AND OUR AFFILIATES, RESELLERS, DISTRIBUTORS, AND VENDORS, MAKE NO WARRANTIES, EXPRESS OR IMPLIED, GUARANTEES OR CONDITIONS WITH RESPECT TO USE OF THE LICENSED PROGRAMS. LICENSEE’S USE OF ALL SUCH PROGRAMS ARE AT LICENSEE’S AND CUSTOMERS’ OWN RISK. LICENSOR PROVIDES THE LICENSED PROGRAMS ON AN “AS IS” BASIS “WITH ALL FAULTS” AND “AS AVAILABLE.” LICENSOR DOES NOT GUARANTEE THE ACCURACY OR TIMELINESS OF INFORMATION AVAILABLE FROM, OR PROCESSED BY, THE LICENSED PROGRAMS. TO THE EXTENT PERMITTED UNDER LAW, LICENSOR EXCLUDES ANY IMPLIED WARRANTIES, INCLUDING FOR MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, AND NON-INFRINGEMENT. NO GUARANTEE OF UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE OPERATION IS MADE. 12 | 13 | THESE LICENSED PROGRAMS MAY BE USED AS PART OF A DEVELOPMENT ENVIRONMENT, AND MAY BE COMBINED WITH OTHER CODE BY END-USERS. LICENSOR IS NOT ABLE TO GUARANTEE THAT THE LICENSED PROGRAMS WILL OPERATE WITHOUT DEFECTS WHEN USED IN COMBINATION WITH END-USER SOFTWARE. LICENSEE IS ADVISED TO SAFEGUARD IMPORTANT DATA, TO USE CAUTION, AND NOT TO RELY IN ANY WAY ON THE CORRECT FUNCTIONING OR PERFORMANCE OF ANY COMBINATION OF END-USER SOFTWARE AND THE LICENSED PROGRAMS AND/OR ACCOMPANYING MATERIALS. LICENSEE IS ADVISED NOT TO USE ANY COMBINATION OF LICENSED PROGRAMS AND END-USER PROVIDED SOFTWARE IN A PRODUCTION ENVIRONMENT WITHOUT PRIOR SUITABILITY AND DEFECT TESTING. 14 | 15 | ### Section 3 – Feedback. 16 | 17 | It is expressly understood, acknowledged and agreed that you may provide GE reasonable suggestions, comments and feedback regarding the Software, including but not limited to usability, bug reports and test results, with respect to Software testing (collectively, "Feedback"). If you provide such Feedback to GE, you shall grant GE the following worldwide, non-exclusive, perpetual, irrevocable, royalty free, fully paid up rights: 18 | 19 | A). to make, use, copy, modify, sell, distribute, sub-license, and create derivative works of, the Feedback as part of any product, technology, service, specification or other documentation developed or offered by GE or any of its affiliates (individually and collectively, "GE Products"); 20 | 21 | B). to publicly perform or display, import, broadcast, transmit, distribute, license, offer to sell, and sell, rent, lease or lend copies of the Feedback (and derivative works thereof) as part of any GE Product; 22 | 23 | C). solely with respect to Licensee's copyright and trade secret rights, to sublicense to third parties the foregoing rights, including the right to sublicense to further third parties; and d. to sublicense to third parties any claims of any patents owned or licensable by Licensee that are necessarily infringed by a third party product, technology or service that uses, interfaces, interoperates or communicates with the Feedback or portion thereof incorporated into a GE Product, technology or service. Further, you represent and warrant that your Feedback is not subject to any license terms that would purport to require GE to comply with any additional obligations with respect to any GE Products that incorporate any Feedback. 24 | 25 | ### Section 4 – Reserved 26 | 27 | ### Section 5 – Limitation of Liability. 28 | 29 | LIABILITY ARISING UNDER THIS LICENSE, WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), SHALL BE LIMITED TO DIRECT, OBJECTIVELY MEASURABLE DAMAGES. LICENSOR SHALL HAVE NO LIABILITY TO THE OTHER PARTY OR TO ANY THIRD PARTY, FOR ANY INCIDENTAL, PUNITIVE, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. LIABILITY FOR ANY SOFTWARE LICENSED FROM THIRD PARTIES FOR USE WITH THE SERVICES IS EXPLICILTLY DISCLAIMED AND LIMITED TO THE MAXIMUM EXTENT PERMITTED BY LAW. 30 | 31 | Notwithstanding anything to the contrary, the aggregate liability of Licensor and its suppliers under this License shall not exceed the total amounts paid by Licensee to Licensor hereunder during the one-year period immediately preceding the event which gave rise to the claims. 32 | 33 | ### Section 6 – License. 34 | 35 | A). License Grant. Subject to the terms and conditions of this License, Licensor hereby grants Licensee a worldwide, perpetual, royalty-free, non-exclusive license to: 36 | 37 | i) install the Licensed Programs on Licensee’s premises, and permit Licensee’s users to use the Licensed Programs so installed, solely for Licensee’s own development, testing, demonstration, staging, and production of Licensee’s own software that makes use of the Licensed Programs in a way that adds substantial functionality not present in the Licensed Programs (the result, a “Licensee Application”); 38 | 39 | ii) permit Licensee to permit third-party hosts (“Hosts”) to install the Licensee Application on such Hosts’ respective premises on Licensee’s behalf, and permit Licensee’s users to access and use the Licensed Programs so installed, solely for Licensee’s own development, testing, demonstration, staging and production purposes 40 | 41 | iii) install the Licensee Application on Licensee’s own premises and permit its own users to use the Licensee Application so installed on the same terms as sub-sections (i) and (ii) above. 42 | 43 | B). For the purposes of this License, the right to “use” the Licensed Programs shall include the right to utilize, run, access, store, copy, test or display the Licensed Programs. No right or license is granted or agreed to be granted to disassemble or decompile any Licensed Programs furnished in object code form, and Licensee agrees not to engage in any such conduct unless permitted by law. Reverse engineering of Licensed Programs provided in object code form is prohibited, unless such a right is explicitly granted by any explicit license subject to sub-section (d) below or as a matter of law, and then only to the extent explicitly permitted. Licensor shall have no obligation to support any such reverse engineering, any product or derivative of such reverse engineering, or any use of the Licensed Programs with any modified versions of any of their components under this License. 44 | 45 | C). Licensee shall ensure that any Licensee Applications incorporate the Licensed Programs in such a way as to prevent third parties (other than Hosts) from viewing the code of the Licensed Programs or gaining access to any programmatic interface or other hidden aspect of the Licensed Programs. Licensee shall also restrict distribution of the Licensed Programs, including as part of Licensee Applications, to only those parties who are notified of, and subject to, an enforceable obligation to refrain from any of the prohibited activities listed herein, such as reverse engineering or disassembling the Licensed Programs. 46 | 47 | D). Use of some open source and third party software applications or components included in or accessed through the Licensed Programs may be subject to other terms and conditions found in a separate license agreement, terms of use or “Notice” file located at the download page. The Licensed Programs are accompanied by additional software components solely to enable the Licensed Programs to operate as designed. Licensee is not permitted to use such additional software independently of the Licensed Programs unless Licensee secures a separate license for use from the named vendor. Do not use any third party code unless you agree with the applicable license terms for that code. 48 | 49 | E). Title. Title to and ownership of the Licensed Programs shall at all times remain with Licensor. 50 | 51 | ### Section 7 – Termination. 52 | 53 | A). The Licensor reserves the right to cease distribution and grant of further licenses to any or all of the Licensed Programs at any time in its sole discretion. 54 | 55 | B). The Licensor reserves the right to at any time and at its sole discretion provide updated versions of any or all of the Licensed Programs that supercede and replace the prior version of that Licensed Program. 56 | 57 | C). Your license rights under Section 6 are effective until terminated as described below: 58 | 59 | i). This license and all rights under it will terminate or cease to be effective without notice if Licensee breaches the terms of the License and does not correct or remedy such breach promptly. 60 | 61 | ii). Notwithstanding the foregoing, Licensee may terminate this License at any time for any reason or no reason by providing the Licensor written notice thereof. 62 | 63 | D). Upon any expiration or termination of this License, the rights and licenses granted to you under this License shall immediately terminate, and you shall immediately cease using and delete the Licensed Programs. Licensee Applications based upon the Licensed Programs (see Section 6(a) above) are not subject to this limitation. 64 | 65 | In the event of any expiration or termination of this Licensee, any Confidentiality provision, disclaimers of GE’s representations and warranties, choice of applicable law and limitations of GE’s liability shall survive. 66 | 67 | ### Section 8 – Applicable Law. 68 | 69 | The License shall be governed by and interpreted in accordance with the substantive law of the State of California, U.S.A., excluding its conflicts of law provisions, and by the courts of that state. 70 | -------------------------------------------------------------------------------- /setup-ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | git=0 5 | cf=1 6 | jdk=2 7 | maven=3 8 | sts=4 9 | nodejs=5 10 | python2=6 11 | python3=7 12 | uaac=8 13 | jq=9 14 | predixcli=10 15 | mobilecli=11 16 | androidstudio=12 17 | 18 | declare -a install 19 | 20 | function prefix_to_path() { 21 | if [[ ":$PATH:" != *":$1:"* ]]; then 22 | echo 'export PATH="$1${PATH:+":$PATH"}"' >> ~/.bash_profile 23 | source ~/.bash_profile 24 | fi 25 | } 26 | 27 | function check_internet() { 28 | set +e 29 | echo "" 30 | echo "Checking internet connection..." 31 | curl "http://github.com" > /dev/null 2>&1 32 | if [ $? -ne 0 ]; then 33 | echo "Unable to connect to internet, make sure you are connected to a network and check your proxy settings if behind a corporate proxy. Please read this tutorial for detailed info about setting your proxy https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1565" 34 | exit 1 35 | fi 36 | echo "OK" 37 | echo "" 38 | set -e 39 | } 40 | 41 | function check_bash_profile() { 42 | # Ensure bash profile exists 43 | if [ ! -e ~/.bash_profile ]; then 44 | printf "#!/bin/bash\n" >> ~/.bash_profile 45 | fi 46 | 47 | # This is required for brew to work 48 | prefix_to_path /usr/local/bin 49 | } 50 | 51 | function install_apt_get() { 52 | # Install brew and cask 53 | if which apt-get > /dev/null; then 54 | echo "apt-get already installed, this may take a full minute" 55 | else 56 | echo "Installing apt-get" 57 | wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.0.1ubuntu2.17_amd64.deb -O apt.deb 58 | dpkg -i apt.deb 59 | fi 60 | apt-get --yes update 61 | if which unzip > /dev/null; then 62 | echo "unzip already installed" 63 | else 64 | echo "Installing apt-get" 65 | apt-get install unzip 66 | fi 67 | } 68 | 69 | function apt_get_install() { 70 | echo "--------------------------------------------------------------" 71 | TOOL=$1 72 | COMMAND=$1 73 | if [ $# -eq 2 ]; then 74 | COMMAND=$2 75 | fi 76 | 77 | if which $COMMAND > /dev/null; then 78 | echo "$TOOL already installed" 79 | else 80 | echo "Installing $TOOL" 81 | apt-get --yes update 82 | apt-get --yes install $TOOL 83 | fi 84 | } 85 | 86 | function brew_cask_install() { 87 | echo "--------------------------------------------------------------" 88 | TOOL=$1 89 | 90 | if brew cask list | grep $TOOL > /dev/null; then 91 | echo "$TOOL already installed" 92 | else 93 | echo "Installing $TOOL" 94 | brew cask install $TOOL 95 | fi 96 | } 97 | 98 | function install_everything() { 99 | install[git]=1 100 | install[cf]=1 101 | install[jdk]=1 102 | install[maven]=1 103 | install[sts]=1 104 | install[nodejs]=1 105 | install[python2]=1 106 | install[python3]=1 107 | install[uaac]=0 # Install UAAC only if the --uaac flag is provided 108 | install[jq]=1 109 | install[predixcli]=1 110 | install[mobilecli]=1 111 | install[androidstudio]=0 # Install Android Studio only if --androidstudio flag is provided 112 | } 113 | 114 | function install_nothing() { 115 | install[git]=0 116 | install[cf]=0 117 | install[jdk]=0 118 | install[maven]=0 119 | install[sts]=0 120 | install[nodejs]=0 121 | install[python2]=0 122 | install[python3]=0 123 | install[uaac]=0 124 | install[jq]=0 125 | install[predixcli]=0 126 | install[mobilecli]=0 127 | install[androidstudio]=0 128 | } 129 | 130 | function install_git() { 131 | apt_get_install git 132 | git --version 133 | } 134 | 135 | function install_cf() { 136 | #wget --no-check-certificate -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - 137 | #echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list 138 | # ...then, update your local package index, then finally install the cf CLI 139 | if which cf > /dev/null; then 140 | echo "cf cli already installed" 141 | else 142 | rm -rf cf-cli-installer_6.36.1_x86-64.* 143 | wget --no-check-certificate https://s3-us-west-1.amazonaws.com/cf-cli-releases/releases/v6.36.1/cf-cli-installer_6.36.1_x86-64.deb 144 | dpkg -i cf-cli-installer_6.36.1_x86-64.deb && apt-get --yes install -f 145 | rm -rf cf-cli-installer_6.36.1_x86-64.* 146 | fi 147 | cf -v 148 | 149 | # Install CF Predix plugin 150 | set +e 151 | cf plugins | grep Predix > /dev/null 2>&1 152 | if [ $? -ne 0 ]; then 153 | set -e 154 | cf install-plugin -f https://github.com/PredixDev/cf-predix/releases/download/1.0.0/predix_linux64 155 | fi 156 | set -e 157 | } 158 | 159 | function install_jdk() { 160 | apt_get_install openjdk-8-jdk 161 | javac -version 162 | } 163 | 164 | function install_maven() { 165 | apt_get_install maven 166 | mvn -v 167 | } 168 | 169 | function install_android_studio() { 170 | echo "--------------------------------------------------------------" 171 | echo "Android Studio will require Maven, Ant, and Gradle" 172 | 173 | # Install tools used by Android Studio 174 | install_maven 175 | apt_get_install ant 176 | apt_get_install gradle 177 | 178 | # Install Android Studio dependencies 179 | apt-get --yes install software-properties-common 180 | apt-add-repository ppa:android-studio 181 | apt_get_install android-studio 182 | apt_get_install android-platform-tools 183 | } 184 | 185 | function install_nodejs() { 186 | apt_get_install nodejs 187 | apt_get_install npm 188 | node -v 189 | echo -ne "\nnpm " 190 | npm -v 191 | 192 | type bower > /dev/null || npm install -g bower 193 | echo -ne "\nbower " 194 | bower -v 195 | 196 | type grunt > /dev/null || npm install -g grunt-cli 197 | grunt --version 198 | 199 | type gulp > /dev/null || npm install -g gulp-cli 200 | echo -ne "\ngulp " 201 | gulp --version 202 | echo "node install complete" 203 | } 204 | 205 | function install_python3() { 206 | apt_get_install python3 207 | python3 --version 208 | } 209 | 210 | function install_python2() { 211 | apt_get_install python 212 | python2 --version 213 | 214 | } 215 | 216 | function install_jq() { 217 | apt_get_install jq 218 | jq --version 219 | } 220 | 221 | function install_uaac() { 222 | # Install tools for managing ruby 223 | apt_get_install rbenv 224 | apt_get_install ruby-build 225 | # Add rbenv to bash 226 | grep -q -F 'rbenv init' ~/.bash_profile || echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile && eval "$(rbenv init -)" 227 | # Install latest ruby 228 | RUBY_VERSION=`egrep "^\s+\d+\.\d+\.\d+$" <(rbenv install -l) | tail -1 | tr -d '[[:space:]]'` 229 | echo "--------------------------------------------------------------" 230 | if grep -q "$RUBY_VERSION" <(ruby -v); then 231 | echo "Already running latest version of ruby" 232 | else 233 | echo "Installing latest ruby" 234 | rbenv install $RUBY_VERSION 235 | rbenv global $RUBY_VERSION 236 | fi 237 | ruby -v 238 | 239 | # Install UAAC 240 | echo "--------------------------------------------------------------" 241 | echo "Installing UAAC gem" 242 | gem install cf-uaac 243 | } 244 | 245 | function install_predixcli() { 246 | if which predix > /dev/null; then 247 | echo "Predix CLI already installed." 248 | predix -v 249 | PREDIX_VERSION=$(predix -v | awk -F" " '{print $3}') 250 | update_predixcli $PREDIX_VERSION 251 | else 252 | cli_url=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].assets[0].browser_download_url") 253 | echo "Downloading latest Predix CLI: $cli_url" 254 | curl -L -O "$cli_url" 255 | mkdir -p predix-cli && tar -xf predix-cli.tar.gz -C predix-cli 256 | if [ -e predix-cli ]; then 257 | #tar -C is supposed to change directory but it doesn't sometimes 258 | cd predix-cli 259 | fi 260 | ./install 261 | fi 262 | } 263 | 264 | 265 | function update_predixcli() { 266 | #echo "Predix CLI updgrade"$1 267 | existing_version=$1 268 | cli_version_name=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].tag_name") 269 | cli_version_name=${cli_version_name:1} 270 | echo "Predix CLI already installed version."$existing_version 271 | echo "Predix CLI new installed version."$cli_version_name 272 | echo "checking for upgrade" 273 | if [[ "$existing_version" != *"$cli_version_name"* ]]; then 274 | echo "Upgrading Predix CLI to version" $cli_version_name 275 | cli_url=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].assets[0].browser_download_url") 276 | echo "Downloading latest Predix CLI: $cli_url" 277 | curl -L -O "$cli_url" 278 | mkdir -p predix-cli && tar -xf predix-cli.tar.gz -C predix-cli 279 | if [ -e predix-cli ]; then 280 | #tar -C is supposed to change directory but it doesn't sometimes 281 | cd predix-cli 282 | fi 283 | ./install 284 | fi 285 | 286 | } 287 | 288 | function install_mobilecli() { 289 | if which pm > /dev/null; then 290 | echo "Predix Mobile CLI already installed." 291 | pm version 292 | else 293 | #cli_url=$(curl -g -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases | jq -r '.' ) 294 | cli_url=$(curl -g -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases | jq -r '[ .[]] | .[0].assets[] | select(.name | contains("linux-x64"))| .browser_download_url' ) 295 | cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/master/mobile-cli-install" 296 | cli_install_root_url="https://raw.githubusercontent.com/PredixDev/local-setup/master/mobile-cli-root-install" 297 | #cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/develop/mobile-cli-install.sh" 298 | echo "Downloading latest Predix Mobile CLI: $cli_url" 299 | curl -L "$cli_url" -o pm.zip 300 | mkdir -p mobile-cli && unzip pm.zip -d mobile-cli 301 | cd mobile-cli 302 | echo $cli_install_url 303 | curl -L -O "$cli_install_url" 304 | echo $cli_install_root_url 305 | curl -L -O "$cli_install_root_url" 306 | chmod +x mobile-cli-install 307 | chmod +x mobile-cli-root-install 308 | ./mobile-cli-install 309 | fi 310 | } 311 | 312 | function install_sts() { 313 | rm -rf spring-tool-suite-3.9.4.RELEASE-e4.7.3a-linux-gtk-x86_64.* 314 | rm -rf sts-bundle 315 | wget --no-check-certificate http://download.springsource.com/release/STS/3.9.4.RELEASE/dist/e4.7/spring-tool-suite-3.9.4.RELEASE-e4.7.3a-linux-gtk-x86_64.tar.gz 316 | tar xf spring-tool-suite-3.9.4.RELEASE-e4.7.3a-linux-gtk-x86_64.tar.gz 317 | rm -rf spring-tool-suite-3.9.4.RELEASE-e4.7.3a-linux-gtk-x86_64.tar.gz 318 | } 319 | 320 | function run_setup() { 321 | echo "--------------------------------------------------------------" 322 | echo "This script will install tools required for Predix development" 323 | echo "You may be asked to provide your password during the installation process" 324 | echo "--------------------------------------------------------------" 325 | echo "" 326 | if [ -z "$1" ]; then 327 | echo "Installing all the tools..." 328 | install_everything 329 | else 330 | echo "Installing only tools specified in parameters..." 331 | install_nothing 332 | while [ ! -z "$1" ]; do 333 | [ "$1" == "--git" ] && install[git]=1 334 | [ "$1" == "--cf" ] && install[cf]=1 335 | [ "$1" == "--jdk" ] && install[jdk]=1 336 | [ "$1" == "--maven" ] && install[maven]=1 337 | [ "$1" == "--sts" ] && install[sts]=1 338 | [ "$1" == "--nodejs" ] && install[nodejs]=1 339 | [ "$1" == "--python2" ] && install[python2]=1 340 | [ "$1" == "--python3" ] && install[python3]=1 341 | [ "$1" == "--uaac" ] && install[uaac]=1 342 | [ "$1" == "--jq" ] && install[jq]=1 343 | [ "$1" == "--predixcli" ] && install[predixcli]=1 344 | [ "$1" == "--mobilecli" ] && install[mobilecli]=1 345 | [ "$1" == "--androidstudio" ] && install[androidstudio]=1 346 | shift 347 | done 348 | install[jq]=1 349 | fi 350 | 351 | check_internet 352 | check_bash_profile 353 | install_apt_get 354 | 355 | if [ ${install[jq]} -eq 1 ]; then 356 | install_jq 357 | fi 358 | 359 | if [ ${install[git]} -eq 1 ]; then 360 | install_git 361 | fi 362 | 363 | if [ ${install[cf]} -eq 1 ]; then 364 | install_cf 365 | fi 366 | 367 | if [ ${install[jdk]} -eq 1 ]; then 368 | install_jdk 369 | fi 370 | 371 | if [ ${install[maven]} -eq 1 ]; then 372 | install_maven 373 | fi 374 | 375 | if [ ${install[sts]} -eq 1 ]; then 376 | install_sts 377 | fi 378 | 379 | if [ ${install[nodejs]} -eq 1 ]; then 380 | install_nodejs 381 | fi 382 | 383 | if [ ${install[python3]} -eq 1 ]; then 384 | install_python3 385 | fi 386 | if [ ${install[python2]} -eq 1 ]; then 387 | install_python2 388 | fi 389 | 390 | if [ ${install[uaac]} -eq 1 ]; then 391 | install_uaac 392 | fi 393 | 394 | if [ ${install[predixcli]} -eq 1 ]; then 395 | install_predixcli 396 | fi 397 | 398 | if [ ${install[mobilecli]} -eq 1 ]; then 399 | install_mobilecli 400 | fi 401 | 402 | if [ ${install[androidstudio]} -eq 1 ]; then 403 | install_android_studio 404 | fi 405 | } 406 | 407 | run_setup $@ 408 | -------------------------------------------------------------------------------- /setup-mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | git=0 5 | cf=1 6 | jdk=2 7 | maven=3 8 | nodejs=4 9 | python2=5 10 | python3=6 11 | uaac=7 12 | jq=8 13 | predixcli=9 14 | mobilecli=10 15 | androidstudio=11 16 | docker=12 17 | vmware=13 18 | 19 | declare -a install 20 | 21 | function prefix_to_path() { 22 | if [[ ":$PATH:" != *":$1:"* ]]; then 23 | echo 'export PATH="$1${PATH:+":$PATH"}"' >> ~/.bash_profile 24 | source ~/.bash_profile 25 | fi 26 | } 27 | 28 | function check_internet() { 29 | set +e 30 | echo "" 31 | echo "Checking internet connection..." 32 | curl "http://github.com" > /dev/null 2>&1 33 | if [ $? -ne 0 ]; then 34 | echo "Unable to connect to internet, make sure you are connected to a network and check your proxy settings if behind a corporate proxy. Please read this tutorial for detailed info about setting your proxy https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1565" 35 | echo "" 36 | exit 1 37 | fi 38 | echo "OK" 39 | echo "" 40 | set -e 41 | } 42 | 43 | function check_bash_profile() { 44 | # Ensure bash profile exists 45 | if [ ! -e ~/.bash_profile ]; then 46 | printf "#!/bin/bash\n" >> ~/.bash_profile 47 | fi 48 | 49 | # This is required for brew to work 50 | prefix_to_path /usr/local/bin 51 | } 52 | 53 | function get_proxy_scripts() { 54 | VERIFY_PROXY_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/verify-proxy.sh 55 | TOGGLE_PROXY_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/toggle-proxy.sh 56 | ENABLE_XSL_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/enable-proxy.xsl 57 | DISABLE_XSL_URL=https://raw.githubusercontent.com/PredixDev/predix-scripts/master/bash/common/proxy/disable-proxy.xsl 58 | 59 | if [ -f "verify-proxy.sh" ]; then 60 | rm verify-proxy.sh 61 | fi 62 | if [ -f "toggle-proxy.sh" ]; then 63 | rm toggle-proxy.sh 64 | fi 65 | if [ -f "enable-proxy.xsl" ]; then 66 | rm enable-proxy.xsl 67 | fi 68 | if [ -f "disable-proxy.xsl" ]; then 69 | rm disable-proxy.xsl 70 | fi 71 | 72 | if [ ! -f "verify-proxy.sh" ]; then 73 | curl -s -O $VERIFY_PROXY_URL 74 | fi 75 | if [ ! -f "toggle-proxy.sh" ]; then 76 | curl -s -O $TOGGLE_PROXY_URL 77 | fi 78 | if [ ! -f "enable-proxy.xsl" ]; then 79 | curl -s -O $ENABLE_XSL_URL 80 | fi 81 | if [ ! -f "disable-proxy.xsl" ]; then 82 | curl -s -O $DISABLE_XSL_URL 83 | fi 84 | } 85 | 86 | function install_brew_cask() { 87 | # Install brew and cask 88 | if which brew > /dev/null; then 89 | echo "brew already installed, tapping cask, this may take a full minute" 90 | else 91 | echo "Installing brew and cask, this may take a few minutes" 92 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 93 | fi 94 | brew tap caskroom/cask 95 | } 96 | 97 | function brew_install() { 98 | echo "--------------------------------------------------------------" 99 | TOOL=$1 100 | COMMAND=$1 101 | if [ $# -eq 2 ]; then 102 | COMMAND=$2 103 | fi 104 | 105 | if which $COMMAND > /dev/null; then 106 | echo "$TOOL already installed" 107 | else 108 | echo "Installing $TOOL" 109 | brew install $TOOL 110 | 111 | # Adding validation to check for installation failures 112 | STATUS=$? 113 | check_status 114 | fi 115 | } 116 | 117 | function brew_cask_install() { 118 | echo "--------------------------------------------------------------" 119 | TOOL=$1 120 | 121 | if brew cask list | grep $TOOL > /dev/null; then 122 | echo "$TOOL already installed" 123 | else 124 | echo "Installing $TOOL" 125 | brew cask install $TOOL 126 | fi 127 | } 128 | 129 | function install_everything() { 130 | install[git]=1 131 | install[cf]=1 132 | install[jdk]=1 133 | install[maven]=1 134 | install[nodejs]=1 135 | install[python2]=1 136 | install[python3]=1 137 | install[uaac]=0 # Install UAAC only if the --uaac flag is provided 138 | install[jq]=1 139 | install[yq]=1 140 | install[predixcli]=1 141 | install[mobilecli]=1 142 | install[androidstudio]=0 # Install Android Studio only if --androidstudio flag is provided 143 | install[docker]=1 144 | install[vmware]=0 # Install Android Studio only if --vmware flag is provided 145 | } 146 | 147 | function install_nothing() { 148 | install[git]=0 149 | install[cf]=0 150 | install[jdk]=0 151 | install[maven]=0 152 | install[nodejs]=0 153 | install[python2]=0 154 | install[python3]=0 155 | install[uaac]=0 156 | install[jq]=0 157 | install[yq]=0 158 | install[predixcli]=0 159 | install[mobilecli]=0 160 | install[androidstudio]=0 161 | install[docker]=0 162 | install[vmware]=0 163 | } 164 | 165 | function install_git() { 166 | brew_install git 167 | git --version 168 | } 169 | 170 | function install_cf() { 171 | brew tap cloudfoundry/tap 172 | brew_install cf-cli cf 173 | cf -v 174 | } 175 | 176 | function install_jdk() { 177 | brew_cask_install java 178 | javac -version 179 | } 180 | 181 | function install_maven() { 182 | brew_install maven mvn 183 | mvn -v 184 | } 185 | 186 | function install_android_studio() { 187 | echo "--------------------------------------------------------------" 188 | echo "Android Studio will require Maven, Ant, and Gradle" 189 | 190 | # Install tools used by Android Studio 191 | install_maven 192 | brew_install ant 193 | brew_install gradle 194 | 195 | # Install Android Studio dependencies 196 | brew_cask_install android-studio 197 | brew cask install android-platform-tools 198 | } 199 | 200 | function install_docker() { 201 | # Install Docker dependencies 202 | brew_cask_install docker 203 | echo "Run the Docker app found in the Applications folder and docker CLI commands will also be available." 204 | } 205 | 206 | function install_vmware() { 207 | brew_cask_install vmware-fusion 208 | echo "Run the VMWare app found in the Applications folder" 209 | } 210 | 211 | function install_nodejs() { 212 | brew_install node 213 | node -v 214 | echo -ne "\nnpm " 215 | npm -v 216 | 217 | type bower > /dev/null || npm install -g bower 218 | echo -ne "\nbower " 219 | bower -v 220 | 221 | type grunt > /dev/null || npm install -g grunt-cli 222 | grunt --version 223 | 224 | type gulp > /dev/null || npm install -g gulp-cli 225 | echo -ne "\ngulp " 226 | gulp --version 227 | echo "node install complete" 228 | } 229 | 230 | function install_python3() { 231 | brew_install python3 232 | python3 --version 233 | sudo easy_install pip 234 | } 235 | 236 | function install_python2() { 237 | brew_install python2 238 | python2 --version 239 | sudo easy_install pip 240 | } 241 | 242 | function install_jq() { 243 | brew_install jq 244 | jq --version 245 | } 246 | 247 | function install_yq() { 248 | brew_install yq 249 | yq --version 250 | } 251 | 252 | function install_uaac() { 253 | # Install tools for managing ruby 254 | brew_install rbenv 255 | brew_install ruby-build 256 | # Add rbenv to bash 257 | grep -q -F 'rbenv init' ~/.bash_profile || echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile && eval "$(rbenv init -)" 258 | # Install latest ruby 259 | RUBY_VERSION=`egrep "^\s+\d+\.\d+\.\d+$" <(rbenv install -l) | tail -1 | tr -d '[[:space:]]'` 260 | echo "--------------------------------------------------------------" 261 | if grep -q "$RUBY_VERSION" <(ruby -v); then 262 | echo "Already running latest version of ruby" 263 | else 264 | echo "Installing latest ruby" 265 | rbenv install $RUBY_VERSION 266 | rbenv global $RUBY_VERSION 267 | fi 268 | ruby -v 269 | 270 | # Install UAAC 271 | echo "--------------------------------------------------------------" 272 | echo "Installing UAAC gem" 273 | gem install cf-uaac 274 | } 275 | 276 | function install_predixcli() { 277 | export DYLD_INSERT_LIBRARIES=; 278 | if which predix > /dev/null; then 279 | echo "Predix CLI already installed." 280 | predix -v 281 | PREDIX_VERSION=$(predix -v | awk -F" " '{print $3}') 282 | update_predixcli $PREDIX_VERSION 283 | else 284 | cli_url=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].assets[0].browser_download_url") 285 | echo "Downloading latest Predix CLI: $cli_url" 286 | curl -L -O "$cli_url" 287 | mkdir -p predix-cli && tar -xf predix-cli.tar.gz -C predix-cli 288 | if [ -e predix-cli ]; then 289 | #tar -C is supposed to change directory but it doesn't sometimes 290 | cd predix-cli 291 | fi 292 | ./install 293 | fi 294 | } 295 | 296 | 297 | function update_predixcli() { 298 | #echo "Predix CLI updgrade"$1 299 | existing_version=$1 300 | cli_version_name=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].tag_name") 301 | cli_version_name=${cli_version_name:1} 302 | echo "Predix CLI already installed version."$existing_version 303 | echo "Predix CLI new installed version."$cli_version_name 304 | echo "checking for upgrade" 305 | if [[ "$existing_version" != *"$cli_version_name"* ]]; then 306 | echo "Upgrading Predix CLI to version" $cli_version_name 307 | cli_url=$(curl -s -L https://api.github.com/repos/PredixDev/predix-cli/releases | jq -r ".[0].assets[0].browser_download_url") 308 | echo "Downloading latest Predix CLI: $cli_url" 309 | curl -L -O "$cli_url" 310 | mkdir -p predix-cli && tar -xf predix-cli.tar.gz -C predix-cli 311 | if [ -e predix-cli ]; then 312 | #tar -C is supposed to change directory but it doesn't sometimes 313 | cd predix-cli 314 | fi 315 | ./install 316 | fi 317 | 318 | } 319 | 320 | function install_mobilecli() { 321 | if which pm > /dev/null; then 322 | echo "Predix Mobile CLI already installed." 323 | pm 324 | else 325 | #cli_url=$(curl -g -s -L https://api.github.com/repos/PredixDev/predix-mobile-cli/releases | jq -r '.' ) 326 | 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' ) 327 | cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/master/mobile-cli-install" 328 | cli_install_root_url="https://raw.githubusercontent.com/PredixDev/local-setup/master/mobile-cli-root-install" 329 | #cli_install_url="https://raw.githubusercontent.com/PredixDev/local-setup/develop/mobile-cli-install.sh" 330 | echo "Downloading latest Predix Mobile CLI: $cli_url" 331 | curl -L "$cli_url" -o pm.zip 332 | mkdir -p mobile-cli && tar -xf pm.zip -C mobile-cli 333 | cd mobile-cli 334 | echo $cli_install_url 335 | curl -L -O "$cli_install_url" 336 | echo $cli_install_root_url 337 | curl -L -O "$cli_install_root_url" 338 | chmod +x mobile-cli-install 339 | chmod +x mobile-cli-root-install 340 | ./mobile-cli-install 341 | fi 342 | } 343 | 344 | function run_setup() { 345 | echo "--------------------------------------------------------------" 346 | echo "This script will install tools required for Predix development" 347 | echo "You may be asked to provide your password during the installation process" 348 | echo "--------------------------------------------------------------" 349 | echo "" 350 | if [ -z "$1" ]; then 351 | echo "Installing all the tools..." 352 | install_everything 353 | else 354 | echo "Installing only tools specified in parameters..." 355 | install_nothing 356 | while [ ! -z "$1" ]; do 357 | [ "$1" == "--git" ] && install[git]=1 358 | [ "$1" == "--cf" ] && install[cf]=1 359 | [ "$1" == "--jdk" ] && install[jdk]=1 360 | [ "$1" == "--maven" ] && install[maven]=1 361 | [ "$1" == "--nodejs" ] && install[nodejs]=1 362 | [ "$1" == "--python2" ] && install[python2]=1 363 | [ "$1" == "--python3" ] && install[python3]=1 364 | [ "$1" == "--uaac" ] && install[uaac]=1 365 | [ "$1" == "--jq" ] && install[jq]=1 366 | [ "$1" == "--yq" ] && install[yq]=1 367 | [ "$1" == "--predixcli" ] && install[predixcli]=1 368 | [ "$1" == "--mobilecli" ] && install[mobilecli]=1 369 | [ "$1" == "--androidstudio" ] && install[androidstudio]=1 370 | [ "$1" == "--docker" ] && install[docker]=1 371 | [ "$1" == "--vmware" ] && install[vmware]=1 372 | shift 373 | done 374 | install[jq]=1 375 | fi 376 | 377 | check_internet 378 | check_bash_profile 379 | install_brew_cask 380 | 381 | if [ ${install[jq]} -eq 1 ]; then 382 | install_jq 383 | fi 384 | 385 | if [ ${install[yq]} -eq 1 ]; then 386 | install_yq 387 | fi 388 | 389 | if [ ${install[git]} -eq 1 ]; then 390 | install_git 391 | fi 392 | 393 | if [ ${install[cf]} -eq 1 ]; then 394 | install_cf 395 | fi 396 | 397 | if [ ${install[jdk]} -eq 1 ]; then 398 | install_jdk 399 | fi 400 | 401 | if [ ${install[maven]} -eq 1 ]; then 402 | install_maven 403 | fi 404 | 405 | if [ ${install[nodejs]} -eq 1 ]; then 406 | install_nodejs 407 | fi 408 | 409 | if [ ${install[python3]} -eq 1 ]; then 410 | install_python3 411 | fi 412 | if [ ${install[python2]} -eq 1 ]; then 413 | install_python2 414 | fi 415 | 416 | if [ ${install[uaac]} -eq 1 ]; then 417 | install_uaac 418 | fi 419 | 420 | if [ ${install[predixcli]} -eq 1 ]; then 421 | install_predixcli 422 | fi 423 | 424 | if [ ${install[mobilecli]} -eq 1 ]; then 425 | install_mobilecli 426 | fi 427 | 428 | if [ ${install[androidstudio]} -eq 1 ]; then 429 | install_android_studio 430 | fi 431 | 432 | if [ ${install[docker]} -eq 1 ]; then 433 | install_docker 434 | fi 435 | 436 | if [ ${install[vmware]} -eq 1 ]; then 437 | install_vmware 438 | fi 439 | } 440 | 441 | function check_status() { 442 | if [ $STATUS != 0 ]; then 443 | echo 444 | echo "brew install for $TOOL failed" 445 | read -p "Would you like to keep going? (y/n) > " -t 300 answer 446 | if [[ -z $answer ]]; then 447 | echo -n "Specify (yes/no)> " 448 | read answer 449 | fi 450 | if [[ ${answer:0:1} == "y" ]] || [[ ${answer:0:1} == "Y" ]]; then 451 | echo 452 | echo "Continuing to next tool installation" 453 | else 454 | echo 455 | echo "Exiting ..." 456 | exit 1 457 | fi 458 | fi 459 | } 460 | 461 | 462 | run_setup $@ 463 | # Running Proxy Scripts 464 | echo 465 | echo "Pulling proxy scripts from predix-scripts" 466 | get_proxy_scripts 467 | echo 468 | echo "Running verify-proxy.sh" 469 | source verify-proxy.sh 470 | -------------------------------------------------------------------------------- /setup-windows.bat: -------------------------------------------------------------------------------- 1 | SET install[docker]=0 2 | @ECHO OFF 3 | SETLOCAL ENABLEDELAYEDEXPANSION 4 | 5 | echo branch=!BRANCH! 6 | REM SET RESETVARS=https://raw.githubusercontent.com/PredixDev/local-setup/!BRANCH!/resetvars.vbs 7 | SET RESETVARS=https://raw.githubusercontent.com/PredixDev/local-setup/master/resetvars.vbs 8 | 9 | GOTO START 10 | 11 | :PROCESS_ARGS 12 | IF "%1"=="" ( 13 | ECHO Installing all the tools... 14 | CALL :INSTALL_EVERYTHING 15 | GOTO :eof 16 | ) 17 | IF NOT "%1"=="" ( 18 | ECHO Installing only tools specified in parameters... 19 | CALL :INSTALL_NOTHING 20 | ) 21 | :loop_process_args 22 | IF "%1"=="" GOTO end_loop_process_args 23 | IF /I "%1"=="/git" SET install[git]=1 24 | IF /I "%1"=="/cf" SET install[cf]=1 25 | IF /I "%1"=="/putty" SET install[putty]=1 26 | IF /I "%1"=="/jdk" SET install[jdk]=1 27 | IF /I "%1"=="/maven" SET install[maven]=1 28 | IF /I "%1"=="/sts" SET install[sts]=1 29 | rem curl is not reliable on windows command window 30 | rem IF /I "%1"=="/curl" SET install[curl]=1 31 | IF /I "%1"=="/nodejs" SET install[nodejs]=1 32 | IF /I "%1"=="/python2" SET install[python2]=1 33 | IF /I "%1"=="/python3" SET install[python3]=1 34 | IF /I "%1"=="/jq" SET install[jq]=1 35 | IF /I "%1"=="/predixcli" SET install[predixcli]=1 36 | IF /I "%1"=="/mobilecli" SET install[mobilecli]=1 37 | IF /I "%1"=="/androidstudio" SET install[androidstudio]=1 38 | IF /I "%1"=="/docker" SET install[docker]=1 39 | IF /I "%1"=="/vmware" SET install[vmware]=1 40 | IF /I "%1"=="/yq" SET install[yq]=1 41 | SHIFT 42 | GOTO loop_process_args 43 | :end_loop_process_args 44 | SET install[jq]=1 45 | GOTO :eof 46 | 47 | :GET_DEPENDENCIES 48 | ECHO Getting Dependencies 49 | CALL :DOWNLOAD_TO_FILE !RESETVARS! , %TEMP%\resetvars.vbs 50 | GOTO :eof 51 | 52 | :RELOAD_ENV 53 | "%TEMP%\resetvars.vbs" 54 | CALL "%TEMP%\resetvars.bat" >$null 55 | CALL refreshenv 56 | GOTO :eof 57 | 58 | :CHECK_INTERNET_CONNECTION 59 | ECHO Checking internet connection... 60 | @powershell -Command "iwr http://bing.com -UseBasicParsing" >$null 2>&1 61 | IF NOT !errorlevel! EQU 0 ( 62 | 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 63 | exit /b !errorlevel! 64 | ) 65 | ECHO OK 66 | GOTO :eof 67 | 68 | :INSTALL_CHOCO 69 | where choco >$null 2>&1 70 | IF NOT !errorlevel! EQU 0 ( 71 | ECHO Installing chocolatey... 72 | @powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" 73 | CALL :CHECK_FAIL 74 | ) 75 | GOTO :eof 76 | 77 | :CHOCO_INSTALL 78 | SETLOCAL 79 | SET tool=%1 80 | SET cmd=%1 81 | IF NOT "%2"=="" ( 82 | SET cmd=%2 83 | ) 84 | where !cmd! >$null 2>&1 85 | IF NOT !errorlevel! EQU 0 ( 86 | choco install -y --allow-empty-checksums %1 87 | CALL :CHECK_FAIL 88 | CALL :RELOAD_ENV 89 | ) ELSE ( 90 | ECHO %1 already installed 91 | ECHO. 92 | ) 93 | ENDLOCAL & GOTO :eof 94 | 95 | :NPM_INSTALL_GLOBAL 96 | SETLOCAL 97 | SET tool=%1 98 | SET cmd=%1 99 | IF NOT "%2"=="" ( 100 | SET cmd=%2 101 | ) 102 | where !cmd! >$null 2>&1 103 | IF NOT !errorlevel! EQU 0 ( 104 | ECHO npm install -g %1 105 | npm install -g %1 106 | CALL :CHECK_FAIL 107 | ) ELSE ( 108 | ECHO %1 already installed 109 | ECHO. 110 | ) 111 | ENDLOCAL & GOTO :eof 112 | 113 | :DOWNLOAD_TO_FILE 114 | ECHO download to file 115 | ECHO %~1 %~2 116 | REM arg1 is URL, arg2 is filename to redirect output to 117 | @powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $response = iwr -UseBasicParsing -uri %~1; write-output $response.Content | Out-File %~2 ASCII -Width 9999" 118 | CALL :CHECK_FAIL 119 | REM echo return from check_fail 120 | GOTO :eof 121 | 122 | :DOWNLOAD_BINARY_TO_FILE 123 | ECHO download binary to file 124 | ECHO %~1 %~2 125 | REM arg1 is URL, arg2 is filename to redirect output to 126 | @powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (new-object net.webclient).DownloadFile('%~1','%~2') 127 | CALL :CHECK_FAIL 128 | GOTO :eof 129 | 130 | :CHECK_FAIL 131 | ECHO CHECK_FAIL errorlevel: !errorlevel! 132 | IF NOT !errorlevel! EQU 0 ( 133 | ECHO FAILED !errorlevel! 134 | ECHO Any changes to the PATH will not take affect unless you reopen a new Admin command window, please open a new window now. 135 | exit /b !errorlevel! 136 | ) 137 | GOTO :EOF 138 | 139 | :INSTALL_NOTHING 140 | SET install[git]=0 141 | SET install[cf]=0 142 | SET install[putty]=0 143 | SET install[jdk]=0 144 | SET install[maven]=0 145 | SET install[sts]=0 146 | rem SET install[curl]=0 147 | SET install[nodejs]=0 148 | SET install[python2]=0 149 | SET install[python3]=0 150 | SET install[jq]=0 151 | SET install[predixcli]=0 152 | SET install[mobilecli]=0 153 | SET install[androidstudio]=0 154 | SET install[docker]=0 155 | SET install[vmware]=0 156 | SET install[yq]=0 157 | GOTO :eof 158 | 159 | :INSTALL_EVERYTHING 160 | SET install[git]=1 161 | SET install[cf]=1 162 | SET install[putty]=1 163 | SET install[jdk]=1 164 | SET install[maven]=1 165 | SET install[sts]=1 166 | rem SET install[curl]=1 167 | SET install[nodejs]=1 168 | SET install[python2]=1 169 | SET install[python3]=1 170 | SET install[jq]=1 171 | SET install[predixcli]=1 172 | SET install[mobilecli]=1 173 | SET install[androidstudio]=0 174 | SET install[docker]=0 175 | SET install[vmware]=0 176 | SET install[yq]=1 177 | GOTO :eof 178 | 179 | 180 | :INSTALL_PREDIXCLI 181 | ECHO. 182 | ECHO Installing predixcli... 183 | where predix >$null 2>&1 184 | IF NOT !errorlevel! EQU 0 ( 185 | ECHO Downloading installer 186 | CALL :CHOCO_INSTALL 7zip.commandline 7z 187 | REM get the url of the release file 188 | CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-cli/releases , predix-cli-output.tmp 189 | predix-cli-output2.tmp ) 190 | SET /p cli_url=> %HOMEPATH%\.bashrc 205 | ECHO Predix CLI installed here: %ALLUSERSPROFILE%\chocolatey\bin\ 206 | ) ELSE ( 207 | ECHO check for upgrade 208 | predix -v >pxcliv.tmp 209 | SET /p predixcli_current_version=predix-cli-release-response-name.tmp) 212 | nul 2>&1 215 | if not errorlevel 1 ( 216 | ECHO PREDIX CLI is current 217 | ) else ( 218 | ECHO Upgrading Predix CLI to version !cli_latest_tag! 219 | CALL :UPGRADE_PREDIXCLI 220 | ) 221 | ECHO Predix CLI already installed, predix is installed at... 222 | where predix 223 | ECHO Predix CLI already installed, px shortcut is installed at... 224 | where px 225 | ECHO Predix CLI version is as follows, please check for updates at https://github.com/PredixDev/predix-cli 226 | ) 227 | predix -v 228 | GOTO :eof 229 | 230 | :UPGRADE_PREDIXCLI 231 | ECHO Upgrading predixcli... 232 | ECHO Downloading installer 233 | CALL :CHOCO_INSTALL 7zip.commandline 7z 234 | REM get the url of the release file 235 | CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-cli/releases , predix-cli-output.tmp 236 | predix-cli-output2.tmp ) 237 | SET /p cli_url=> %HOMEPATH%\.bashrc 247 | ECHO Predix CLI installed here: %ALLUSERSPROFILE%\chocolatey\bin\ 248 | GOTO :eof 249 | 250 | :INSTALL_ANDROID_STUDIO 251 | ECHO. 252 | ECHO Installing Android Studio... 253 | CALL :CHOCO_INSTALL maven 254 | CALL :CHOCO_INSTALL ant 255 | CALL :CHOCO_INSTALL gradle 256 | 257 | CALL :CHOCO_INSTALL android-sdk -y 258 | CALL :CHOCO_INSTALL androidstudio -y 259 | CALL :CHOCO_INSTALL adb 260 | ECHO Installing Android Studio complete... 261 | GOTO :eof 262 | 263 | :INSTALL_DOCKER 264 | ECHO. 265 | ECHO Installing Docker... 266 | CALL :CHOCO_INSTALL docker-for-windows 267 | ECHO Installing Docker complete, from Start menu launch the Docker For Windows app. Then try docker commands from command line or git-bash terminal window. 268 | GOTO :eof 269 | 270 | :INSTALL_VMWARE 271 | ECHO. 272 | ECHO Installing VMWare Workstation... 273 | CALL :CHOCO_INSTALL vmwareworkstation 274 | ECHO Installing VMWare Workstation complete... 275 | GOTO :eof 276 | 277 | :INSTALL_MOBILECLI 278 | ECHO. 279 | ECHO Installing mobilecli... 280 | where pm >$null 2>&1 281 | IF NOT !errorlevel! EQU 0 ( 282 | ECHO Downloading installer 283 | CALL :CHOCO_INSTALL 7zip.commandline 7z 284 | REM get the url of the release file 285 | CALL :DOWNLOAD_TO_FILE https://api.github.com/repos/PredixDev/predix-mobile-cli/releases , mobile-output.tmp 286 | mobile-output2.tmp ) 287 |