This commit is contained in:
Dennis Eichhorn 2015-12-18 17:39:39 +01:00
parent f3893b123f
commit 290da9ebf4
7 changed files with 157 additions and 89 deletions

26
build_dev.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Include vars
. var.sh
# Creating release path
rm -r -f ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
mkdir -p ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
# Copying source files
cp -R ${ROOT_PATH}/Admin/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/External/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/phpOMS/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Modules/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Model/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/cssOMS/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Web/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Socket/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Console/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/jsOMS/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
# Removing none dev files
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Dev -name "*.css" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Dev -name "*.min.js" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Dev -name "private.php" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Dev -name "private.sh" -type f -delete

1
build_frontend.sh Normal file
View File

@ -0,0 +1 @@
#!/bin/bash

View File

@ -1,60 +1,60 @@
#!/bin/bash
# Include private
# Include vars
. var.sh
# Removing unnecessary attribute quotes (only for end user release not for dev release)
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(name=")([a-zA-Z0-9\-\_]*)(")/name=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(for=")([a-zA-Z0-9\-\_]*)(")/for=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(id=")([a-zA-Z0-9\-\_]*)(")/id=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(class=")([a-zA-Z0-9\-\_]*)(")/class=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(min=")([a-zA-Z0-9\-\_]*)(")/min=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(min=")([a-zA-Z0-9\-\_]*)(")/min=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(max=")([a-zA-Z0-9\-\_]*)(")/max=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(type=")([a-zA-Z0-9\-\_]*)(")/type=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(role=")([a-zA-Z0-9\-\_]*)(")/role=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(method=")(.*)(")/method=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(action=")(.*)(")/action=\2/g'
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/(href=")(.*)(")/href=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(name=")([a-zA-Z0-9\-\_]*)(")/name=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(for=")([a-zA-Z0-9\-\_]*)(")/for=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(id=")([a-zA-Z0-9\-\_]*)(")/id=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(class=")([a-zA-Z0-9\-\_]*)(")/class=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(min=")([a-zA-Z0-9\-\_]*)(")/min=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(min=")([a-zA-Z0-9\-\_]*)(")/min=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(max=")([a-zA-Z0-9\-\_]*)(")/max=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(type=")([a-zA-Z0-9\-\_]*)(")/type=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(role=")([a-zA-Z0-9\-\_]*)(")/role=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(method=")(.*)(")/method=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(action=")(.*)(")/action=\2/g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/(href=")(.*)(")/href=\2/g'
# Removing unnecessary whitespace
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e 's/ */ /g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e 's/ */ /g'
# Removing unnecessary newline
find $ROOT_PATH -name "*tpl.php" | xargs -L1 sed -i -e ':a;N;$!ba;s/\n/ /g'
find ${ROOT_PATH} -name "*tpl.php" | xargs -L1 sed -i -e ':a;N;$!ba;s/\n/ /g'
# Removing comments
find $ROOT_PATH -name "*tpl.php" | sed -e :a -re 's/<!--.*?-->//g;/<!--/N;//ba'
find ${ROOT_PATH} -name "*tpl.php" | sed -e :a -re 's/<!--.*?-->//g;/<!--/N;//ba'
# Creating release path
rm -r -f $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
mkdir -p $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
mkdir -p $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH/jsOMS
mkdir -p $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH/jsOMS/Utils
rm -r -f ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
mkdir -p ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
mkdir -p ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public/jsOMS
mkdir -p ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public/jsOMS/Utils
# Copying built files
cp -R $ROOT_PATH/Admin/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/External/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/phpOMS/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/Modules/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/Model/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/cssOMS/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/Web/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/Socket/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp -R $ROOT_PATH/Console/ $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH
cp $ROOT_PATH/jsOMS/oms.min.js $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH/jsOMS
cp $ROOT_PATH/jsOMS/Utils/oLib.min.js $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH/jsOMS/Utils
cp -R ${ROOT_PATH}/Admin/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/External/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/phpOMS/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Modules/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Model/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/cssOMS/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Web/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Socket/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp -R ${ROOT_PATH}/Console/ ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public
cp ${ROOT_PATH}/jsOMS/oms.min.js ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public/jsOMS
cp ${ROOT_PATH}/jsOMS/Utils/oLib.min.js ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public/jsOMS/Utils
# Removing dev files
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.scss" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.psd" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.yml" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.gitignore" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.jscsrc" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.php_cs" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "*.sh" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "composer.json" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "GruntFile.js" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "koala-config.json" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "package.json" -type f -delete
find $ROOT_PATH/$RELEASE_PATH/Public/$VERSION_HASH -name "private.php" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.scss" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.psd" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.yml" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.gitignore" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.jscsrc" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.php_cs" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "*.sh" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "composer.json" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "GruntFile.js" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "koala-config.json" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "package.json" -type f -delete
find ${ROOT_PATH}/${RELEASE_PATH}/${VERSION_HASH}/Public -name "private.php" -type f -delete

11
demo.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
. var.sh
. ${ROOT_PATH}/private.sh
# Setting up database for demo and testing
mysql -e 'drop database if exists oms;' -u root -p${DB_PASSWORD}
mysql -e 'create database oms;' -u root -p${DB_PASSWORD}
#echo "USE mysql;\nUPDATE user SET password=PASSWORD('123456') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
curl --connect-timeout 600 --max-time 601 ${WEB_URL}/Admin/Install

View File

@ -2,71 +2,67 @@
# Include private
. var.sh
. $ROOT_PATH/private.sh
. ${ROOT_PATH}/private.sh
# Previous cleanup
rm -r -f $ROOT_PATH/$BUILD_PATH/logs
rm -r -f $ROOT_PATH/$BUILD_PATH/stats
rm -r -f $ROOT_PATH/$BUILD_PATH/docs
rm -r -f ${ROOT_PATH}/${BUILD_PATH}/logs
rm -r -f ${ROOT_PATH}/${BUILD_PATH}/stats
rm -r -f ${ROOT_PATH}/${BUILD_PATH}/docs
# Creating directories
mkdir -p $ROOT_PATH/$BUILD_PATH/logs
mkdir -p $ROOT_PATH/$BUILD_PATH/stats >> $ROOT_PATH/$BUILD_PATH/logs/build.log
mkdir -p $ROOT_PATH/$BUILD_PATH/docs >> $ROOT_PATH/$BUILD_PATH/logs/build.log
mkdir -p ${ROOT_PATH}/${BUILD_PATH}/logs
mkdir -p ${ROOT_PATH}/${BUILD_PATH}/stats >> ${ROOT_PATH}/${BUILD_PATH}/logs/build.log
mkdir -p ${ROOT_PATH}/${BUILD_PATH}/docs >> ${ROOT_PATH}/${BUILD_PATH}/logs/build.log
# Handling git
cd $ROOT_PATH && git fetch --all && git reset --hard origin/$GIT_BRANCH && git pull >> $ROOT_PATH/$BUILD_PATH/logs/build.log
cd ${ROOT_PATH} && git fetch --all && git reset --hard origin/${GIT_BRANCH} && git pull >> ${ROOT_PATH}/${BUILD_PATH}/logs/build.log
# Setting up database for demo and testing
mysql -e 'drop database if exists oms;' -u root -p$DB_PASSWORD
mysql -e 'create database oms;' -u root -p$DB_PASSWORD
#echo "USE mysql;\nUPDATE user SET password=PASSWORD('123456') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
# Permission handling
chmod -R 777 ${ROOT_PATH}
curl --connect-timeout 600 --max-time 601 $WEB_URL/Admin/Install
# Change path for correct script inclusion
cd ${ROOT_PATH}/${BUILD_PATH}
# Downloading tools
wget -nc https://phar.phpunit.de/phploc.phar
wget -nc https://phar.phpunit.de/phpunit.phar
wget -nc https://github.com/Halleck45/PhpMetrics/raw/master/build/phpmetrics.phar
wget -nc http://phpdoc.org/phpDocumentor.phar
wget -nc http://static.pdepend.org/php/latest/pdepend.phar
wget -nc https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
wget -nc http://static.phpmd.org/php/latest/phpmd.phar
wget -nc https://phar.phpunit.de/phpcpd.phar
# Setting up demo
. ${BUILD_PATH}/demo.sh
# Installing tools
. ${BUILD_PATH}/install.sh
# Executing unit tests
php $ROOT_PATH/phpunit.phar --configuration $ROOT_PATH/$TEST_PATH/PHPUnit/phpunit_default.xml --coverage-text --coverage-clover $ROOT_PATH/$BUILD_PATH/logs/clover.xml > $ROOT_PATH/$BUILD_PATH/logs/phpunit.log
php ${ROOT_PATH}/phpunit.phar --configuration ${ROOT_PATH}/${TEST_PATH}/PHPUnit/phpunit_default.xml --coverage-text --coverage-clover ${ROOT_PATH}/${BUILD_PATH}/logs/clover.xml > ${ROOT_PATH}/${BUILD_PATH}/logs/phpunit.log
# Stats & metrics
php $ROOT_PATH/phploc.phar $ROOT_PATH/phpOMS/ > $ROOT_PATH/$BUILD_PATH/stats/phpOMS.log
php $ROOT_PATH/phploc.phar $ROOT_PATH/Modules/ > $ROOT_PATH/$BUILD_PATH/stats/ModulesStats.log
php ${ROOT_PATH}/phploc.phar ${ROOT_PATH}/phpOMS/ > ${ROOT_PATH}/${BUILD_PATH}/stats/phpOMS.log
php ${ROOT_PATH}/phploc.phar ${ROOT_PATH}/Modules/ > ${ROOT_PATH}/${BUILD_PATH}/stats/ModulesStats.log
php $ROOT_PATH/phpmetrics.phar --report-html=$ROOT_PATH/$BUILD_PATH/stats/ReportFramework.html $ROOT_PATH/phpOMS/ >> $ROOT_PATH/$BUILD_PATH/logs/build.log
php $ROOT_PATH/phpmetrics.phar --report-html=$ROOT_PATH/$BUILD_PATH/stats/ReportModules.html $ROOT_PATH/Modules/ >> $ROOT_PATH/$BUILD_PATH/logs/build.log
php ${ROOT_PATH}/phpmetrics.phar --report-html=${ROOT_PATH}/${BUILD_PATH}/stats/ReportFramework.html ${ROOT_PATH}/phpOMS/ >> ${ROOT_PATH}/${BUILD_PATH}/logs/build.log
php ${ROOT_PATH}/phpmetrics.phar --report-html=${ROOT_PATH}/${BUILD_PATH}/stats/ReportModules.html ${ROOT_PATH}/Modules/ >> ${ROOT_PATH}/${BUILD_PATH}/logs/build.log
php $ROOT_PATH/pdepend.phar --summary-xml=$ROOT_PATH/$BUILD_PATH/stats/phpOMSSummary.xml --jdepend-chart=$ROOT_PATH/$BUILD_PATH/stats/phpOMSDepend.svg --overview-pyramid=$ROOT_PATH/$BUILD_PATH/stats/phpOMSPryramid.svg $ROOT_PATH/phpOMS
php $ROOT_PATH/pdepend.phar --summary-xml=$ROOT_PATH/$BUILD_PATH/stats/modulesSummary.xml --jdepend-chart=$ROOT_PATH/$BUILD_PATH/stats/modulesDepend.svg --overview-pyramid=$ROOT_PATH/$BUILD_PATH/stats/modulesPyramid.svg $ROOT_PATH/Modules
php ${ROOT_PATH}/pdepend.phar --summary-xml=${ROOT_PATH}/${BUILD_PATH}/stats/phpOMSSummary.xml --jdepend-chart=${ROOT_PATH}/${BUILD_PATH}/stats/phpOMSDepend.svg --overview-pyramid=${ROOT_PATH}/${BUILD_PATH}/stats/phpOMSPryramid.svg ${ROOT_PATH}/phpOMS
php ${ROOT_PATH}/pdepend.phar --summary-xml=${ROOT_PATH}/${BUILD_PATH}/stats/modulesSummary.xml --jdepend-chart=${ROOT_PATH}/${BUILD_PATH}/stats/modulesDepend.svg --overview-pyramid=${ROOT_PATH}/${BUILD_PATH}/stats/modulesPyramid.svg ${ROOT_PATH}/Modules
# Documentation
php $ROOT_PATH/phpDocumentor.phar -d $ROOT_PATH --ignore "*/phpOMS/Localization/*" -t $ROOT_PATH/$BUILD_PATH/docs
php ${ROOT_PATH}/phpDocumentor.phar -d ${ROOT_PATH} --ignore "*/phpOMS/Localization/*" -t ${ROOT_PATH}/${BUILD_PATH}/docs
# Local inspection
php phpcs.phar --report-file=$ROOT_PATH/$BUILD_PATH/logs/phpcsFramework.log --ignore=$ROOT_PATH/phpOMS/Localization --standard=$ROOT_PATH/$BUILD_PATH/phpcs.xml $ROOT_PATH/phpOMS
php phpcs.phar --report-file=$ROOT_PATH/$BUILD_PATH/logs/phpcsModules.log --standard=$ROOT_PATH/$BUILD_PATH/phpcs.xml $ROOT_PATH/Modules
#php phpmd.phar $ROOT_PATH/phpOMS xml $ROOT_PATH/$BUILD_PATH/phpmd.xml --reportfile $ROOT_PATH/$BUILD_PATH/logs/phpmdFramework.log -- bzip missing
#php phpmd.phar $ROOT_PATH/Modules xml $ROOT_PATH/$BUILD_PATH/phpmd.xml --reportfile $ROOT_PATH/$BUILD_PATH/logs/phpmdModules.log -- bzip missing
php phpcpd.phar $ROOT_PATH/phpOMS --exclude Localization --no-interaction > $ROOT_PATH/$BUILD_PATH/logs/phpcpdFramework.log
php phpcpd.phar $ROOT_PATH/Modules --no-interaction > $ROOT_PATH/$BUILD_PATH/logs/phpcpdModules.log
php phpcs.phar --report-file=${ROOT_PATH}/${BUILD_PATH}/logs/phpcsFramework.log --ignore=${ROOT_PATH}/phpOMS/Localization --standard=${ROOT_PATH}/${BUILD_PATH}/phpcs.xml ${ROOT_PATH}/phpOMS
php phpcs.phar --report-file=${ROOT_PATH}/${BUILD_PATH}/logs/phpcsModules.log --standard=${ROOT_PATH}/${BUILD_PATH}/phpcs.xml ${ROOT_PATH}/Modules
#php phpmd.phar ${ROOT_PATH}/phpOMS xml ${ROOT_PATH}/${BUILD_PATH}/phpmd.xml --reportfile ${ROOT_PATH}/${BUILD_PATH}/logs/phpmdFramework.log -- bzip missing
#php phpmd.phar ${ROOT_PATH}/Modules xml ${ROOT_PATH}/${BUILD_PATH}/phpmd.xml --reportfile ${ROOT_PATH}/${BUILD_PATH}/logs/phpmdModules.log -- bzip missing
php phpcpd.phar ${ROOT_PATH}/phpOMS --exclude Localization --no-interaction > ${ROOT_PATH}/${BUILD_PATH}/logs/phpcpdFramework.log
php phpcpd.phar ${ROOT_PATH}/Modules --no-interaction > ${ROOT_PATH}/${BUILD_PATH}/logs/phpcpdModules.log
# Linting
find $ROOT_PATH/phpOMS -name "*.php" | xargs -L1 php -l > $ROOT_PATH/$BUILD_PATH/logs/temp.log
sed '/^No syntax.*/ d' < $ROOT_PATH/$BUILD_PATH/temp.log > $ROOT_PATH/$BUILD_PATH/logs/phpLintFramework.log
find $ROOT_PATH/Modules -name "*.php" | xargs -L1 php -l > $ROOT_PATH/$BUILD_PATH/logs/temp.log
sed '/^No syntax.*/ d' < $ROOT_PATH/$BUILD_PATH/temp.log > $ROOT_PATH/$BUILD_PATH/logs/phpLintModules.log
rm $ROOT_PATH/$BUILD_PATH/logs/temp.log
find ${ROOT_PATH}/phpOMS -name "*.php" | xargs -L1 php -l > ${ROOT_PATH}/${BUILD_PATH}/logs/temp.log
sed '/^No syntax.*/ d' < ${ROOT_PATH}/${BUILD_PATH}/logs/temp.log > ${ROOT_PATH}/${BUILD_PATH}/logs/phpLintFramework.log
find ${ROOT_PATH}/Modules -name "*.php" | xargs -L1 php -l > ${ROOT_PATH}/${BUILD_PATH}/logs/temp.log
sed '/^No syntax.*/ d' < ${ROOT_PATH}/${BUILD_PATH}/logs/temp.log > ${ROOT_PATH}/${BUILD_PATH}/logs/phpLintModules.log
rm ${ROOT_PATH}/${BUILD_PATH}/logs/temp.log
find ${ROOT_PATH} -name "*.json" | xargs -L1 jsonlint -q > ${ROOT_PATH}/${BUILD_PATH}/logs/jsonLint.log
# External inspection and build
curl -H "Content-Type: application/json" -X POST -d '{"branch":"$GIT_BRANCH","access_token":"$SCRUTINIZER_TOKEN"}' https://scrutinizer-ci.com/api/repositories/g/spl1nes/oms/inspections?access_token=$SCRUTINIZER_TOKEN
#curl -H "Content-Type: application/json" -X POST -d '{"branch":"$GIT_BRANCH","access_token":"$SCRUTINIZER_TOKEN"}' https://scrutinizer-ci.com/api/repositories/g/spl1nes/oms/inspections?access_token=${SCRUTINIZER_TOKEN}
#curl --get --data api_token=$CODECLIMATE_TOKEN https://codeclimate.com/api/repos/oms/branches/$GIT_BRANCH/refresh -- Coming in the future... right now not available for free
#curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $TRAVIS_TOKEN" -d '{"request": {"branch":"$GIT_BRANCH"}}' https://api.travis-ci.org/repo/spl1nes%2FOrange-Management/requests
@ -96,10 +92,10 @@ TAG[18]="<embed.*\/>"
for i in "${TAG[@]}"
do
echo "\nInsepcting $i:\n" >> $ROOT_PATH/$BUILD_PATH/logs/htmlinspection.log
grep -rln "$i" --include \*.tpl.php $ROOT_PATH/phpOMS >> $ROOT_PATH/$BUILD_PATH/logs/htmlinspection.log
grep -rln "$i" --include \*.tpl.php $ROOT_PATH/Modules >> $ROOT_PATH/$BUILD_PATH/logs/htmlinspection.log
echo "\nInsepcting $i:\n" >> ${ROOT_PATH}/${BUILD_PATH}/logs/htmlinspection.log
grep -rln "$i" --include \*.tpl.php ${ROOT_PATH}/phpOMS >> ${ROOT_PATH}/${BUILD_PATH}/logs/htmlinspection.log
grep -rln "$i" --include \*.tpl.php ${ROOT_PATH}/Modules >> ${ROOT_PATH}/${BUILD_PATH}/logs/htmlinspection.log
done
# Find empty attributes
grep -rln "=\"\"" --include \*.tpl.php $ROOT_PATH > $ROOT_PATH/$BUILD_PATH/logs/unusedattributes.log
grep -rln "=\"\"" --include \*.tpl.php ${ROOT_PATH} > ${ROOT_PATH}/${BUILD_PATH}/logs/unusedattributes.log

16
install.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Downloading tools
wget -nc https://phar.phpunit.de/phploc.phar
wget -nc https://phar.phpunit.de/phpunit.phar
wget -nc https://github.com/Halleck45/PhpMetrics/raw/master/build/phpmetrics.phar
wget -nc http://phpdoc.org/phpDocumentor.phar
wget -nc http://static.pdepend.org/php/latest/pdepend.phar
wget -nc https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
wget -nc http://static.phpmd.org/php/latest/phpmd.phar
wget -nc https://phar.phpunit.de/phpcpd.phar
wget -nc http://dl.google.com/closure-compiler/compiler-latest.tar.gz
tar -zxvf compiler-latest.tar.gz
# Installing tools
[[ $(jsonlint -h) != *"Usage: jsonlint"* ]] && npm install jsonlint -g

18
watcher.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
DIRECTORY_TO_OBSERVE="cssOMS jsOMS"
function watcher {
inotifywait -r -e modify,move,create,delete \
--exclude ".*(\.css|\.php|\.json|\.md|\.sh|\.txt|\.log|\.min\.js)" \
${DIRECTORY_TO_OBSERVE}
}
BUILD_SCRIPT=build_frontend.sh
function build {
bash ${BUILD_SCRIPT}
}
build
while watcher; do
build
done