Run tests on Travis-CI.
[dygraphs.git] / gulpfile.js
index 672c09a..b1592bd 100644 (file)
@@ -1,7 +1,6 @@
 var gulp = require('gulp');
 var plugins = require('gulp-load-plugins')();
 var karma = require('karma').server;
-var lazypipe = require('lazypipe');
 var path = require('path');
 
 var dev = false;
@@ -98,18 +97,19 @@ gulp.task('create-loader', function() {
 
 gulp.task('create-dev', function() {
   var dest = 'dist';
-  return gulp.src(mergePaths(src.polyfills, src.main, src.plugins, src.devOptions, src.datahandlers))
-    .pipe(plugins.sourcemaps.init())
-    .pipe(plugins.concat('dygraph-combined.dev.js'))
+  return gulp.src(mergePaths(src.polyfills, src.main, src.plugins, src.devOptions, src.datahandlers), {base: '.'})
+    .pipe(plugins.sourcemaps.init({debug:true}))
+    .pipe(plugins.concat('dygraph-combined-dev.js'))
     .pipe(plugins.header(copyright))
+    .pipe(plugins.sourcemaps.write('.'))  // '.' = external sourcemap
     .pipe(gulp.dest(dest));
 });
 
 gulp.task('concat', function() {
   var dest = 'dist';
-  return gulp.src(mergePaths(src.polyfills, src.main, src.plugins, src.datahandlers))
+  return gulp.src(mergePaths(src.polyfills, src.main, src.plugins, src.datahandlers), {base: '.'})
      .pipe(plugins.sourcemaps.init())
-     .pipe(plugins.concat('dygraph-combined.js'))
+     .pipe(plugins.concat('scratch'))
      .pipe(plugins.header(copyright))
      .pipe(gulp.dest(dest))
      .pipe(plugins.uglify({
@@ -120,32 +120,24 @@ gulp.task('concat', function() {
       preserveComments: "none"
      }))
      .pipe(plugins.header(copyright))
-     .pipe(plugins.rename('dygraph-combined.min.js'))
+     .pipe(plugins.rename('dygraph-combined.js'))
      .pipe(plugins.sourcemaps.write('.'))
      .pipe(gulp.dest(dest));
 
 });
 
-gulp.task("bower-dist", ['concat'], function() {
-  gulp.src('src/dygraph/extras/**', {base: 'src/dygraph'})
-    .pipe(gulp.dest('dist/bower'));
-
-  return gulp.src('dist/dygraph-combined*')
-    .pipe(gulp.dest('dist/bower'));
-});
-
 gulp.task('gwt-dist', ['concat'], function() {
   // Copy package structure to dist folder
   gulp.src('gwt/**', {'base': '.'})
     .pipe(gulp.dest('dist'));
 
-  gulp.src('dygraph-combined.min.js')
+  gulp.src('dygraph-combined.js')
     .pipe(gulp.dest('dist/gwt/org/danvk'));
 
   // Generate jar
   gulp.src('')
     .pipe(plugins.shell([
-      'bash -c "jar -cf dygraph-gwt.jar -C dist/gwt org"'
+      'bash -c "jar -cf dist/dygraph-gwt.jar -C dist/gwt org"'
     ]))
 });
 
@@ -156,6 +148,13 @@ gulp.task('test', ['concat', 'create-dev'], function(done) {
   }, done);
 });
 
+gulp.task('coveralls', ['test'], plugins.shell.task([
+  './scripts/transform-coverage.js ' +
+      'dist/dygraph-combined-dev.js.map ' +
+      'dist/coverage/report-lcov/lcov.info ' +
+  '| ./node_modules/.bin/coveralls'
+]));
+
 gulp.task('watch', function() {
   gulp.watch('src/**', ['concat']);
 });
@@ -164,6 +163,6 @@ gulp.task('watch-test', function() {
   gulp.watch(['src/**', 'auto_tests/tests/**'], ['test']);
 });
 
-gulp.task('dist', ['gwt-dist', 'bower-dist']);
-gulp.task('travis', ['test']);
+gulp.task('dist', ['gwt-dist', 'concat', 'create-dev']);
+gulp.task('travis', ['test', 'coveralls']);
 gulp.task('default', ['test', 'dist']);