diff --git a/dist/schema-form.js b/dist/schema-form.js index 492835885..0e055bb95 100644 --- a/dist/schema-form.js +++ b/dist/schema-form.js @@ -44,7 +44,7 @@ angular.module('schemaForm').provider('sfPath', this.parse = ObjectPath.parse; this.stringify = ObjectPath.stringify; this.normalize = ObjectPath.normalize; - this.$get = function () { + this.$get = function() { return ObjectPath; }; }]); @@ -55,7 +55,7 @@ angular.module('schemaForm').provider('sfPath', * @kind function * */ -angular.module('schemaForm').factory('sfSelect', ['sfPath', function (sfPath) { +angular.module('schemaForm').factory('sfSelect', ['sfPath', function(sfPath) { var numRe = /^\d+$/; /** diff --git a/gulp/index.js b/gulp/index.js new file mode 100644 index 000000000..e805ff031 --- /dev/null +++ b/gulp/index.js @@ -0,0 +1,7 @@ +var fs = require('fs'), + tasks = fs.readdirSync('./gulp/tasks'), + gulp = require('gulp'); + +tasks.forEach(function(task) { + require('./tasks/' + task); +}); diff --git a/gulp/tasks/bootstrap-datepicker.js b/gulp/tasks/bootstrap-datepicker.js new file mode 100644 index 000000000..c3b066e83 --- /dev/null +++ b/gulp/tasks/bootstrap-datepicker.js @@ -0,0 +1,29 @@ +var gulp = require('gulp'), + streamqueue = require('streamqueue'), + minifyHtml = require('gulp-minify-html'), + templateCache = require('gulp-angular-templatecache'), + concat = require('gulp-concat'), + uglify = require('gulp-uglify'); + +gulp.task('bootstrap-datepicker', function() { + var stream = streamqueue({objectMode: true}); + stream.queue( + gulp.src('./src/directives/decorators/bootstrap/datepicker/*.html') + .pipe(minifyHtml({ + empty: true, + spare: true, + quotes: true + })) + .pipe(templateCache({ + module: 'schemaForm', + root: 'directives/decorators/bootstrap/datepicker/' + })) + ); + stream.queue(gulp.src('./src/directives/decorators/bootstrap/datepicker/*.js')); + + stream.done() + .pipe(concat('bootstrap-datepicker.min.js')) + .pipe(uglify()) + .pipe(gulp.dest('./dist/')); + +}); \ No newline at end of file diff --git a/gulp/tasks/bootstrap.js b/gulp/tasks/bootstrap.js new file mode 100644 index 000000000..9366b4ff1 --- /dev/null +++ b/gulp/tasks/bootstrap.js @@ -0,0 +1,29 @@ +var gulp = require('gulp'), + streamqueue = require('streamqueue'), + minifyHtml = require('gulp-minify-html'), + templateCache = require('gulp-angular-templatecache'), + concat = require('gulp-concat'), + uglify = require('gulp-uglify'); + +gulp.task('bootstrap', function() { + var stream = streamqueue({objectMode: true}); + stream.queue( + gulp.src('./src/directives/decorators/bootstrap/*.html') + .pipe(minifyHtml({ + empty: true, + spare: true, + quotes: true + })) + .pipe(templateCache({ + module: 'schemaForm', + root: 'directives/decorators/bootstrap/' + })) + ); + stream.queue(gulp.src('./src/directives/decorators/bootstrap/*.js')); + + stream.done() + .pipe(concat('bootstrap-decorator.min.js')) + .pipe(uglify()) + .pipe(gulp.dest('./dist/')); + +}); \ No newline at end of file diff --git a/gulp/tasks/default.js b/gulp/tasks/default.js new file mode 100644 index 000000000..f50183f47 --- /dev/null +++ b/gulp/tasks/default.js @@ -0,0 +1,8 @@ +var gulp = require('gulp'); + +gulp.task('default', [ + 'minify', + 'bootstrap', + 'bootstrap-datepicker', + 'non-minified-dist' +]); \ No newline at end of file diff --git a/gulp/tasks/jscs.js b/gulp/tasks/jscs.js new file mode 100644 index 000000000..8d1bfef9a --- /dev/null +++ b/gulp/tasks/jscs.js @@ -0,0 +1,7 @@ +var gulp = require('gulp'), + jscs = require('gulp-jscs'); + +gulp.task('jscs', function() { + gulp.src('./src/**/*.js') + .pipe(jscs()); +}); diff --git a/gulp/tasks/minify.js b/gulp/tasks/minify.js new file mode 100644 index 000000000..73f86cb1e --- /dev/null +++ b/gulp/tasks/minify.js @@ -0,0 +1,15 @@ +var gulp = require('gulp'), + concat = require('gulp-concat'), + uglify = require('gulp-uglify'); + +gulp.task('minify', function() { + gulp.src([ + './src/module.js', + './src/sfPath.js', + './src/services/*.js', + './src/directives/*.js' + ]) + .pipe(concat('schema-form.min.js')) + .pipe(uglify()) + .pipe(gulp.dest('./dist/')); +}); diff --git a/gulp/tasks/non-minified-dist.js b/gulp/tasks/non-minified-dist.js new file mode 100644 index 000000000..521f4c5ee --- /dev/null +++ b/gulp/tasks/non-minified-dist.js @@ -0,0 +1,13 @@ +var gulp = require('gulp'), + concat = require('gulp-concat'); + +gulp.task('non-minified-dist', function() { + gulp.src([ + './src/module.js', + './src/sfPath.js', + './src/services/*.js', + './src/directives/*.js' + ]) + .pipe(concat('schema-form.js')) + .pipe(gulp.dest('./dist/')); +}); \ No newline at end of file diff --git a/gulp/tasks/watch.js b/gulp/tasks/watch.js new file mode 100644 index 000000000..6fdd634f1 --- /dev/null +++ b/gulp/tasks/watch.js @@ -0,0 +1,5 @@ +var gulp = require('gulp'); + +gulp.task('watch', function() { + gulp.watch('./src/**/*', ['default']); +}); diff --git a/gulpfile.js b/gulpfile.js index 4c58da9e5..e3babcbd0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,97 +1,4 @@ -/* global require */ +//all of the tasks themselves are contained in the gulp/tasks directory, +//which is accessed through gulp/index.js -var gulp = require('gulp'); - -var templateCache = require('gulp-angular-templatecache'); -var minifyHtml = require('gulp-minify-html'); -var concat = require('gulp-concat'); -var uglify = require('gulp-uglify'); -var streamqueue = require('streamqueue'); -var jscs = require('gulp-jscs'); - - - -gulp.task('bootstrap', function() { - var stream = streamqueue({objectMode: true}); - stream.queue( - gulp.src('./src/directives/decorators/bootstrap/*.html') - .pipe(minifyHtml({ - empty: true, - spare: true, - quotes: true - })) - .pipe(templateCache({ - module: 'schemaForm', - root: 'directives/decorators/bootstrap/' - })) - ); - stream.queue(gulp.src('./src/directives/decorators/bootstrap/*.js')); - - stream.done() - .pipe(concat('bootstrap-decorator.min.js')) - .pipe(uglify()) - .pipe(gulp.dest('./dist/')); - -}); - -gulp.task('bootstrap-datepicker', function() { - var stream = streamqueue({objectMode: true}); - stream.queue( - gulp.src('./src/directives/decorators/bootstrap/datepicker/*.html') - .pipe(minifyHtml({ - empty: true, - spare: true, - quotes: true - })) - .pipe(templateCache({ - module: 'schemaForm', - root: 'directives/decorators/bootstrap/datepicker/' - })) - ); - stream.queue(gulp.src('./src/directives/decorators/bootstrap/datepicker/*.js')); - - stream.done() - .pipe(concat('bootstrap-datepicker.min.js')) - .pipe(uglify()) - .pipe(gulp.dest('./dist/')); - -}); - -gulp.task('minify', function() { - gulp.src([ - './src/module.js', - './src/sfPath.js', - './src/services/*.js', - './src/directives/*.js' - ]) - .pipe(concat('schema-form.min.js')) - .pipe(uglify()) - .pipe(gulp.dest('./dist/')); -}); - -gulp.task('non-minified-dist', function() { - gulp.src([ - './src/module.js', - './src/sfPath.js', - './src/services/*.js', - './src/directives/*.js' - ]) - .pipe(concat('schema-form.js')) - .pipe(gulp.dest('./dist/')); -}); - -gulp.task('jscs', function() { - gulp.src('./src/**/*.js') - .pipe(jscs()); -}); - -gulp.task('default', [ - 'minify', - 'bootstrap', - 'bootstrap-datepicker', - 'non-minified-dist' -]); - -gulp.task('watch', function() { - gulp.watch('./src/**/*', ['default']); -}); +require('./gulp'); \ No newline at end of file diff --git a/src/services/Select.js b/src/services/Select.js index fdb68310c..b3511125c 100644 --- a/src/services/Select.js +++ b/src/services/Select.js @@ -4,7 +4,7 @@ * @kind function * */ -angular.module('schemaForm').factory('sfSelect', ['sfPath', function (sfPath) { +angular.module('schemaForm').factory('sfSelect', ['sfPath', function(sfPath) { var numRe = /^\d+$/; /** diff --git a/src/sfPath.js b/src/sfPath.js index 507c73b39..11b69f1b6 100644 --- a/src/sfPath.js +++ b/src/sfPath.js @@ -20,7 +20,7 @@ angular.module('schemaForm').provider('sfPath', this.parse = ObjectPath.parse; this.stringify = ObjectPath.stringify; this.normalize = ObjectPath.normalize; - this.$get = function () { + this.$get = function() { return ObjectPath; }; }]);