mirror of
https://github.com/Mibew/emoji-plugin.git
synced 2024-11-15 00:44:12 +03:00
63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
var bower = require('bower'),
|
|
eventStream = require('event-stream'),
|
|
gulp = require('gulp'),
|
|
chmod = require('gulp-chmod'),
|
|
zip = require('gulp-zip'),
|
|
tar = require('gulp-tar'),
|
|
gzip = require('gulp-gzip'),
|
|
rename = require('gulp-rename');
|
|
|
|
// Installs bower dependencies
|
|
gulp.task('bower', function(callback) {
|
|
bower.commands.install([], {}, {})
|
|
.on('error', function(error) {
|
|
callback(error);
|
|
})
|
|
.on('end', function() {
|
|
callback();
|
|
});
|
|
});
|
|
|
|
gulp.task('prepare-release', gulp.series('bower', function() {
|
|
var version = require('./package.json').version;
|
|
|
|
return eventStream.merge(
|
|
getSources()
|
|
.pipe(zip('emoji-plugin-' + version + '.zip')),
|
|
getSources()
|
|
.pipe(tar('emoji-plugin-' + version + '.tar'))
|
|
.pipe(gzip())
|
|
)
|
|
.pipe(chmod(0644))
|
|
.pipe(gulp.dest('release'));
|
|
}));
|
|
|
|
// Builds and packs plugins sources
|
|
gulp.task('default', gulp.series('prepare-release'));
|
|
|
|
/**
|
|
* Returns files stream with the plugin sources.
|
|
*
|
|
* @returns {Object} Stream with VinylFS files.
|
|
*/
|
|
var getSources = function() {
|
|
return gulp.src([
|
|
'Plugin.php',
|
|
'README.md',
|
|
'LICENSE',
|
|
'js/*',
|
|
'css/*',
|
|
'vendor/es5-shim/es5-shim.js',
|
|
'vendor/es5-shim/LICENSE',
|
|
'vendor/es5-shim/README.md',
|
|
'vendor/emojify.js/emojify.js',
|
|
'vendor/emojify.js/README.md',
|
|
'vendor/emojify.js/images/emoji/*'
|
|
],
|
|
{base: './'}
|
|
)
|
|
.pipe(rename(function(path) {
|
|
path.dirname = 'Mibew/Mibew/Plugin/Emoji/' + path.dirname;
|
|
}));
|
|
}
|