Download IR workspace from a URL before importing it

Change-Id: I82aa2c5b779b18291b87ee9dee6ba44179466ef4
This commit is contained in:
Federico Ressi 2020-03-11 14:15:50 +01:00
parent 447231ef0a
commit f53cf0f1cb
1 changed files with 14 additions and 1 deletions

View File

@ -16,7 +16,9 @@ IR_SOURCE_DIR=$(realpath "${IR_SOURCE_DIR:-${IR_VIRTUAL_ENV}/infrared}")
IR_EXECUTABLE=${IR_VIRTUAL_ENV}/bin/infrared
export IR_HOME=$(realpath ${IR_HOME:-$(pwd)/.infrared/})
IR_TOBIKO_PLUGIN=$(realpath ${IR_TOBIKO_PLUGIN:-$(pwd)/roles/infrared})
IR_WORKSPACE_FILE=${IR_WORKSPACE_FILE:-$(realpath ./workspace.tgz)}
IR_WORKSPACE_URL=${IR_WORKSPACE_URL:-}
function ir {
@ -38,12 +40,23 @@ function ir_setup {
pip install --upgrade "${package_name}"
done
# Cleanup IR workspaces
rm -fR "${IR_HOME}"
(
# IR requires to work from its source folder
cd "${IR_SOURCE_DIR}"
# Install IR plugins
"${IR_EXECUTABLE}" plugin list --available --versions || true
"${IR_EXECUTABLE}" plugin remove tobiko || true
"${IR_EXECUTABLE}" plugin add "${IR_TOBIKO_PLUGIN}"
# Import IR workspace
if [ "${IR_WORKSPACE_URL}" != "" ]; then
local temp_file=$(mktemp)
curl "${IR_WORKSPACE_URL}" -o "${temp_file}"
mkdir -p $(dirname "${IR_WORKSPACE_FILE}")
mv "${temp_file}" "${IR_WORKSPACE_FILE}"
fi
if [ -f "${IR_WORKSPACE_FILE}" ]; then
"${IR_EXECUTABLE}" workspace import "${IR_WORKSPACE_FILE}"
fi