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();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('prepare-release', ['bower'], function() {
|
|
|
|
var version = require('./package.json').version;
|
|
|
|
|
|
|
|
return eventStream.merge(
|
|
|
|
getSources()
|
2018-05-10 02:05:54 +03:00
|
|
|
.pipe(zip('open-street-map-plugin-' + version + '.zip')),
|
2014-12-18 19:21:38 +03:00
|
|
|
getSources()
|
2018-05-10 02:05:54 +03:00
|
|
|
.pipe(tar('open-street-map-plugin-' + version + '.tar'))
|
2014-12-18 19:21:38 +03:00
|
|
|
.pipe(gzip())
|
|
|
|
)
|
2018-08-07 20:05:57 +03:00
|
|
|
.pipe(chmod(644))
|
2014-12-18 19:21:38 +03:00
|
|
|
.pipe(gulp.dest('release'));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Builds and packs plugins sources
|
|
|
|
gulp.task('default', ['prepare-release'], function() {
|
|
|
|
// The "default" task is just an alias for "prepare-release" task.
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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',
|
2018-05-10 02:05:54 +03:00
|
|
|
'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) {
|
2018-05-10 02:05:54 +03:00
|
|
|
path.dirname = 'Mibew/Mibew/Plugin/OpenStreetMap/' + path.dirname;
|
2014-12-18 19:21:38 +03:00
|
|
|
}));
|
|
|
|
}
|