github.com/rochacon/deis@v1.0.2-0.20150903015341-6839b592a1ff/tests/bin/accept/lib/clients.sh (about) 1 function setup-clients { 2 local version="${1}" 3 4 rerun_log "Installing clients (version ${version})" 5 6 rerun_log debug "Resetting PATH to ${ORIGINAL_PATH}" 7 export PATH="${ORIGINAL_PATH}" 8 9 setup-deis-client "${version}" 10 setup-deisctl-client "${version}" 11 } 12 13 function is-released-version { 14 [[ ${1} =~ ^([0-9]+\.){0,2}[0-9]$ ]] && return 0 15 } 16 17 function download-client { 18 local client="${1}" 19 local version="${2}" 20 local dir="${3}" 21 22 pushd "${dir}" 23 curl -sSL "http://deis.io/${client}/install.sh" | sh -s "${version}" 24 popd 25 } 26 27 function setup-deis-client { 28 # install deis CLI from http://deis.io/ website 29 local version="${1}" 30 31 local client_dir="${TEST_ROOT}/${version}/deis-cli" 32 mkdir -p "${client_dir}" 33 34 if is-released-version "${version}" ; then 35 rerun_log "Installing deis-cli (${version}) to ${client_dir}..." 36 37 download-client "deis-cli" "${version}" "${client_dir}" 38 39 export PATH="${client_dir}:${PATH}" 40 else 41 rerun_log "Building deis-cli locally..." 42 43 git fetch 44 git checkout "${version}" 45 make -C client build 46 export PATH="${DEIS_ROOT}/client/dist:${PATH}" 47 fi 48 } 49 50 function setup-deisctl-client { 51 # install deisctl from http://deis.io/ website or from repository 52 local version="${1}" 53 54 unset DEISCTL_UNITS 55 56 local client_dir="${TEST_ROOT}/${version}/deisctl" 57 mkdir -p "${client_dir}" 58 59 if is-released-version "${version}" ; then 60 rerun_log "Installing deisctl (${version}) to ${client_dir}..." 61 62 download-client "deisctl" "${version}" "${client_dir}" 63 export PATH="${client_dir}:${PATH}" 64 else 65 rerun_log "Building deisctl locally..." 66 67 git fetch 68 git checkout "${version}" 69 make -C deisctl build 70 71 export DEISCTL_UNITS="${DEIS_ROOT}/deisctl/units" 72 export PATH="${DEIS_ROOT}/deisctl:${PATH}" 73 fi 74 }