2015-06-19 07:22:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
dir=$1
|
|
|
|
|
|
|
|
if [ ! "$dir" ]; then
|
|
|
|
echo "Usage: $0 /base/folder/to/docs"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-09-09 08:20:09 +02:00
|
|
|
#=== FUNCTION ================================================================
|
|
|
|
# NAME: checkout
|
|
|
|
# DESCRIPTION: Checks out a specific branch of a module into a folder. Not
|
|
|
|
# particular good for taking up space, but at the moment separate
|
|
|
|
# folders for each version we need will do.
|
|
|
|
#
|
|
|
|
# The master branch will checked out by default
|
|
|
|
# PARAMETERS:
|
2014-11-14 23:50:54 +01:00
|
|
|
# $1 - module path on github (e.g silverstripe/sapphire.git)
|
2012-09-09 08:20:09 +02:00
|
|
|
# $2 - branch name (e.g 3.0)
|
2014-11-14 23:50:54 +01:00
|
|
|
# $3 - module name (e.g sapphire)
|
2012-09-09 08:20:09 +02:00
|
|
|
#
|
|
|
|
#===============================================================================
|
|
|
|
# Parameters: github path
|
2014-11-14 23:50:54 +01:00
|
|
|
function checkout {
|
2015-06-19 07:22:44 +02:00
|
|
|
# Create dirs
|
|
|
|
if [ ! -d $dir/src ]; then
|
2014-11-14 23:50:54 +01:00
|
|
|
mkdir $dir/src
|
2012-09-09 08:20:09 +02:00
|
|
|
fi
|
|
|
|
|
2015-06-19 07:22:44 +02:00
|
|
|
if [ ! -d $dir/src/$2_$3 ]; then
|
|
|
|
echo "Cloning $1 branch $3"
|
|
|
|
cd $dir/src
|
|
|
|
git clone -b $3 --depth=100 git://github.com/$1 $dir/src/$2_$3 --quiet
|
2014-11-14 23:50:54 +01:00
|
|
|
else
|
2015-06-19 07:22:44 +02:00
|
|
|
echo "Updating $2 from branch $3"
|
|
|
|
cd $dir/src/$2_$3
|
|
|
|
git reset --hard -q
|
|
|
|
git fetch origin -q
|
|
|
|
git pull -q origin $3
|
2012-09-09 08:20:09 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-09 23:19:15 +01:00
|
|
|
# core
|
2014-12-10 03:58:56 +01:00
|
|
|
checkout 'silverstripe/silverstripe-framework.git' 'framework' 'master'
|
|
|
|
checkout 'silverstripe/silverstripe-framework.git' 'framework' '3'
|
2015-06-19 07:22:44 +02:00
|
|
|
checkout 'silverstripe/silverstripe-framework.git' 'framework' '3.2'
|
2014-12-10 03:58:56 +01:00
|
|
|
checkout 'silverstripe/silverstripe-framework.git' 'framework' '3.1'
|
2014-09-26 04:40:33 +02:00
|
|
|
checkout 'silverstripe/silverstripe-framework.git' 'framework' '3.0'
|
|
|
|
checkout 'silverstripe/silverstripe-framework.git' 'framework' '2.4'
|
2012-09-09 08:20:09 +02:00
|
|
|
|
2014-11-14 23:50:54 +01:00
|
|
|
echo "Done."
|