mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
FIX: DRY update for managing documented module checkouts. (Fixes #2)
This commit is contained in:
parent
146c34ac7c
commit
5b2a11c23b
29
Makefile
29
Makefile
@ -1,24 +1,17 @@
|
||||
all:
|
||||
@echo "Available commands:"
|
||||
@grep "^[^#[:space:]].*:$$" Makefile
|
||||
|
||||
update:
|
||||
@echo "Cleaning up existing folders..";
|
||||
@if [ -d $(CURDIR)/src/sapphire_master ]; then rm -rf $(CURDIR)/src/sapphire_master; fi
|
||||
@make fetch
|
||||
@make index
|
||||
|
||||
@echo "Checking out SilverStripe (Framework)..";
|
||||
@if [ -d $(CURDIR)/src/framework ]; then cd $(CURDIR)/src/framework; git pull -q; else git clone --depth=100 -q git://github.com/silverstripe/sapphire.git $(CURDIR)/src/framework; fi
|
||||
fetch:
|
||||
@./bin/update.sh $(CURDIR)
|
||||
|
||||
@echo "-- master";
|
||||
@if [ -d $(CURDIR)/src/framework_master ]; then cd $(CURDIR)/src/framework_master; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_master; cd $(CURDIR)/src/framework_master; git pull -q; fi
|
||||
|
||||
@echo "-- 3.0";
|
||||
@if [ -d $(CURDIR)/src/framework_3.0 ]; then cd $(CURDIR)/src/framework_3.0; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_3.0; cd $(CURDIR)/src/framework_3.0; git pull -q; fi
|
||||
|
||||
@echo "-- 2.4";
|
||||
@if [ -d $(CURDIR)/src/framework_2.4 ]; then cd $(CURDIR)/src/framework_2.4; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_2.4; cd $(CURDIR)/src/framework_2.4; git pull -q; fi
|
||||
|
||||
@echo "-- 2.3";
|
||||
@if [ -d $(CURDIR)/src/framework_2.3 ]; then cd $(CURDIR)/src/framework_2.3; git pull -q; else cp -R $(CURDIR)/src/framework $(CURDIR)/src/framework_2.3; cd $(CURDIR)/src/framework_2.3; git pull -q; fi
|
||||
|
||||
@echo "Building index";
|
||||
@cd $(CURDIR); php framework/cli-script.php dev/tasks/RebuildLuceneDocsIndex flush=1
|
||||
index:
|
||||
@mkdir -p $(CURDIR)/silverstripe-cache/
|
||||
@php framework/cli-script.php dev/tasks/RebuildLuceneDocsIndex flush=1
|
||||
|
||||
test:
|
||||
$(MAKE) QUERYSTRING="$(QUERYSTRING)&SkipTests=RestfulServiceTest" -C sapphire test
|
||||
|
@ -1,9 +1,53 @@
|
||||
url='git@github.com:chillu/silverstripe-doc-restructuring.git'
|
||||
base=`dirname $0`
|
||||
if [ ! -d "$base/../src/github" ]; then
|
||||
mkdir $base/../src/
|
||||
git clone $url $base/../src/github
|
||||
dir=$1
|
||||
|
||||
if [ ! "$dir" ]; then
|
||||
echo "Usage: $0 /base/folder/to/docs"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $base/../src/github/
|
||||
git pull origin
|
||||
#=== 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:
|
||||
# $1 - module path on github (e.g silverstripe/sapphire.git)
|
||||
# $2 - branch name (e.g 3.0)
|
||||
# $3 - module name (e.g sapphire)
|
||||
#
|
||||
#===============================================================================
|
||||
# Parameters: github path
|
||||
function checkout {
|
||||
if [ ! -d $dir/src/$3 ]; then
|
||||
echo "Cloning $1 "
|
||||
cd $dir/src
|
||||
git clone --depth=100 -q git://github.com/$1 $3 --quiet
|
||||
cd $3
|
||||
git checkout master -q
|
||||
else
|
||||
cd $dir/src/$3
|
||||
git pull -q
|
||||
git checkout master -q
|
||||
fi
|
||||
|
||||
echo "Checking out $2 from $1 into $3_$2"
|
||||
|
||||
if [ -d $dir/src/$3_$2 ]; then
|
||||
cd $dir/src/$3_$2
|
||||
else
|
||||
cp -R $dir/src/$3 $dir/src/$3_$2
|
||||
cd $dir/src/$3_$2
|
||||
fi
|
||||
|
||||
git reset --hard -q
|
||||
git checkout $2 -q
|
||||
git pull -q
|
||||
}
|
||||
|
||||
checkout 'silverstripe/sapphire.git' '3.0' 'framework'
|
||||
checkout 'silverstripe/sapphire.git' '2.4' 'framework'
|
||||
checkout 'silverstripe/sapphire.git' '2.3' 'framework'
|
||||
|
||||
echo "Done."
|
Loading…
x
Reference in New Issue
Block a user