#!/bin/bash

HERE=$(cd "$(dirname $0)" && pwd)
REPO_NAME=origin

{{#each apps}}
echo
echo Checkout app {{name}} from {{tag}} tag...
if [ ! -d ${HERE}/{{name}}/.git ]
then
    {{#if tag}}git clone  {{repo}} ${HERE}/{{name}}{{/if}}
fi
cd ${HERE}/{{name}}
git fetch --all
git reset --hard HEAD
git clean -f
git checkout {{tag}}
{{/each}}

