2015-12-30 15:18:18 +02:00
|
|
|
var gulp = require('gulp'),
|
|
|
|
exec = require('child_process').execSync,
|
2015-12-30 23:33:19 +02:00
|
|
|
del = require('del'),
|
|
|
|
fs = require('fs-extra'),
|
|
|
|
zip = require('zip-dir');
|
2015-12-30 15:18:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Install and copy the required files from the "composer" directory.
|
|
|
|
*
|
|
|
|
* Composer needs to be installed and configured in order for this command to
|
|
|
|
* work properly.
|
|
|
|
*/
|
|
|
|
gulp.task('composer', function() {
|
|
|
|
del.sync([
|
|
|
|
'./composer',
|
|
|
|
'./src/application/third_party/**/*',
|
|
|
|
'!./src/application/third_party/index.html',
|
|
|
|
]);
|
|
|
|
|
|
|
|
exec('composer install --no-dev --prefer-dist', function (err, stdout, stderr) {
|
|
|
|
console.log(stdout);
|
|
|
|
console.log(stderr);
|
|
|
|
});
|
|
|
|
|
|
|
|
return gulp.src([
|
|
|
|
'composer/**/*',
|
|
|
|
'!composer/**/demo{,/**}',
|
2015-12-30 15:21:37 +02:00
|
|
|
'!composer/**/{demo,docs,examples,test,extras,language}{,/**}',
|
2015-12-30 15:18:18 +02:00
|
|
|
'!composer/**/{composer.json,composer.lock,.gitignore}',
|
2015-12-30 23:33:19 +02:00
|
|
|
'!composer/**/{*.yml,*.md}'
|
2015-12-30 15:18:18 +02:00
|
|
|
])
|
|
|
|
.pipe(gulp.dest('./src/application/third_party/'));
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the project and create an easyappointments.zip file ready for distribution.
|
|
|
|
*/
|
2015-12-30 23:33:19 +02:00
|
|
|
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');
|
2015-12-30 15:18:18 +02:00
|
|
|
|
2015-12-30 23:33:19 +02:00
|
|
|
zip('.tmp-package', { saveTo: 'easyappointments.zip' }, function (err, buffer) {
|
|
|
|
if (err)
|
|
|
|
console.log('Zip Error', err);
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
2015-12-30 15:18:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate code documentation.
|
|
|
|
*/
|
|
|
|
gulp.task('doc', function() {
|
|
|
|
|
|
|
|
});
|