#!/bin/bash

# this is just a utility to pack composer packages without conflicting with the document root .git

DOCUMENT_ROOT="$( cd "$( dirname "$0" )" && pwd )"
PATHS[0]="$DOCUMENT_ROOT/vendor/chrisboulton/php-resque"
PATHS[1]="$DOCUMENT_ROOT/vendor/mtdowling/cron-expression"

for i in "${PATHS[@]}"
do
    if [ -d "$i" ]; then 
        printf "%s" "removing $i -> "
        rm -rf "$i"
        printf "%s\n" "done."
    fi
done

# update composer
composer self-update && composer update

# remove the .git
for i in "${PATHS[@]}"
do
    if [ -d "$i/.git" ]; then
        printf "%s" "removing $i/.git -> "
        rm -rf "$i/.git"
        printf "%s\n" "done."
    fi
done
