@@ -8,7 +8,9 @@ var gulp = require("gulp"),
88 htmlReplace = require ( "gulp-html-replace" ) ,
99 header = require ( "gulp-header" ) ,
1010 replace = require ( "gulp-replace" ) ,
11- pkg = require ( "./package.json" ) ;
11+ pkg = require ( "./package.json" ) ,
12+ zip = require ( "gulp-zip" ) ,
13+ rename = require ( "gulp-rename" ) ;
1214
1315var banner = [
1416 "/** <%= pkg.name %>" ,
@@ -37,43 +39,58 @@ gulp.task("gatherScripts", ["clean"], function () {
3739 }
3840 } ) )
3941 . pipe ( header ( banner , { pkg : pkg } ) )
40- . pipe ( gulp . dest ( "build/js/" ) ) ;
42+ . pipe ( gulp . dest ( "build/WEBModule/ js/" ) ) ;
4143} ) ;
4244
4345gulp . task ( "gatherCSS" , [ "clean" ] , function ( ) {
4446 return gulp . src ( "source/css/*.css" )
4547 . pipe ( concat ( "lightPivotTable.css" ) )
4648 . pipe ( minifyCSS ( ) )
47- . pipe ( gulp . dest ( "build/css/" ) ) ;
49+ . pipe ( gulp . dest ( "build/WEBModule/ css/" ) ) ;
4850} ) ;
4951
5052gulp . task ( "addExample" , [ "clean" ] , function ( ) {
51- gulp . src ( "example/index.html" )
53+ return gulp . src ( "example/index.html" )
5254 . pipe ( htmlReplace ( {
53- "css" : "../ css/lightPivotTable.css" ,
54- "js" : "../ js/lightPivotTable.js"
55+ "css" : "css/lightPivotTable.css" ,
56+ "js" : "js/lightPivotTable.js"
5557 } ) )
56- . pipe ( gulp . dest ( "build/example/" ) ) ;
57- } ) ;
58-
59- gulp . task ( "exportCacheXML" , [ "clean" , "gatherScripts" , "gatherCSS" ] , function ( ) {
60- gulp . src ( "export/LightPivotTable.xml" )
61- . pipe ( replace ( / \{ \{ r e p l a c e : c s s } } / , fs . readFileSync ( "build/css/lightPivotTable.css" ) ) )
62- . pipe ( replace ( / \{ \{ r e p l a c e : j s } } / , fs . readFileSync ( "build/js/lightPivotTable.js" ) ) )
63- . pipe ( gulp . dest ( "build/" ) ) ;
58+ . pipe ( gulp . dest ( "build/WEBModule/" ) ) ;
6459} ) ;
6560
6661gulp . task ( "copyLICENSE" , [ "clean" ] , function ( ) {
67- gulp . src ( "LICENSE" )
62+ return gulp . src ( "LICENSE" )
6863 . pipe ( gulp . dest ( "build/" ) ) ;
6964} ) ;
7065
7166gulp . task ( "copyREADME" , [ "clean" ] , function ( ) {
72- gulp . src ( "readme.md" )
67+ return gulp . src ( "readme.md" )
7368 . pipe ( gulp . dest ( "build/" ) ) ;
7469} ) ;
7570
71+ gulp . task ( "exportCacheXML" , [
72+ "clean" , "addExample" , "gatherScripts" , "gatherCSS" , "copyLICENSE" , "copyREADME"
73+ ] , function ( ) {
74+ return gulp . src ( "export/LightPivotTable.xml" )
75+ . pipe (
76+ replace ( / \{ \{ r e p l a c e : c s s } } / ,
77+ fs . readFileSync ( "build/WEBModule/css/lightPivotTable.css" ) )
78+ )
79+ . pipe (
80+ replace ( / \{ \{ r e p l a c e : j s } } / ,
81+ fs . readFileSync ( "build/WEBModule/js/lightPivotTable.js" ) )
82+ )
83+ . pipe ( rename ( function ( path ) { path . basename += "-v" + pkg [ "version" ] ; } ) )
84+ . pipe ( gulp . dest ( "build/Caché" ) ) ;
85+ } ) ;
86+
87+ gulp . task ( "zipRelease" , [ "exportCacheXML" ] , function ( ) {
88+ return gulp . src ( "build/**/*" )
89+ . pipe ( zip ( "LightPivotTable-v" + pkg [ "version" ] + ".zip" ) )
90+ . pipe ( gulp . dest ( "build" ) ) ;
91+ } ) ;
92+
7693gulp . task ( "default" , [
7794 "clean" , "gatherScripts" , "gatherCSS" , "addExample" , "copyLICENSE" , "copyREADME" ,
78- "exportCacheXML"
95+ "exportCacheXML" , "zipRelease"
7996] ) ;
0 commit comments