open-street-map-plugin/gulpfile.js

62 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2014-12-18 19:21:38 +03:00
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();
});
});
2021-01-29 22:29:08 +03:00
gulp.task('prepare-release', gulp.series('bower', function() {
2014-12-18 19:21:38 +03:00
var version = require('./package.json').version;
return eventStream.merge(
getSources()
.pipe(zip('open-street-map-plugin-' + version + '.zip')),
2014-12-18 19:21:38 +03:00
getSources()
.pipe(tar('open-street-map-plugin-' + version + '.tar'))
2014-12-18 19:21:38 +03:00
.pipe(gzip())
)
2021-01-29 22:29:08 +03:00
.pipe(chmod(0644))
2014-12-18 19:21:38 +03:00
.pipe(gulp.dest('release'));
2021-01-29 22:29:08 +03:00
}));
2014-12-18 19:21:38 +03:00
// Builds and packs plugins sources
2021-01-29 22:29:08 +03:00
gulp.task('default', gulp.series('prepare-release'));
2014-12-18 19:21:38 +03:00
/**
* 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/jquery-colorbox/README.md',
'vendor/jquery-colorbox/jquery.colorbox-min.js',
'vendor/jquery-colorbox/example3/**/*',
'vendor/leaflet/dist/leaflet.*',
'vendor/leaflet/dist/images/*',
2014-12-18 19:21:38 +03:00
],
{base: './'}
)
.pipe(rename(function(path) {
path.dirname = 'Mibew/Mibew/Plugin/OpenStreetMap/' + path.dirname;
2014-12-18 19:21:38 +03:00
}));
}