Add gulp task for build the sources

This commit is contained in:
Dmitriy Simushev 2014-08-07 11:04:45 +00:00
parent a9cd400834
commit c2aeeb07f9
2 changed files with 37 additions and 7 deletions

View File

@ -2,6 +2,7 @@ var fs = require('fs'),
https = require('https'), https = require('https'),
exec = require('child_process').exec, exec = require('child_process').exec,
eventStream = require('event-stream'), eventStream = require('event-stream'),
runSequence = require('run-sequence'),
gulp = require('gulp'), gulp = require('gulp'),
uglify = require('gulp-uglify'), uglify = require('gulp-uglify'),
concat = require('gulp-concat'), concat = require('gulp-concat'),
@ -9,7 +10,11 @@ var fs = require('fs'),
order = require('gulp-order'), order = require('gulp-order'),
handlebars = require('gulp-handlebars'), handlebars = require('gulp-handlebars'),
defineModule = require('gulp-define-module'), defineModule = require('gulp-define-module'),
header = require('gulp-header'); header = require('gulp-header'),
zip = require('gulp-zip'),
tar = require('gulp-tar'),
gzip = require('gulp-gzip'),
chmod = require('gulp-chmod');
// Set global configs. // Set global configs.
var config = { var config = {
@ -20,7 +25,8 @@ var config = {
chatStylesPath: 'mibew/styles/dialogs', chatStylesPath: 'mibew/styles/dialogs',
pageStylesPath: 'mibew/styles/pages', pageStylesPath: 'mibew/styles/pages',
compiledTemplatesHeader: fs.readFileSync('tools/compiled_templates_header.txt'), compiledTemplatesHeader: fs.readFileSync('tools/compiled_templates_header.txt'),
getComposerUrl: 'https://getcomposer.org/installer' getComposerUrl: 'https://getcomposer.org/installer',
package: require('./package.json')
} }
@ -136,10 +142,29 @@ gulp.task('page-styles', function() {
.pipe(gulp.dest(stylePath + '/templates_compiled/client_side')); .pipe(gulp.dest(stylePath + '/templates_compiled/client_side'));
}); });
// Runs all existing tasks. // Pack sources to .zip and .tar.gz archives.
gulp.task('default', ['phpcs', 'js', 'chat-styles', 'page-styles'], function() { gulp.task('pack-sources', ['composer-install'], function() {
// This task is just a combination of other tasks. That is why there is no var sources = config.mibewPath + '/**/*',
// real code. version = config.package.version;
return eventStream.merge(
gulp.src(sources, {dot: true})
.pipe(zip('mibew-' + version + '.zip')),
gulp.src(sources, {dot: true})
.pipe(tar('mibew-' + version + '.tar'))
.pipe(gzip())
)
.pipe(chmod(0644))
.pipe(gulp.dest('release'));
});
// Builds all the sources
gulp.task('default', function(callback) {
runSequence(
['phpcs', 'js', 'chat-styles', 'page-styles'],
'pack-sources',
callback
);
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "Mibew", "name": "Mibew",
"version": "2.0.0", "version": "2.0.0-alpha2",
"description": "Mibew Messenger - open-source live support application", "description": "Mibew Messenger - open-source live support application",
"private": true, "private": true,
"devDependencies": { "devDependencies": {
@ -12,6 +12,11 @@
"gulp-handlebars": "~2.1.0", "gulp-handlebars": "~2.1.0",
"gulp-define-module": "~0.1.1", "gulp-define-module": "~0.1.1",
"gulp-header": "~1.0.5", "gulp-header": "~1.0.5",
"gulp-zip": "~1.0.0",
"gulp-tar": "~1.0.0",
"gulp-gzip": "~0.0.8",
"gulp-chmod": "~1.1.0",
"run-sequence": "~0.3.6",
"event-stream": "~3.1.7" "event-stream": "~3.1.7"
} }
} }