-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
61 lines (56 loc) · 1.69 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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('open-street-map-plugin-' + version + '.zip')),
getSources()
.pipe(tar('open-street-map-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/jquery-colorbox/README.md',
'vendor/jquery-colorbox/jquery.colorbox-min.js',
'vendor/jquery-colorbox/example3/**/*',
'vendor/leaflet/dist/leaflet.*',
'vendor/leaflet/dist/images/*',
],
{base: './'}
)
.pipe(rename(function(path) {
path.dirname = 'Mibew/Mibew/Plugin/OpenStreetMap/' + path.dirname;
}));
}