Implemented the gulp build task.

This commit is contained in:
Alex Tselegidis 2015-12-30 22:33:19 +01:00
parent f935337ea1
commit e02dec5460
3 changed files with 25 additions and 28 deletions

View file

@ -1,6 +1,8 @@
var gulp = require('gulp'), var gulp = require('gulp'),
exec = require('child_process').execSync, 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. * Install and copy the required files from the "composer" directory.
@ -25,8 +27,7 @@ gulp.task('composer', function() {
'!composer/**/demo{,/**}', '!composer/**/demo{,/**}',
'!composer/**/{demo,docs,examples,test,extras,language}{,/**}', '!composer/**/{demo,docs,examples,test,extras,language}{,/**}',
'!composer/**/{composer.json,composer.lock,.gitignore}', '!composer/**/{composer.json,composer.lock,.gitignore}',
'!composer/**/*.yml', '!composer/**/{*.yml,*.md}'
'!composer/**/*.md'
]) ])
.pipe(gulp.dest('./src/application/third_party/')); .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. * 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();
});
}); });
/** /**

View file

@ -20,9 +20,11 @@
"homepage": "http://easyappointments.org", "homepage": "http://easyappointments.org",
"devDependencies": { "devDependencies": {
"del": "^2.2.0", "del": "^2.2.0",
"fs-extra": "^0.26.3",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"jsdoc": "^3.3.2", "jsdoc": "^3.3.2",
"plato": "^1.5.0" "plato": "^1.5.0",
"zip-dir": "^1.0.0"
}, },
"engines": { "engines": {
"node": ">=0.12" "node": ">=0.12"

View file

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