Start separating gulp files
diff --git a/xos/core/xoslib/xos-builder/gulp/build.js b/xos/core/xoslib/xos-builder/gulp/build.js
new file mode 100644
index 0000000..b001266
--- /dev/null
+++ b/xos/core/xoslib/xos-builder/gulp/build.js
@@ -0,0 +1,80 @@
+'use strict';
+
+// BUILD
+//
+// The only purpose of this gulpfile is to build a XOS view and copy the correct files into
+// .html => dashboards
+// .js (minified and concat) => static/js
+//
+// The template are parsed and added to js with angular $templateCache
+
+var gulp = require('gulp');
+var ngmin = require('gulp-ngmin');
+var uglify = require('gulp-uglify');
+var templateCache = require('gulp-angular-templatecache');
+var runSequence = require('run-sequence');
+var minifyHtml = require("gulp-minify-html");
+var concat = require("gulp-concat");
+var del = require('del');
+var wiredep = require('wiredep');
+var babel = require('gulp-babel');
+
+var TEMPLATE_HEADER = '/*This code is autogenerated from the templates files */ angular.module("<%= module %>"<%= standalone %>).run(["$templateCache", function($templateCache) {';
+
+module.exports = function(options){
+
+ gulp.task('clean', function(){
+ return del(['dist/**/*']);
+ });
+
+ gulp.task('scripts', function() {
+ return gulp.src([
+ 'src/xosContentProvider.js',
+ 'src/templates.js'
+ ])
+ .pipe(babel())
+ .pipe(ngmin())
+ .pipe(concat('xosContentProvider.js'))
+ .pipe(uglify())
+ .pipe(gulp.dest('dist'));
+ });
+
+ gulp.task('templates', function(){
+ return gulp.src("./src/templates/*.html")
+ .pipe(templateCache({
+ module: 'xos.contentProviderApp',
+ root: '../../static/templates/contentProvider/',
+ templateHeader: TEMPLATE_HEADER
+ }))
+ .pipe(gulp.dest("src"));
+ });
+
+ gulp.task('copyJs', function(){
+ return gulp.src('dist/xosContentProvider.js')
+ .pipe(gulp.dest('../static/js/'))
+ });
+
+ gulp.task('copyVendor', function(){
+ return gulp.src('dist/xosNgVendor.js')
+ .pipe(gulp.dest('../static/js/vendor/'));
+ });
+
+ gulp.task('wiredep', function(){
+ var bowerDeps = wiredep().js;
+ return gulp.src(bowerDeps)
+ .pipe(concat('xosNgVendor.js'))
+ .pipe(uglify())
+ .pipe(gulp.dest('dist'));
+ });
+
+ gulp.task('build', function() {
+ runSequence(
+ 'clean',
+ 'templates',
+ 'scripts',
+ 'copyJs',
+ 'wiredep',
+ 'copyVendor'
+ );
+ });
+}
\ No newline at end of file
diff --git a/xos/core/xoslib/xos-builder/gulpfile.js b/xos/core/xoslib/xos-builder/gulpfile.js
index 77a1ce2..7b84baf 100644
--- a/xos/core/xoslib/xos-builder/gulpfile.js
+++ b/xos/core/xoslib/xos-builder/gulpfile.js
@@ -1,77 +1,16 @@
'use strict';
-// BUILD
-//
-// The only purpose of this gulpfile is to build a XOS view and copy the correct files into
-// .html => dashboards
-// .js (minified and concat) => static/js
-//
-// The template are parsed and added to js with angular $templateCache
-
var gulp = require('gulp');
-var ngmin = require('gulp-ngmin');
-var uglify = require('gulp-uglify');
-var templateCache = require('gulp-angular-templatecache');
-var runSequence = require('run-sequence');
-var minifyHtml = require("gulp-minify-html");
-var concat = require("gulp-concat");
-var del = require('del');
-var wiredep = require('wiredep');
-var babel = require('gulp-babel');
+var wrench = require('wrench');
-var TEMPLATE_HEADER = '/*This code is autogenerated from the templates files */ angular.module("<%= module %>"<%= standalone %>).run(["$templateCache", function($templateCache) {';
+var options = {};
-gulp.task('clean', function(){
- return del(['dist/**/*']);
+wrench.readdirSyncRecursive('./gulp')
+.map(function(file) {
+ console.log(file);
+ require('./gulp/' + file)(options);
});
-gulp.task('scripts', function() {
- return gulp.src([
- 'src/xosContentProvider.js',
- 'src/templates.js'
- ])
- .pipe(babel())
- .pipe(ngmin())
- .pipe(concat('xosContentProvider.js'))
- .pipe(uglify())
- .pipe(gulp.dest('dist'));
-});
-
-gulp.task('templates', function(){
- return gulp.src("./src/templates/*.html")
- .pipe(templateCache({
- module: 'xos.contentProviderApp',
- root: '../../static/templates/contentProvider/',
- templateHeader: TEMPLATE_HEADER
- }))
- .pipe(gulp.dest("src"));
-});
-
-gulp.task('copyJs', function(){
- return gulp.src('dist/xosContentProvider.js')
- .pipe(gulp.dest('../static/js/'))
-});
-
-gulp.task('copyVendor', function(){
- return gulp.src('dist/xosNgVendor.js')
- .pipe(gulp.dest('../static/js/vendor/'));
-});
-
-gulp.task('wiredep', function(){
- var bowerDeps = wiredep().js;
- return gulp.src(bowerDeps)
- .pipe(concat('xosNgVendor.js'))
- .pipe(uglify())
- .pipe(gulp.dest('dist'));
-});
-
-gulp.task('default', function() {
- runSequence(
- 'clean',
- 'templates',
- 'scripts',
- 'copyJs',
- 'wiredep',
- 'copyVendor'
- );
+gulp.task('default', ['clean'], function () {
+ gulp.start('build');
});
diff --git a/xos/core/xoslib/xos-builder/package.json b/xos/core/xoslib/xos-builder/package.json
index c9bdc6a..1348663 100644
--- a/xos/core/xoslib/xos-builder/package.json
+++ b/xos/core/xoslib/xos-builder/package.json
@@ -24,6 +24,7 @@
"gulp-ngmin": "^0.3.0",
"gulp-uglify": "^1.4.2",
"run-sequence": "^1.1.4",
- "wiredep": "^3.0.0-beta"
+ "wiredep": "^3.0.0-beta",
+ "wrench": "^1.5.8"
}
}