hack/install-assets.sh
0dd13ecb
 #!/bin/bash
 
 set -e
 
e3bb13a1
 OS_ROOT=$(dirname "${BASH_SOURCE}")/..
 source "${OS_ROOT}/hack/common.sh"
8fd4257f
 
78e5298e
 TMPDIR="${TMPDIR:-"/tmp"}"
 LOG_DIR="${LOG_DIR:-$(mktemp -d ${TMPDIR}/openshift.assets.logs.XXXX)}"
 
 function cmd() {
   local cmd="$1"
a9b34022
   local log_file=$(mktemp ${LOG_DIR}/install-assets.XXXX)
78e5298e
   echo "[install-assets] ${cmd}"
   rc="0"
   $cmd &> ${log_file} || rc=$?
   if [ "$rc" != "0" ]; then
     echo "[ERROR] Command '${cmd}' failed with ${rc}, logs:" && cat ${log_file}
22e6b483
     exit $rc
78e5298e
   fi
 }
 
0dd13ecb
 # If we are running inside of Travis then do not run the rest of this
 # script unless we want to TEST_ASSETS
1a418ed8
 if [[ "${TRAVIS-}" == "true" && "${TEST_ASSETS-}" == "false" ]]; then
0dd13ecb
   exit
 fi
 
e40f7862
 # Lock version of npm to work around https://github.com/npm/npm/issues/6309
1a418ed8
 if [[ "${TRAVIS-}" == "true" ]]; then
94cb4fe4
   cmd "npm install -g npm@2.1.14" "npm.log"
e40f7862
 fi
 
8fd4257f
 # Install bower if needed
 if ! which bower > /dev/null 2>&1 ; then
1a418ed8
   if [[ "${TRAVIS-}" == "true" ]]; then
78e5298e
     cmd "npm install -g bower"
8fd4257f
   else
78e5298e
     cmd "sudo npm install -g bower"
8fd4257f
   fi
 fi
  
 # Install grunt if needed
 if ! which grunt > /dev/null 2>&1 ; then
1a418ed8
   if [[ "${TRAVIS-}" == "true" ]]; then
78e5298e
     cmd "npm install -g grunt-cli"
8fd4257f
   else
78e5298e
     cmd "sudo npm install -g grunt-cli"
8fd4257f
   fi
 fi
 
e3bb13a1
 pushd ${OS_ROOT}/assets > /dev/null
78e5298e
   cmd "npm install"
c705715f
   cmd "node_modules/protractor/bin/webdriver-manager update"
   
7e004cf0
   # In case upstream components change things without incrementing versions
07973656
   cmd "bower cache clean --allow-root"
   cmd "bower install --allow-root"
fd10c77e
   
   cmd "rm -rf openshift-jvm"
   cmd "mkdir -p openshift-jvm"
132a4971
   wget https://github.com/hawtio/openshift-jvm/archive/v1.0.13-build.tar.gz -O - | tar -xz -C openshift-jvm --strip-components=1
0dd13ecb
 popd > /dev/null
8fd4257f
 
e3bb13a1
 pushd ${OS_ROOT}/Godeps/_workspace > /dev/null
8fd4257f
   godep_path=$(pwd)
   pushd src/github.com/jteeuwen/go-bindata > /dev/null
     GOPATH=$godep_path go install ./...
   popd > /dev/null
1ca6ce69
 popd > /dev/null