From 457e8fb6f97965f1c6ace6aeee40a573247981cd Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Thu, 28 Jan 2016 20:58:54 -0500 Subject: [PATCH] Moved build script into a Makefile --- .gitignore | 6 ++ .../Frameworks/Baikal/Scripts/package-flat.sh | 80 ------------------- .../Baikal/Scripts/package-regular.sh | 53 ------------ Makefile | 18 ++++- 4 files changed, 22 insertions(+), 135 deletions(-) delete mode 100755 Core/Frameworks/Baikal/Scripts/package-flat.sh delete mode 100755 Core/Frameworks/Baikal/Scripts/package-regular.sh diff --git a/.gitignore b/.gitignore index 91721df..e639446 100755 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,9 @@ Specific/virtualhosts/baikal.apache2 # Composer stuff composer.lock vendor + +# Build +/build + +# Vim +.*.swp diff --git a/Core/Frameworks/Baikal/Scripts/package-flat.sh b/Core/Frameworks/Baikal/Scripts/package-flat.sh deleted file mode 100755 index acf9649..0000000 --- a/Core/Frameworks/Baikal/Scripts/package-flat.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env sh -TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`" -TEMPDIR="/tmp/baikal-flat-$TEMPDATE-temp" -TEMPARCHIVE="$TEMPDIR/temparchive.tgz" -TEMPDIRDEREFERENCE="/tmp/baikal-flat-$TEMPDATE" - -echo "########################################################################" -echo "#" -echo "# Baïkal Packaging script" -echo "#" -echo "# Packaging project for flat distribution (replacing symlinks" -echo "# by their target). Useful for FTP deployment" -echo "#" -echo "# TEMPDIR: $TEMPDIR" - -rm -rf /tmp/baikal-flat - -# Export Project -# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all) - -mkdir $TEMPDIR && \ -git-archive-all --force-submodules $TEMPARCHIVE && \ -cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \ - -# Dereferencig symlinks -cp -RfL $TEMPDIR $TEMPDIRDEREFERENCE && \ -rm -Rf $TEMPDIR && \ - -TEMPDIR=$TEMPDIRDEREFERENCE/temparchive && \ - -# Jump to tempdir -cd $TEMPDIR && \ - -# Cleaning Resources -rm -f Core/Resources/Web/README.md && \ -rm -Rf Core/Resources/Web/TwitterBootstrap && \ - -# Cleaning Scripts -rm -Rf Core/Scripts && \ -rm -Rf Core/Frameworks/Baikal/Scripts && \ - -# Cleaning WWWRoot -rm -Rf Core/Frameworks/Baikal/WWWRoot && \ -rm -Rf Core/Frameworks/BaikalAdmin/WWWRoot && \ - -# Cleaning Specific/Virtualhosts -rm -Rf Specific/virtualhosts && \ - -# Installing dependencies (composer) -composer install && \ - -# Removing composer stuff -rm -f composer.* && \ - -# Moving HTML roots -mv html/* . && \ -mv html/.htaccess . && \ -rm -Rf html && \ - -# Tagging Distrib -cat Core/Distrib.php | sed -e "s/\"regular\"/\"flat\"/g" > Core/Distrib2.php && \ -rm -f Core/Distrib.php && \ -mv Core/Distrib2.php Core/Distrib.php && \ - -# Deploy empty DB -mkdir -p Specific/db && \ -cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \ - -# Add ENABLE_INSTALL - -touch Specific/ENABLE_INSTALL && \ - -# Zipping package -cd .. && \ -mv $TEMPDIR baikal-flat && \ -zip -r baikal-flat.zip baikal-flat && \ -mv baikal-flat.zip ~/Desktop/ && \ - -# Displaying result -echo "# Success: ~/Desktop/baikal-flat.zip" \ No newline at end of file diff --git a/Core/Frameworks/Baikal/Scripts/package-regular.sh b/Core/Frameworks/Baikal/Scripts/package-regular.sh deleted file mode 100755 index 36ac06b..0000000 --- a/Core/Frameworks/Baikal/Scripts/package-regular.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env sh -TEMPDATE="`date +%Y-%m-%d-%H-%M-%S`" -TEMPDIR="/tmp/baikal-regular-$TEMPDATE" -TEMPARCHIVE="$TEMPDIR/temparchive.tgz" - -echo "########################################################################" -echo "#" -echo "# Baïkal Packaging script" -echo "#" -echo "# Packaging project for regular distribution" -echo "#" -echo "# TEMPDIR: $TEMPDIR" - -rm -rf /tmp/baikal-regular - -# Export Project -# Requires the git-archive-all script by https://github.com/Kentzo (https://github.com/Kentzo/git-archive-all) - -mkdir -p $TEMPDIR && \ -git-archive-all --force-submodules $TEMPARCHIVE && \ -cd $TEMPDIR && tar -xzf $TEMPARCHIVE && rm $TEMPARCHIVE && \ - -TEMPDIR=$TEMPDIR/temparchive && \ - -# Jump to tempdir -cd $TEMPDIR && \ - -# Cleaning Scripts -rm -Rf Core/Scripts && \ -rm -Rf Core/Frameworks/Baikal/Scripts && \ - -# Deploy empty DB -mkdir -p Specific/db && \ -cp Core/Resources/Db/SQLite/db.sqlite Specific/db && \ - -# Add ENABLE_INSTALL - -touch Specific/ENABLE_INSTALL && \ - -# Installing dependencies (composer) -composer install && \ - -# Removing composer stuff -rm -f composer.* && \ - -# GZipping package -cd .. && \ -mv $TEMPDIR baikal-regular && \ -tar -cvzf baikal-regular.tgz baikal-regular && \ -mv baikal-regular.tgz ~/Desktop/ && \ - -# Displaying result -echo "# Success: ~/Desktop/baikal-regular.tgz" \ No newline at end of file diff --git a/Makefile b/Makefile index b63d44f..5799585 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,20 @@ -.PHONY: build-assets +.PHONY: build-assets dist clean +BUILD_DIR="build/baikal" + +BUILD_FILES=Core html Specific ChangeLog.md LICENSE.txt README.md composer.json + +VERSION=$(shell php -r "include 'Core/Distrib.php'; echo BAIKAL_VERSION;") + +dist: vendor/autoload.php + # Building Baikal $(VERSION) + rm -r $(BUILD_DIR) + mkdir -p $(BUILD_DIR) + cp -R $(BUILD_FILES) $(BUILD_DIR) + touch $(BUILD_DIR)/Specific/ENABLE_INSTALL + composer install -d $(BUILD_DIR) + rm $(BUILD_DIR)/composer.* + cd build; zip -r baikal-$(VERSION).zip baikal/ build-assets: vendor/autoload.php cat vendor/sabre/dav/examples/sql/mysql.*.sql > Core/Resources/Db/MySQL/db.sql @@ -10,4 +25,3 @@ vendor/autoload.php: composer.lock composer.lock: composer.json composer update -