#!/bin/bash

function assert_success() {
    "${@}"
    local status=${?}
    if [ ${status} -ne 0 ]; then
        send_notification "### Error ${status} at: ${BASH_LINENO[*]} ###"
        exit ${status}
    fi
}

rootPath="`pwd`"
localPath="$rootPath/local/"

mkdir "$localPath"
assert_success cd "$localPath"

assert_success git clone https://github.com/uikit/uikit.git
assert_success cd uikit
assert_success git checkout 4f815b6482fb93c98452c857b7a9a1450fecd660 # https://github.com/uikit/uikit/releases/tag/v3.11.1
assert_success cd -

assert_success cp -r "uikit/dist" "uikit/build" "uikit/tests" "$rootPath/client/uikit/"
assert_success cd "$rootPath"

rm -rf "$localPath/uikit"
