Moved build script into a Makefile

This commit is contained in:
Evert Pot 2016-01-28 20:58:54 -05:00
parent 2487da4406
commit 457e8fb6f9
4 changed files with 22 additions and 135 deletions

6
.gitignore vendored
View file

@ -10,3 +10,9 @@ Specific/virtualhosts/baikal.apache2
# Composer stuff # Composer stuff
composer.lock composer.lock
vendor vendor
# Build
/build
# Vim
.*.swp

View file

@ -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"

View file

@ -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"

View file

@ -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 build-assets: vendor/autoload.php
cat vendor/sabre/dav/examples/sql/mysql.*.sql > Core/Resources/Db/MySQL/db.sql 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.lock: composer.json
composer update composer update