Skip to content

Instantly share code, notes, and snippets.

@eusonlito
Last active December 28, 2015 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eusonlito/7572462 to your computer and use it in GitHub Desktop.
Save eusonlito/7572462 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo ''
case "$1" in
'bootstrap')
alias="$1"
url='https://github.com/twbs/bootstrap/trunk/dist'
;;
'fontawesome'|'font-awesome')
alias="$1"
url='https://github.com/FortAwesome/Font-Awesome/trunk'
;;
'fancybox')
alias="$1"
url='https://github.com/fancyapps/fancyBox/trunk/source'
;;
'datatables')
alias="$1"
url='https://github.com/DataTables/DataTables/trunk/media'
;;
'')
echo 'Alias or git url are required'
echo ''
exit 1
;;
*)
alias="${1##*/}"
alias=`echo $alias | tr '[:upper:]' '[:lower:]'`
if [ "`echo $1 | grep '/trunk'`" == '' ]; then
url="$1/trunk"
else
url="$1"
fi
esac
if [ "`echo $url | grep 'https://'`" == '' ] || [ "$alias" == '' ]; then
echo 'Git url is no valid: '$url
echo ''
exit 1
fi
if [ "$2" != '' ]; then
folder="$2"
else
folder="$alias"
fi
if [ ! -d "$folder" ]; then
mkdir "$folder"
fi
cd "$folder"
svn export --force "$url" .
shopt -s extglob
case "$alias" in
'fontawesome'|'font-awesome')
find . -maxdepth 1 -a ! -name '\.' -a ! -name 'css' -a ! -name 'fonts' -exec rm -rf '{}' \;
;;
'datatables')
rm -rf unit_testing
;;
*)
rm -rf .git*
;;
esac
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment