From e02dec546014368482062b914244f1396ec19936 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 30 Dec 2015 22:33:19 +0100 Subject: [PATCH] Implemented the gulp build task. --- gulpfile.js | 26 ++++++++++++++++++++++---- package.json | 4 +++- package.sh | 23 ----------------------- 3 files changed, 25 insertions(+), 28 deletions(-) delete mode 100644 package.sh diff --git a/gulpfile.js b/gulpfile.js index 443c7047..1f9df9ec 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,8 @@ var gulp = require('gulp'), exec = require('child_process').execSync, - del = require('del'); + del = require('del'), + fs = require('fs-extra'), + zip = require('zip-dir'); /** * Install and copy the required files from the "composer" directory. @@ -25,8 +27,7 @@ gulp.task('composer', function() { '!composer/**/demo{,/**}', '!composer/**/{demo,docs,examples,test,extras,language}{,/**}', '!composer/**/{composer.json,composer.lock,.gitignore}', - '!composer/**/*.yml', - '!composer/**/*.md' + '!composer/**/{*.yml,*.md}' ]) .pipe(gulp.dest('./src/application/third_party/')); }); @@ -34,8 +35,25 @@ gulp.task('composer', function() { /** * Build the project and create an easyappointments.zip file ready for distribution. */ -gulp.task('build', function() { +gulp.task('build', function(done) { + del.sync([ + '.tmp-package', + 'easyappointments.zip' + ]); + fs.copySync('src', '.tmp-package'); + fs.copySync('.tmp-package/config-sample.php', '.tmp-package/config.php'); + fs.removeSync('.tmp-package/config-sample.php'); + fs.copySync('CHANGELOG.md', '.tmp-package/CHANGELOG.md'); + fs.copySync('README.md', '.tmp-package/README.md'); + fs.copySync('LICENSE', '.tmp-package/LICENSE'); + + zip('.tmp-package', { saveTo: 'easyappointments.zip' }, function (err, buffer) { + if (err) + console.log('Zip Error', err); + + done(); + }); }); /** diff --git a/package.json b/package.json index e456a403..e73860dd 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,11 @@ "homepage": "http://easyappointments.org", "devDependencies": { "del": "^2.2.0", + "fs-extra": "^0.26.3", "gulp": "^3.9.0", "jsdoc": "^3.3.2", - "plato": "^1.5.0" + "plato": "^1.5.0", + "zip-dir": "^1.0.0" }, "engines": { "node": ">=0.12" diff --git a/package.sh b/package.sh deleted file mode 100644 index 829202ce..00000000 --- a/package.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# -# Bash script for the creation of the easyappointments.zip -# - -clear - -rm -f easyappointments.zip -rm -rf .tmp-package/** - -mkdir .tmp-package -cp -rf src/** .tmp-package -rm -f .tmp-package/config.php -mv -f .tmp-package/config-sample.php .tmp-package/config.php -cp CHANGELOG.md .tmp-package/CHANGELOG.md -cp LICENSE .tmp-package/LICENSE -cp README.md .tmp-package/README.md - -cd .tmp-package -zip -r ../easyappointments.zip ./* -cd .. -rm -rf .tmp-package \ No newline at end of file