Last active
June 6, 2018 13:11
-
-
Save runningnet/8cb46552deef21b92d07d0ab133fdf85 to your computer and use it in GitHub Desktop.
Typo3 Shell Deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#Gibt den Ordner für das Git an | |
DIR=/root/projekt/ | |
quelle="${DIR}"app/web/ | |
#Gibt den Default Webroot Ordner an | |
ziel=/var/www/live/htdocs/ | |
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
NOW=$(date +"%Y-%m-%d:%H:%M:%S") | |
DELLOGFILE="deletetfiles-$NOW.log" | |
PUBLICLESS="typo3conf/ext/theme/Resources/Public/Less/" | |
PUBLICCSS="typo3conf/ext/theme/Resources/Public/Css/" | |
printf "Welche Seite möchtest du bespielen ? dev,test,live? \nund mit welchen Branch?\n \n" | |
read -p "(default: dev develop): " deploy branch | |
case "$deploy" in | |
dev) | |
ziel=/var/www/dev/htdocs/ | |
gitversion=feature/ok_updatelivecode | |
;; | |
test) | |
ziel=/var/www/test/htdocs/ | |
gitversion=develop | |
;; | |
live) | |
ziel=/var/www/live/htdocs/ | |
gitversion=master | |
;; | |
*) | |
ziel=/var/www/dev/htdocs/ | |
gitversion=develop | |
;; | |
esac | |
if [ ! -z $branch ] | |
then | |
gitversion=$branch | |
fi | |
echo "Take GIT: ${gitversion}" | |
if [ -d "$ziel" ] && [ -d "$quelle" ]; | |
then | |
# Will enter here if $DIRECTORY exists, even if it contains spaces | |
cd $DIR | |
printf "Checkout Git ${RED}${gitversion}${NC}\n" | |
git fetch --all --tags --prune | |
git checkout ${gitversion} | |
git pull | |
echo Checkout Done | |
echo Generate main.js | |
cd ${DIR}/app | |
nodejs Build/jsmerge.js | |
# npm install -g uglify-js | |
/usr/bin/uglifyjs -o ${quelle}typo3conf/ext/theme/Resources/Public/Js/main.min.js ${quelle}typo3conf/ext/theme/Resources/Public/Js/main.js | |
echo Done | |
echo Genrate CSS | |
/usr/bin/lessc --source-map -source-map-basepath=${quelle}${PUBLICLESS} --source-map-rootpath=/${PUBLICLESS} --no-color ${quelle}${PUBLICLESS}Theme/theme.less ${quelle}${PUBLICCSS}main.css | |
/usr/bin/yui-compressor --type css -o ${quelle}${PUBLICCSS}main.min.css ${quelle}${PUBLICCSS}main.css | |
echo Generate No Animations CSS | |
/usr/bin/lessc --source-map -source-map-basepath=${quelle}${PUBLICLESS} --source-map-rootpath=/${PUBLICLESS} --no-color ${quelle}${PUBLICLESS}Theme/theme-no-animations.less ${quelle}${PUBLICCSS}main-na.css | |
/usr/bin/yui-compressor --type css -o ${quelle}${PUBLICCSS}main-na.min.css ${quelle}${PUBLICCSS}main-na.css | |
echo Generate Accessibility CSS | |
/usr/bin/lessc --source-map -source-map-basepath=${quelle}${PUBLICLESS} --source-map-rootpath=/${PUBLICLESS} --no-color ${quelle}${PUBLICLESS}Theme/theme_accessibility-contrast-wb.less ${quelle}${PUBLICCSS}main_accessibility-contrast-wb.css | |
/usr/bin/yui-compressor --type css -o ${quelle}${PUBLICCSS}main_accessibility-contrast-wb.min.css ${quelle}${PUBLICCSS}main_accessibility-contrast-wb.css | |
/usr/bin/lessc --source-map -source-map-basepath=${quelle}${PUBLICLESS} --source-map-rootpath=/${PUBLICLESS} --no-color ${quelle}${PUBLICLESS}Theme/theme_accessibility-contrast-yb.less ${quelle}${PUBLICCSS}main_accessibility-contrast-yb.css | |
/usr/bin/yui-compressor --type css -o ${quelle}${PUBLICCSS}main_accessibility-contrast-yb.min.css ${quelle}${PUBLICCSS}main_accessibility-contrast-yb.css | |
echo Generate No Animations Accessibility CSS | |
/usr/bin/lessc --source-map -source-map-basepath=${quelle}${PUBLICLESS} --source-map-rootpath=/${PUBLICLESS} --no-color ${quelle}${PUBLICLESS}Theme/theme_no_animations_accessibility-contrast-wb.less ${quelle}${PUBLICCSS}main_na_accessibility-contrast-wb.css | |
/usr/bin/yui-compressor --type css -o ${quelle}${PUBLICCSS}main_na_accessibility-contrast-wb.min.css ${quelle}${PUBLICCSS}main_na_accessibility-contrast-wb.css | |
/usr/bin/lessc --source-map -source-map-basepath=${quelle}${PUBLICLESS} --source-map-rootpath=/${PUBLICLESS} --no-color ${quelle}${PUBLICLESS}Theme/theme_no_animations_accessibility-contrast-yb.less ${quelle}${PUBLICCSS}main_na_accessibility-contrast-yb.css | |
/usr/bin/yui-compressor --type css -o ${quelle}${PUBLICCSS}main_na_accessibility-contrast-yb.min.css ${quelle}${PUBLICCSS}main_na_accessibility-contrast-yb.css | |
echo Done | |
echo Sync Files | |
printf "Only Sync Files in ${RED}typo3conf${NC} Copy files from ${RED}Webroot${NC} by our self\n${RED}" | |
rsync -avc --exclude-from "${DIR}"rsync-exclude.txt --delete "${quelle}"typo3conf/ "${ziel}"typo3conf/ |grep "^deleting " | |
printf "${NC}" | |
echo Done | |
echo Lösche Typo3Temp | |
rm -rf ${ziel}typo3temp/Cache/* | |
rm -rf ${ziel}typo3temp/autoload/ | |
echo Update Userrights | |
chown -R www-data:www-data ${ziel} | |
echo Done | |
else | |
printf "Folders Not found ${RED}${ziel} or ${quelle} ${NC}\n" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by ok on 21.11.16. | |
*/ | |
//Requier | |
var _cli = require('commander'), | |
_jshint = require('jshint'), | |
_fs = require('fs'); | |
//Paths | |
var jspath='web/typo3conf/ext/theme/Resources/Private/Js/'; | |
var jspathLib=jspath+'00-Libs/'; | |
var jspathDist=jspath+'Dist/'; | |
var jspathsrc=jspath+'Src/'; | |
//Functions | |
function concat(opts) { | |
var fileList = opts.src; | |
var distPath = opts.dest; | |
var out = fileList.map(function(filePath){ | |
return _fs.readFileSync(filePath).toString(); | |
}); | |
_fs.writeFileSync(distPath, out.join('\n')); | |
console.log(' '+ distPath +' built.'); | |
} | |
function lint(path, callback) { | |
var buf = _fs.readFileSync(path, 'utf-8'); | |
// remove Byte Order Mark | |
buf = buf.replace(/^\uFEFF/, ''); | |
_jshint.JSHINT(buf); | |
var nErrors = _jshint.JSHINT.errors.length; | |
if (nErrors) { | |
console.log(' Found %j lint errors on %s, do you want to continue?', nErrors, path); | |
} else if (callback) { | |
callback(); | |
} | |
} | |
// run | |
//lint( jspath+'main.js', function(){ | |
// console.log('Lint test i-kiu Done '); | |
//}); | |
// Achtung auf die Reihung der Files | |
concat({ | |
src : [ | |
jspathLib+'bootstrap.min.js', | |
jspathLib+'hammer.min.js', | |
jspathLib+'modernizr-2.8.3.min.js', | |
jspathLib+'photoswipe.min.js', | |
jspathLib+'photoswipe-ui-default.min.js', | |
jspathLib+'jquery-jvectormap-2.0.3.min.js', | |
jspathLib+'jquery-jvectormap-at-merc.js', | |
jspathDist+'bootstrap.lightbox.min.js', | |
jspathDist+'bootstrap.navbartoggle.min.js', | |
jspathDist+'bootstrap.popover.min.js', | |
jspathDist+'bootstrap.swipe.min.js', | |
jspathDist+'jquery.equalheight.min.js', | |
jspathDist+'jquery.responsiveimages.min.js', | |
jspathDist+'windowsphone-viewportfix.min.js', | |
jspathDist+'jquery.flexslider.js', | |
jspath+'shuffle.js', | |
jspathDist+'jquery.jplayer.min.js', | |
jspath+'jquery.inputmask.bundle.js', | |
jspath+'ikdonation_eeanalytics.js', | |
jspath+'ikdonation_main.js', | |
jspath+ 'media_upload.js', | |
jspath+'parsley.js', | |
jspath+ 'jquery.datetimepicker.js', | |
jspath+ 'Form.js', | |
jspath+'ik-userProfile.js', | |
jspathsrc+'ikiu.trimtext.js', | |
jspath+'jquery.cookiebar.js', | |
jspath+'jquery.magnific-popup.min.js', | |
jspath+'i-kiu.js', | |
jspath+'jssocials.js', | |
jspath+'ikupload.js', | |
jspath+'wow.min.js', | |
jspath+'jquery.easing.min.js' | |
], | |
dest :'web/typo3conf/ext/theme/Resources/Public/Js/main.js'}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Hilfswerk-Deployment", | |
"version": "0.0.1", | |
"description": "Deployment Tool for i-kiu", | |
"main": "index.js", | |
"author": "Oliver Krammer <[email protected]> (http://www.i-kiu.at/)", | |
"license": "i-kiu", | |
"dependencies": { | |
"browserify": "latest", | |
"less": "latest" | |
}, | |
"devDependencies": { | |
"browserify": "latest", | |
"hashmark": "latest", | |
"http-server": "latest", | |
"jshint": "latest", | |
"karma": "latest", | |
"karma-browserify": "latest", | |
"karma-cli": "latest", | |
"karma-mocha": "latest", | |
"karma-phantomjs-launcher": "latest", | |
"live-reload": "latest", | |
"minifyify": "latest", | |
"mocha": "latest", | |
"nodemon": "latest", | |
"opener": "latest", | |
"parallelshell": "latest", | |
"stylus": "latest", | |
"shelljs": "latest", | |
"requirejs": "latest", | |
"commander": "latest", | |
"concat-cli":"latest" | |
}, | |
"scripts": { | |
"watch": "parallelshell \"npm run watch:css \" \" npm run watch:js\"", | |
"watch:css": "nodemon -q -w web/typo3conf/ext/theme/Resources/Private/Less/ --ext '.' --exec 'npm run build:css'", | |
"watch:js": "nodemon -q -w web/typo3conf/ext/theme/Resources/Private/Js/*.js --ext '.' --exec 'npm run build:js'", | |
"build": "npm run build:css && npm run build:js", | |
"build:css": "lessc 'web/typo3conf/ext/theme/Resources/Public/Less/Theme/theme.less' > web/typo3conf/ext/theme/Resources/Public/Css/main.css", | |
"postbuild:css":"scp web/typo3conf/ext/theme/Resources/Public/Css/main.css USER@SERVER:/var/www/dev/htdocs/typo3conf/ext/theme/Resources/Public/Css/main.css", | |
"build:js": "node Build/jsmerge.js", | |
"postbuild:js": "scp web/typo3conf/ext/theme/Resources/Public/Js/main.js USER@SERVER:/var/www/dev/htdocs/typo3conf/ext/theme/Resources/Public/Js/main.js", | |
"live:reload": "live-reload --port 9091 web/typo3conf/ext/theme/Resources/Public/Css/", | |
"open:prod": "opener http://prod.i-kiu.at", | |
"open:stage": "opener http://test.i-kiu.at", | |
"open:dev": "opener http://dev.i-kiu.at", | |
"dev": "npm run open:dev && parallelshell \"npm run live:reload \" \"npm run watch \"" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment