<commit_before>var fs               = require('fs');
var header           = require('gulp-header');
var buffer           = require('vinyl-buffer');
var del              = require('del');
var gulp             = require('gulp');
var rename           = require('gulp-rename');
var rollup           = require('rollup-stream');
var rollupTypescript = require('rollup-plugin-typescript');
var source           = require('vinyl-source-stream');
var sourcemaps       = require('gulp-sourcemaps');
var ts               = require('typescript');
var tslint           = require("gulp-tslint");
var uglify           = require('gulp-uglify');

var ASSETS_BASE = "dist";
var RESOURCES_BASE = 'dist/resources';

gulp.task('workers', function () {
   return gulp.src('./source/workers/*.js')
      .pipe(gulp.dest("dist/workers"));
});

gulp.task('libs', function() {
  return rollup({
      entry: './source/libs.ts',
      plugins: [
         rollupTypescript({typescript:ts})
      ],
		format: 'umd',
		moduleName: 'Explorer3d',
    })
    .pipe(source('libs.js'))
    .pipe(header(fs.readFileSync('./resources/polyfills.js', 'utf8')))
    .pipe(gulp.dest('./dist'));
});

gulp.task('build', function() {
  return rollup({
      entry: './source/explorer3d.ts',
      plugins: [
         rollupTypescript({typescript:ts})
      ],
		format: 'umd',
		moduleName: 'Explorer3d',
    })
    .pipe(source('explorer3d.js'))
    .pipe(header(fs.readFileSync('./resources/polyfills.js', 'utf8')))
    .pipe(gulp.dest('./dist'));
});

gulp.task('dist', ['build', 'libs', 'workers'], function () {
   return gulp.src(['dist/*.js', '!dist/*.min.js'])
      .pipe(uglify())
      .pipe(rename({
         extname: '.min.js'
      }))
      .pipe(gulp.dest('dist'));
});

gulp.task('resources', function () {
   return gulp.src('resources/**/*')
      .pipe(gulp.dest(RESOURCES_BASE));
});

gulp.task('examples',  ['dist', 'resources']); //['build', 'libs', 'workers', 'resources']);

gulp.task("tslint", function() {
    return gulp.src("source/**/*.ts")
        .pipe(tslint())
        .pipe(tslint.report({
            emitError: false
        }));
});

// Watch Files For Changes
gulp.task('watch', function () {
   // We'll watch JS, SCSS and HTML files.
   gulp.watch('source/**/*.ts', ['tslint']);
   gulp.watch(['source/**/*.js', 'source/**/*.ts'], ['examples']);
});

gulp.task('clean', function (cb) {
   return del(["dist"], cb);
});

gulp.task('default', ['examples', 'tslint', 'watch']);<commit_msg>Reduce the number of files built<commit_after>var fs               = require('fs');
var concat           = require('gulp-concat');
var header           = require('gulp-header');
var buffer           = require('vinyl-buffer');
var del              = require('del');
var gulp             = require('gulp');
var rename           = require('gulp-rename');
var rollup           = require('rollup-stream');
var rollupTypescript = require('rollup-plugin-typescript');
var runSequence      = require('run-sequence');
var source           = require('vinyl-source-stream');
var sourcemaps       = require('gulp-sourcemaps');
var ts               = require('typescript');
var tslint           = require("gulp-tslint");
var uglify           = require('gulp-uglify');

var ASSETS_BASE = "dist";
var RESOURCES_BASE = 'dist/resources';

gulp.task('workers', function () {
   return gulp.src('./source/workers/*.js')
      .pipe(gulp.dest("dist/workers"));
});

gulp.task('libs', function() {
  return rollup({
      entry: './source/libs.ts',
      plugins: [
         rollupTypescript({typescript:ts})
      ],
		format: 'umd',
		moduleName: 'Explorer3d',
    })
    .pipe(source('libs.js'))
    .pipe(header(fs.readFileSync('./source/polyfills.js', 'utf8')))
    .pipe(gulp.dest('./dist'));
});

gulp.task('build', function() {
  return rollup({
      entry: './source/explorer3d.ts',
      plugins: [
         rollupTypescript({typescript:ts})
      ],
		format: 'umd',
		moduleName: 'Explorer3d',
    })
    .pipe(source('explorer3d.js'))
    .pipe(header(fs.readFileSync('./build/dependencies.js', 'utf8')))
    .pipe(gulp.dest('./dist'));
});

gulp.task('dependencies', function() {
  return gulp.src(["./resources/dependencies/*.js", "./source/polyfills.js"])
      .pipe(concat('dependencies.js'))
      .pipe(header("// WARNING: Don't edit.\n// This file contains all the content from the dependencies directory. It's rolled up into the explorer3d.js file.\n\n"))
      .pipe(gulp.dest('./build'));
});

gulp.task('dist', ['build', 'libs', 'workers'], function () {
   return gulp.src(['dist/*.js', '!dist/*.min.js'])
      .pipe(uglify())
      .pipe(rename({
         extname: '.min.js'
      }))
      .pipe(gulp.dest('dist'));
});

gulp.task('resources', function () {
   // Polyfills gets rolled up in the larger files. The others are optional.
   return gulp.src(['resources/**/*.*', "!resources/dependencies/*"])
      .pipe(gulp.dest(RESOURCES_BASE));
});

gulp.task('examples',  ['dist', 'resources']); //['build', 'libs', 'workers', 'resources']);

gulp.task("tslint", function() {
    return gulp.src("source/**/*.ts")
        .pipe(tslint())
        .pipe(tslint.report({
            emitError: false
        }));
});

// Watch Files For Changes
gulp.task('watch', function () {
   // We'll watch JS, SCSS and HTML files.
   gulp.watch('source/**/*.ts', ['tslint']);
   gulp.watch(['source/**/*.js', 'source/**/*.ts'], ['examples']);
});

gulp.task('clean', function (cb) {
   return del(["dist", "build"], cb);
});

// We clean, package up the little dependencies and then we are ready to rock and roll.
// Note that if new dependencies are added you need run the default task to repackage everything.
// We don't watch dependencies or expect them to change between gulp restarts.
gulp.task('default', function(callback) {
  return runSequence('clean', 'dependencies', ['examples', 'tslint', 'watch']);
});<|endoftext|>


<commit_before>var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var sourcemaps = require('gulp-sourcemaps');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var browserSync = require('browser-sync');
var svgstore = require('gulp-svgstore');
var svgmin = require('gulp-svgmin');
var inject = require('gulp-inject');
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var styleguide = require('sc5-styleguide');
var del = require('del');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var image = require('gulp-image');

    // files
    var tempFolderAssets = 'temp/assets';
    var outputPath = 'temp/styleguide';
    var buildPath = 'build/assets';

// Browser definitions for autoprefixer
var autoprefixerOptions = {
  browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
};

// Static Server + watching scss/html files
gulp.task('serve', ['clean', 'compile-css', 'compile-html', 'compile-javascript', 'move-images',], function() {

    browserSync.init({
        server: "./temp"
    });

    gulp.watch("src/scss/**/*.scss", ['compile-css']);
    gulp.watch("src/**/*.html", ['compile-html']);
    gulp.watch("src/svg/**/*.svg", ['compile-html']);
    gulp.watch("src/js/**/*.js", ['compile-javascript']);
    gulp.watch("src/img/**/*", ['move-images']);
});

// Compile CSS
gulp.task('compile-css', function() {

    return gulp.src('src/scss/main.scss')
        .pipe(sourcemaps.init())
        .pipe(sass({
          style: 'expanded',
        }).on('error', notify.onError(function (error) {
          return "Problem file : " + error.message;
        })))
        .pipe(autoprefixer(autoprefixerOptions))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(tempFolderAssets + '/css'))
        .pipe(browserSync.stream());
});

// Minify CSS
gulp.task('build-css', function() {

    return gulp.src('src/scss/main.scss')
        .pipe(sass({
          style: 'compressed',
        }).on('error', notify.onError(function (error) {
          return "Problem file : " + error.message;
        })))
        .pipe(autoprefixer(autoprefixerOptions))
        .pipe(minifyCss({compatibility: 'ie8'}))
        .pipe(gulp.dest(buildPath + '/css'))
        .pipe(notify({
          title: 'Gulp',
          subtitle: 'success',
          message: 'Sass task',
          sound: "Pop"
        }));
});

// Move HTML
gulp.task('compile-html', function() {

    var svgs = gulp.src('src/svg/*.svg')
        .pipe(rename({prefix: 'icn-'}))
        .pipe(svgstore({ inlineSvg: true }));

    function fileContents (filePath, file) {
        return file.contents.toString();
    }

    gulp.src('src/*.html')
      .pipe(inject(svgs, { transform: fileContents }))
      .pipe(gulp.dest('temp'))
      .pipe(browserSync.stream());
});

// Build HTML
gulp.task('build-html', function() {

    var svgs = gulp.src('src/svg/*.svg')
        .pipe(rename({prefix: 'icn-'}))
        .pipe(svgstore({ inlineSvg: true }));

    function fileContents (filePath, file) {
        return file.contents.toString();
    }

    gulp.src('src/*.html')
      .pipe(inject(svgs, { transform: fileContents }))
      .pipe(gulp.dest('build'));
});

// Compile Development JavaScript
gulp.task('compile-javascript', function() {

    gulp.src(['src/js/libs/**/*.js'])
        .pipe(concat('all.js'))
        .pipe(gulp.dest(tempFolderAssets +'/js'))
        .pipe(browserSync.stream());

    gulp.src(['src/js/main.js'])
        .pipe(concat('main.js'))
        .pipe(gulp.dest(tempFolderAssets +'/js'))
        .pipe(browserSync.stream());
});

// Build JS
gulp.task('build-javascript', function() {

    gulp.src(['src/js/libs/**/*.js'])
        .pipe(concat('all.js'))
        .pipe(uglify())
        .pipe(gulp.dest(buildPath +'/js'));

    gulp.src(['src/js/main.js'])
        .pipe(concat('main.js'))
        .pipe(uglify())
        .pipe(gulp.dest(buildPath +'/js'));
});

// Move Images
gulp.task('move-images', function() {
  return gulp.src('src/img/**/*')
    .pipe(gulp.dest(tempFolderAssets + '/img'));
});

gulp.task('move-favicon', function() {
  return gulp.src('src/favicon.ico')
    .pipe(gulp.dest('build'));
});

gulp.task('move-icons', function() {
  return gulp.src('src/*.png')
    .pipe(gulp.dest('build'));
});

// Compress Images

// Move Images
gulp.task('build-images', function() {
  return gulp.src('src/img/**/*')
    .pipe(image())
    .pipe(gulp.dest(buildPath + '/img'));
});

// Clean up Temp
gulp.task('clean', function () {
  return del.sync([
    './temp/**'
  ]);
});

// Clean up Temp
gulp.task('clean-build', function () {
  return del.sync([
    './build/**'
  ]);
});

// styleguide

gulp.task('styleguide:generate', function() {
  return gulp.src('src/scss/**/*.scss')
    .pipe(styleguide.generate({
        title: 'My Styleguide',
        server: true,
        port: 5000,
        rootPath: outputPath,
        overviewPath: 'README.md'
      }))
    .pipe(gulp.dest(outputPath));
});

gulp.task('styleguide:applystyles', function() {
  return gulp.src('src/scss/main.scss')
    .pipe(sass({
      errLogToConsole: true
    }))
    .pipe(styleguide.applyStyles())
    .pipe(gulp.dest(outputPath));
});

gulp.task('default', ['styleguide', 'serve'], function() {
  // Start watching changes and update styleguide whenever changes are detected
  // Styleguide automatically detects existing server instance
  gulp.watch(['src/scss/**/*.scss'], ['styleguide']);
});

// Styleguide
gulp.task('styleguide', ['styleguide:generate', 'styleguide:applystyles']);

// Default task
gulp.task('watch', ['serve']);

// Build Production
gulp.task('build', ['clean-build', 'build-css', 'build-html', 'build-javascript', 'build-images', 'move-favicon', 'move-icons']);
<commit_msg>Updating Build.<commit_after>var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var sourcemaps = require('gulp-sourcemaps');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var browserSync = require('browser-sync');
var svgstore = require('gulp-svgstore');
var svgmin = require('gulp-svgmin');
var inject = require('gulp-inject');
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var styleguide = require('sc5-styleguide');
var del = require('del');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var image = require('gulp-image');

    // files
    var tempFolderAssets = 'temp/assets';
    var outputPath = 'temp/styleguide';
    var buildPath = 'build/assets';

// Browser definitions for autoprefixer
var autoprefixerOptions = {
  browsers: ['last 2 versions', '> 5%', 'Firefox ESR']
};

// Static Server + watching scss/html files
gulp.task('serve', ['clean', 'compile-css', 'compile-html', 'compile-javascript', 'move-images',], function() {

    browserSync.init({
        server: "./temp"
    });

    gulp.watch("src/scss/**/*.scss", ['compile-css']);
    gulp.watch("src/**/*.html", ['compile-html']);
    gulp.watch("src/svg/**/*.svg", ['compile-html']);
    gulp.watch("src/js/**/*.js", ['compile-javascript']);
    gulp.watch("src/img/**/*", ['move-images']);
});

// Compile CSS
gulp.task('compile-css', function() {

    return gulp.src('src/scss/main.scss')
        .pipe(sourcemaps.init())
        .pipe(sass({
          style: 'expanded',
        }).on('error', notify.onError(function (error) {
          return "Problem file : " + error.message;
        })))
        .pipe(autoprefixer(autoprefixerOptions))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(tempFolderAssets + '/css'))
        .pipe(browserSync.stream());
});

// Minify CSS
gulp.task('build-css', function() {

    return gulp.src('src/scss/main.scss')
        .pipe(sass({
          style: 'compressed',
        }).on('error', notify.onError(function (error) {
          return "Problem file : " + error.message;
        })))
        .pipe(autoprefixer(autoprefixerOptions))
        .pipe(minifyCss({compatibility: 'ie8'}))
        .pipe(gulp.dest(buildPath + '/css'))
        .pipe(notify({
          title: 'Gulp',
          subtitle: 'success',
          message: 'Sass task',
          sound: "Pop"
        }));
});

// Move HTML
gulp.task('compile-html', function() {

    var svgs = gulp.src('src/svg/*.svg')
        .pipe(rename({prefix: 'icn-'}))
        .pipe(svgstore({ inlineSvg: true }));

    function fileContents (filePath, file) {
        return file.contents.toString();
    }

    gulp.src('src/*.html')
      .pipe(inject(svgs, { transform: fileContents }))
      .pipe(gulp.dest('temp'))
      .pipe(browserSync.stream());
});

// Build HTML
gulp.task('build-html', function() {

    var svgs = gulp.src('src/svg/*.svg')
        .pipe(rename({prefix: 'icn-'}))
        .pipe(svgstore({ inlineSvg: true }));

    function fileContents (filePath, file) {
        return file.contents.toString();
    }

    gulp.src('src/*.html')
      .pipe(inject(svgs, { transform: fileContents }))
      .pipe(gulp.dest('build'));
});

// Compile Development JavaScript
gulp.task('compile-javascript', function() {

    gulp.src(['src/js/libs/**/*.js'])
        .pipe(concat('all.js'))
        .pipe(gulp.dest(tempFolderAssets +'/js'))
        .pipe(browserSync.stream());

    gulp.src(['src/js/main.js'])
        .pipe(concat('main.js'))
        .pipe(gulp.dest(tempFolderAssets +'/js'))
        .pipe(browserSync.stream());
});

// Build JS
gulp.task('build-javascript', function() {

    gulp.src(['src/js/libs/**/*.js'])
        .pipe(concat('all.js'))
        .pipe(uglify())
        .pipe(gulp.dest(buildPath +'/js'));

    gulp.src(['src/js/main.js'])
        .pipe(concat('main.js'))
        .pipe(uglify())
        .pipe(gulp.dest(buildPath +'/js'));
});

// Move Images
gulp.task('move-images', function() {
  return gulp.src('src/img/**/*')
    .pipe(gulp.dest(tempFolderAssets + '/img'));
});

// Compress Images
gulp.task('build-images', function() {
  return gulp.src('src/img/**/*')
    .pipe(image())
    .pipe(gulp.dest(buildPath + '/img'));
});

// Move CNAME to Build
gulp.task('build-cname', function() {
  return gulp.src('CNAME')
    .pipe(gulp.dest('build'));
});

// Move favicon to Build
gulp.task('build-favicon', function() {
  return gulp.src('src/favicon.ico')
    .pipe(gulp.dest('build'));
});

// Move icons to Build
gulp.task('build-icons', function() {
  return gulp.src('src/*.png')
    .pipe(image())
    .pipe(gulp.dest('build'));
});

// Clean up Temp
gulp.task('clean', function () {
  return del.sync([
    './temp/**'
  ]);
});

// Clean up Temp
gulp.task('clean-build', function () {
  return del.sync([
    './build/**'
  ]);
});

// styleguide

gulp.task('styleguide:generate', function() {
  return gulp.src('src/scss/**/*.scss')
    .pipe(styleguide.generate({
        title: 'My Styleguide',
        server: true,
        port: 5000,
        rootPath: outputPath,
        overviewPath: 'README.md'
      }))
    .pipe(gulp.dest(outputPath));
});

gulp.task('styleguide:applystyles', function() {
  return gulp.src('src/scss/main.scss')
    .pipe(sass({
      errLogToConsole: true
    }))
    .pipe(styleguide.applyStyles())
    .pipe(gulp.dest(outputPath));
});

gulp.task('default', ['styleguide', 'serve'], function() {
  // Start watching changes and update styleguide whenever changes are detected
  // Styleguide automatically detects existing server instance
  gulp.watch(['src/scss/**/*.scss'], ['styleguide']);
});

// Styleguide
gulp.task('styleguide', ['styleguide:generate', 'styleguide:applystyles']);

// Default task
gulp.task('watch', ['serve']);

// Build Production
gulp.task('build', ['clean-build', 'build-css', 'build-html', 'build-javascript', 'build-images', 'build-favicon', 'build-icons', 'build-cname']);
<|endoftext|>


<commit_before>/* ***********************************************************************************************

    Unify Project

    Homepage: unify-project.org
    License: MIT + Apache (V2)
    Copyright: 2009-2010 Deutsche Telekom AG, Germany, http://telekom.com

*********************************************************************************************** */
/* ************************************************************************

#asset(tweet/mobile/*)

************************************************************************ */

/**
 * Twitter application class for hero mobile devices.
 */
qx.Class.define("tweet.application.Mobile",
{
  extend : unify.application.Mobile,

  /*
  *****************************************************************************
     MEMBERS
  *****************************************************************************
  */

  members :
  {
    /*
    ---------------------------------------------------------------------------
      APPLICATION CORE
    ---------------------------------------------------------------------------
    */

    // overridden
    main : function()
    {
      // Call super class
      this.base(arguments);

      // Initialize Twitter business object
      var TwitterAuth = tweet.business.TwitterAuth.getInstance();
      TwitterAuth.setUser("telekomria");
      TwitterAuth.setPassword("32u8AH555wKdQvhqgZZ9");

      // Register views
      var ViewManager = unify.view.mobile.ViewManager.getInstance();
      ViewManager.add(tweet.view.mobile.Timeline);
      ViewManager.add(tweet.view.mobile.Status);
      ViewManager.add(tweet.view.mobile.Compose);
      ViewManager.add(tweet.view.mobile.Userlist);
      ViewManager.add(tweet.view.mobile.User);
      ViewManager.add(tweet.view.mobile.Search);

      // Configure tab bar
      var TabBar = unify.ui.mobile.TabBar.getInstance();
      TabBar.add(tweet.view.mobile.Timeline);
      TabBar.add(tweet.view.mobile.Userlist);
      TabBar.add(tweet.view.mobile.Search);

      // Initialize navigation
      unify.view.mobile.NavigationManager.getInstance().init();
    }
  }
});
<commit_msg>Minor<commit_after>/* ***********************************************************************************************

    Unify Project

    Homepage: unify-project.org
    License: MIT + Apache (V2)
    Copyright: 2009-2010 Deutsche Telekom AG, Germany, http://telekom.com

*********************************************************************************************** */
/* ************************************************************************

#asset(tweet/mobile/*)

************************************************************************ */

/**
 * Twitter application class for hero mobile devices.
 */
qx.Class.define("tweet.application.Mobile",
{
  extend : unify.application.Mobile,

  /*
  *****************************************************************************
     MEMBERS
  *****************************************************************************
  */

  members :
  {
    /*
    ---------------------------------------------------------------------------
      APPLICATION CORE
    ---------------------------------------------------------------------------
    */

    // overridden
    main : function()
    {
      // Call super class
      this.base(arguments);

      // Initialize Twitter business object
      var TwitterAuth = tweet.business.TwitterAuth.getInstance();
      TwitterAuth.setUser("telekomria");
      TwitterAuth.setPassword("32u8AH555wKdQvhqgZZ9");

      // Set up
      document.title = "Tweet";

      // Register views
      var ViewManager = unify.view.mobile.ViewManager.getInstance();
      ViewManager.add(tweet.view.mobile.Timeline);
      ViewManager.add(tweet.view.mobile.Status);
      ViewManager.add(tweet.view.mobile.Compose);
      ViewManager.add(tweet.view.mobile.Userlist);
      ViewManager.add(tweet.view.mobile.User);
      ViewManager.add(tweet.view.mobile.Search);

      // Configure tab bar
      var TabBar = unify.ui.mobile.TabBar.getInstance();
      TabBar.add(tweet.view.mobile.Timeline);
      TabBar.add(tweet.view.mobile.Userlist);
      TabBar.add(tweet.view.mobile.Search);

      // Initialize navigation
      unify.view.mobile.NavigationManager.getInstance().init();
    }
  }
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var spawn = require('child_process').spawn;
var mocha = require('gulp-mocha');
var log = require('fancy-log');
var ts = require("gulp-typescript");
var tsProject = ts.createProject("tsconfig.json");

var node;
var paths = {
  srcJs: './src/**/*.js',
  srcTs: './src/**/*.ts',
  srcUnit: './src/**/*Spec.js',
  srcIntegration: './tests/**/*.js'
};

gulp.task('compile', function() {
  return tsProject.src()
    .pipe(tsProject())
    .js.pipe(gulp.dest('dist'));
});

gulp.task('src', gulp.series(['compile']), function() {
  if (node){
    node.kill();
  }
  node = spawn('node', ['./dist/app.js'], {stdio: 'inherit'});
  node.on('close', function (code) {
    if (code === 8) {
      gulp.log('Error detected, waiting for changes...');
    }
  });
});

gulp.task('env:dev', function(done) {
  process.env.PORT = 3000;
  process.env.NODE_ENV = 'development';
  done();
});

gulp.task('env:test', function(done) {
  process.env.PORT = 3001;
  process.env.NODE_ENV = 'test';
  done();
});

gulp.task('env:prod', function(done) {
  process.env.NODE_ENV = 'production';
  done();
});

gulp.task('serve', gulp.series(['env:dev', 'src'], function() {
  return gulp.watch([paths.srcJs, paths.srcTs], gulp.series(['src']));
}));

gulp.task('test:unit', gulp.series(['env:test'], function() {
  return gulp.src([paths.srcUnit])
    .pipe(mocha())
    .on('error', log);
}));

gulp.task('test:api', gulp.series(['env:test'], function() {
  return gulp.src([paths.srcIntegration])
    .pipe(mocha({ exit: true }));
}));

gulp.task('test:unit:watch', gulp.series(['test:unit'], function() {
  return gulp.watch([paths.srcUnit, paths.srcJs], gulp.series(['test:unit']));
}));

gulp.task('test:api:watch', gulp.series(['test:api'], function() {
  return gulp.watch([paths.srcIntegration, paths.srcJs], gulp.series(['test:api']));
}));

gulp.task('default', gulp.series(['serve']));

process.on('exit', function() {
  if (node) {
    node.kill();
  }
});
<commit_msg>Fix gulp task<commit_after>var gulp = require('gulp');
var spawn = require('child_process').spawn;
var mocha = require('gulp-mocha');
var log = require('fancy-log');
var ts = require('gulp-typescript');
var tsProject = ts.createProject('./tsconfig.json');

var node;
var paths = {
  srcJs: './src/**/*.js',
  srcTs: './src/**/*.ts',
  srcUnit: './src/**/*Spec.js',
  srcIntegration: './tests/**/*.js'
};

gulp.task('compile', () => {
  return tsProject.src()
    .pipe(tsProject())
    .js.pipe(gulp.dest('dist'));
});

gulp.task('src', gulp.series(['compile'], () => {
  startServer();
}));

gulp.task('env:dev', (done) => {
  process.env.PORT = 3000;
  process.env.NODE_ENV = 'development';
  done();
});

gulp.task('env:test', (done) => {
  process.env.PORT = 3001;
  process.env.NODE_ENV = 'test';
  done();
});

gulp.task('env:prod', (done) => {
  process.env.NODE_ENV = 'production';
  done();
});

gulp.task('serve', gulp.series(['env:dev', 'src'], () => {
  return gulp.watch([paths.srcJs, paths.srcTs], gulp.series(['src']));
}));

gulp.task('test:unit', gulp.series(['env:test'], () => {
  return gulp.src([paths.srcUnit])
    .pipe(mocha())
    .on('error', log);
}));

gulp.task('test:api', gulp.series(['env:test'], () => {
  return gulp.src([paths.srcIntegration])
    .pipe(mocha({ exit: true }));
}));

gulp.task('test:unit:watch', gulp.series(['test:unit'], () => {
  return gulp.watch([paths.srcUnit, paths.srcJs], gulp.series(['test:unit']));
}));

gulp.task('test:api:watch', gulp.series(['test:api'], () => {
  return gulp.watch([paths.srcIntegration, paths.srcJs], gulp.series(['test:api']));
}));

gulp.task('default', gulp.series(['serve']));

process.on('exit', () => {
  if (node) {
    node.kill();
  }
});

async function startServer() {
  if (node) {
    node.kill();
  }

  node = await spawn('node', ['./dist/app.js'], { stdio: 'inherit' });

  node.on('close', function (code) {
    if(code === 8) {
      console.log('Error detected, waiting for changes...');
    }
  });
}<|endoftext|>


<commit_before>var gulp = require('gulp');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var webserver = require('gulp-webserver');
var mainbowerfiles = require('main-bower-files');
var sourcemaps = require('gulp-sourcemaps');
var ngAnnotate = require('gulp-ng-annotate');

var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');

gulp.task('minify', function () {
   gulp.src('app/js/app.js')
      .pipe(uglify())
      .pipe(gulp.dest('build'))
});

gulp.task('bower', function () {
  var files = mainbowerfiles( { debugging: false, checkExistence: true } );
  gutil.log('Processing', gutil.colors.cyan(files.length), 'bower files');

  return gulp.src(
      files,
      { base: './bower_components/' }
    )
    .pipe(concat('vendor.js'))
    .pipe(gulp.dest('build/js/'));
});

gulp.task('js', function () {
   return gulp.src('app/js/*.js')
      .pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
      .pipe(jshint())
      .pipe(jshint.reporter('jshint-stylish'))
      .pipe(jshint.reporter('fail'))
      .pipe(ngAnnotate())
      .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(concat('app.js'))
      .pipe(sourcemaps.write())
      .pipe(gulp.dest('build/js/'));
});

gulp.task('html', function() {
  return gulp.src('app/**/*.html')
    .pipe(gulp.dest('build'));
});

gulp.task('webserver', ['html', 'js', 'bower'], function() {
  gulp.src('build')
    .pipe(webserver({
      livereload: true
    }));

  gulp.watch('app/**/*.html', ['html']);
  gulp.watch('app/js/**/*.js', ['js']);
  gulp.watch('bower_components', ['bower']);
});
<commit_msg>remove no more needed minification step (was unused)<commit_after>var gulp = require('gulp');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var webserver = require('gulp-webserver');
var mainbowerfiles = require('main-bower-files');
var sourcemaps = require('gulp-sourcemaps');
var ngAnnotate = require('gulp-ng-annotate');

var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');

gulp.task('bower', function () {
  var files = mainbowerfiles( { debugging: false, checkExistence: true } );
  gutil.log('Processing', gutil.colors.cyan(files.length), 'bower files');

  return gulp.src(
      files,
      { base: './bower_components/' }
    )
    .pipe(concat('vendor.js'))
    .pipe(gulp.dest('build/js/'));
});

gulp.task('js', function () {
   return gulp.src('app/js/*.js')
      .pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
      .pipe(jshint())
      .pipe(jshint.reporter('jshint-stylish'))
      .pipe(jshint.reporter('fail'))
      .pipe(ngAnnotate())
      .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(concat('app.js'))
      .pipe(sourcemaps.write())
      .pipe(gulp.dest('build/js/'));
});

gulp.task('html', function() {
  return gulp.src('app/**/*.html')
    .pipe(gulp.dest('build'));
});

gulp.task('webserver', ['html', 'js', 'bower'], function() {
  gulp.src('build')
    .pipe(webserver({
      livereload: true
    }));

  gulp.watch('app/**/*.html', ['html']);
  gulp.watch('app/js/**/*.js', ['js']);
  gulp.watch('bower_components', ['bower']);
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var mocha = require('gulp-mocha');
var naming = require("gulp-check-file-naming-convention");
var shell = require('gulp-shell');
var ts = require('gulp-typescript');
var tslint = require("gulp-tslint");

gulp.task('build', function () {
  return gulp.src([
      './**/*.ts',
      '!./node_modules/**/*.ts'
    ])
    .pipe(ts({
      module: 'commonjs',
      target: 'ES5',
      removeComments: true,
      sourceMap: true,
      typescript: require('typescript')
    }))
    .pipe(gulp.dest('.'));
});

gulp.task('run', [ 'build' ], shell.task([
  'NODE_PATH=$NODE_PATH:./lib node main.js'
]));

gulp.task("test", ["build"], function () {
  return gulp.src([
      'test/**/*.js',
    ], {read: false})
    .pipe(mocha({
      reporter: 'spec',
      timeout: 10000
    }));
});

gulp.task("lint", function () {
  return gulp.src([
      './**/*.ts',
      '!./node_modules/**/*.ts',
      '!./lib.d/**/*.d.ts'
    ])
    .pipe(tslint({configuration: require('./.tslintrc')}))
    .pipe(tslint.report('prose'));
});

gulp.task("naming", function () {
  return gulp.src([
    "**/*.ts",
    "!**/*.d.ts",
    "!node_modules/**/*"
  ])
  .pipe(naming({caseName: 'paramCase'}));
});

gulp.task("default", ["naming", "lint", "test"]);
<commit_msg>Use noImplicitAny flag.<commit_after>var gulp = require('gulp');
var mocha = require('gulp-mocha');
var naming = require("gulp-check-file-naming-convention");
var shell = require('gulp-shell');
var ts = require('gulp-typescript');
var tslint = require("gulp-tslint");

gulp.task('build', function () {
  return gulp.src([
      './**/*.ts',
      '!./node_modules/**/*.ts'
    ])
    .pipe(ts({
      module: 'commonjs',
      noImplicitAny: true,
      target: 'ES5',
      removeComments: true,
      sourceMap: true,
      typescript: require('typescript')
    }))
    .pipe(gulp.dest('.'));
});

gulp.task('run', [ 'build' ], shell.task([
  'NODE_PATH=$NODE_PATH:./lib node main.js'
]));

gulp.task("test", ["build"], function () {
  return gulp.src([
      'test/**/*.js',
    ], {read: false})
    .pipe(mocha({
      reporter: 'spec',
      timeout: 10000
    }));
});

gulp.task("lint", function () {
  return gulp.src([
      './**/*.ts',
      '!./node_modules/**/*.ts',
      '!./lib.d/**/*.d.ts'
    ])
    .pipe(tslint({configuration: require('./.tslintrc')}))
    .pipe(tslint.report('prose'));
});

gulp.task("naming", function () {
  return gulp.src([
    "**/*.ts",
    "!**/*.d.ts",
    "!node_modules/**/*"
  ])
  .pipe(naming({caseName: 'paramCase'}));
});

gulp.task("default", ["naming", "lint", "test"]);
<|endoftext|>


<commit_before>var gulp = require('gulp');
var del = require('del');
var runSequence = require('run-sequence');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var typescript = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var modRewrite = require('connect-modrewrite');
var electronConnect = require('electron-connect');
var process = require('process');
var packager = require('electron-packager');
var archiver = require('archiver');
var fs = require('fs');
var path = require('path');
var shell = require('gulp-shell');
var pkg = require('./package.json');
var exec = require('child_process').exec;
var argv = require('yargs').argv;
var embedTemplates = require('gulp-angular-embed-templates');

var paths = {
	'build': 'dist/',
	'release': 'release/',
	'cache': 'cache/',
	'lib': 'node_modules/',
	'bootstrap': 'node_modules/bootstrap-sass/assets/',
	'mdi': 'node_modules/mdi/'
};

gulp.task('test', function (cb) {
    var cmd = 'node_modules/.bin/karma start karma.conf.js --single-run';
    if (argv.ci!=undefined&&argv.ci=='true')
        var cmd = 'export CHROME_BIN=/usr/bin/chromium-browser; xvfb-run karma start karma.conf.js --single-run';

    exec(cmd, function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
        cb(err);
    });
});

const tscConfig = require('./tsconfig.json');

var electronServer = electronConnect.server.create({path: paths.build});

// compile sass and concatenate to single css file in build dir
gulp.task('sass', function() {

	return gulp.src('src/scss/app.scss')
	  	.pipe(sass({includePaths: [
			paths.bootstrap + 'stylesheets/',
			paths.mdi + 'scss/'
		], precision: 8}))
	  	.pipe(concat(pkg.name + '.css'))
	    .pipe(gulp.dest(paths.build + '/css'));
});

gulp.task('copy-fonts', function() {

	return gulp.src([
			paths.mdi + '/fonts/**/*',
			paths.bootstrap + '/fonts/**/*'
		])
		.pipe(gulp.dest(paths.build + '/fonts'));
});

gulp.task('copy-html', function() {

	return gulp.src('src/index.html')
		.pipe(gulp.dest(paths.build));
});

gulp.task('copy-templates', function() {

	return gulp.src('src/templates/**/*.html')
		.pipe(gulp.dest(paths.build + '/templates'));
});

gulp.task('copy-img', function() {

	return gulp.src('src/img/**/*')
		.pipe(gulp.dest(paths.build + '/img'));
});

gulp.task('copy-config', function() {

	return gulp.src('src/config/**/*.json')
		.pipe(gulp.dest(paths.build + '/config'));
});

gulp.task('build', [
	'sass',
	'compile-ts',
	'copy-html',
	'copy-templates',
	'copy-img',
	'copy-fonts',
	'copy-config',
	'concat-deps',
    'test-compile-ts'
]);

// clean
gulp.task('clean', function() {
	return del([paths.build + '/**/*', paths.release + '/**/*']);
});

gulp.task('compile-ts', function () {

	return gulp
		.src('src/app/**/*.ts')
		.pipe(embedTemplates({basePath: "src", sourceType:'ts'}))
		//.pipe(sourcemaps.init())
		.pipe(typescript(tscConfig.compilerOptions))
		//.pipe(sourcemaps.write('dist/app/maps'))
		.pipe(gulp.dest(paths.build + 'app'));
});

gulp.task('test-compile-ts', function () {

    return gulp
        .src('src/test/**/*.ts')
        .pipe(typescript(tscConfig.compilerOptions))
        .pipe(gulp.dest(paths.build + 'test'));
});

gulp.task('concat-deps', function() {

	return gulp.src([
			paths.lib + '/node-uuid/uuid.js',
			paths.lib + '/angular2/bundles/angular2-polyfills.js',
			paths.lib + '/systemjs/dist/system.src.js',
			paths.lib + '/rxjs/bundles/Rx.js',
			paths.lib + '/angular2/bundles/angular2.dev.js',
			paths.lib + '/angular2/bundles/http.dev.js',
			paths.lib + '/angular2/bundles/router.dev.js'
		])
		.pipe(concat(pkg.name + '-deps.js'))
		.pipe(uglify())
		.pipe(gulp.dest(paths.build + '/lib'));
});

function watch() {

    gulp.watch('src/scss/**/*.scss', ['sass']);
    gulp.watch('src/app/**/*.ts', ['compile-ts']);
    gulp.watch('src/config/**/*.json', ['copy-config']);
    gulp.watch('src/templates/**/*.html', ['copy-templates','compile-ts']);
    gulp.watch('src/index.html', ['copy-html']);
    gulp.watch('src/img/**/*', ['copy-img']);
    gulp.watch('src/test/**/*ts', ['test-compile-ts']);
}

gulp.task('test-watch', ['build', 'prepare-package', 'package-node-dependencies'], function() {
    watch();
});

// runs the development server and sets up browser reloading
gulp.task('server', ['build', 'prepare-package', 'package-node-dependencies'], function() {

	electronServer.start();
	gulp.watch('main.js', ['prepare-package'], electronServer.restart);
	watch();
	gulp.watch('dist/**/*', electronServer.reload);
});

// copy necessary files to dist in order for them to be included in package
// and remove dev dependencies from index.html
gulp.task('prepare-package', function() {

	gulp.src('src/index.html')
		.pipe(gulp.dest(paths.build));
	return gulp.src(['main.js','package.json']).pipe(gulp.dest('dist'));
});

gulp.task('package-node-dependencies', function() {
    gulp.src('node_modules/angular2-uuid/*' )
        .pipe(gulp.dest('dist/lib/angular2-uuid/'));
});

// builds an electron app package for different platforms
gulp.task('package', [], function() {

	packager({
		dir: paths.build,
		name: pkg.name,
		platform: ['win32', 'darwin', 'linux'],
		arch: 'all',
		version: '0.36.7',
		appBundleId: pkg.name,
		appVersion: pkg.version,
		buildVersion: pkg.version,
		cache: paths.cache,
		helperBundleId: pkg.name,
		icon: 'dist/img/logo',
		out: paths.release
	}, function(err, appPath) {
		if (err)
			throw err;

		var folderPaths = appPath.toString().split(',');
		for (var i in folderPaths) {
			var fileName = folderPaths[i].substring(folderPaths[i].lastIndexOf(path.sep) + 1);
    		var output = fs.createWriteStream(paths.release + '/' + fileName + '.zip');

    		var archive = archiver('zip');
    		archive.on('error', function(err) {
  				throw err;
			});
    		archive.pipe(output);
    		archive.directory(folderPaths[i], fileName, { 'name': fileName });
    		archive.finalize();
		}
    });
});

gulp.task('default', function() {
	runSequence('clean', 'build', 'prepare-package','package-node-dependencies','test', 'package');
});<commit_msg>Use electron package v0.36.10.<commit_after>var gulp = require('gulp');
var del = require('del');
var runSequence = require('run-sequence');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var typescript = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var modRewrite = require('connect-modrewrite');
var electronConnect = require('electron-connect');
var process = require('process');
var packager = require('electron-packager');
var archiver = require('archiver');
var fs = require('fs');
var path = require('path');
var shell = require('gulp-shell');
var pkg = require('./package.json');
var exec = require('child_process').exec;
var argv = require('yargs').argv;
var embedTemplates = require('gulp-angular-embed-templates');

var paths = {
	'build': 'dist/',
	'release': 'release/',
	'cache': 'cache/',
	'lib': 'node_modules/',
	'bootstrap': 'node_modules/bootstrap-sass/assets/',
	'mdi': 'node_modules/mdi/'
};

gulp.task('test', function (cb) {
    var cmd = 'node_modules/.bin/karma start karma.conf.js --single-run';
    if (argv.ci!=undefined&&argv.ci=='true')
        var cmd = 'export CHROME_BIN=/usr/bin/chromium-browser; xvfb-run karma start karma.conf.js --single-run';

    exec(cmd, function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
        cb(err);
    });
});

const tscConfig = require('./tsconfig.json');

var electronServer = electronConnect.server.create({path: paths.build});

// compile sass and concatenate to single css file in build dir
gulp.task('sass', function() {

	return gulp.src('src/scss/app.scss')
	  	.pipe(sass({includePaths: [
			paths.bootstrap + 'stylesheets/',
			paths.mdi + 'scss/'
		], precision: 8}))
	  	.pipe(concat(pkg.name + '.css'))
	    .pipe(gulp.dest(paths.build + '/css'));
});

gulp.task('copy-fonts', function() {

	return gulp.src([
			paths.mdi + '/fonts/**/*',
			paths.bootstrap + '/fonts/**/*'
		])
		.pipe(gulp.dest(paths.build + '/fonts'));
});

gulp.task('copy-html', function() {

	return gulp.src('src/index.html')
		.pipe(gulp.dest(paths.build));
});

gulp.task('copy-templates', function() {

	return gulp.src('src/templates/**/*.html')
		.pipe(gulp.dest(paths.build + '/templates'));
});

gulp.task('copy-img', function() {

	return gulp.src('src/img/**/*')
		.pipe(gulp.dest(paths.build + '/img'));
});

gulp.task('copy-config', function() {

	return gulp.src('src/config/**/*.json')
		.pipe(gulp.dest(paths.build + '/config'));
});

gulp.task('build', [
	'sass',
	'compile-ts',
	'copy-html',
	'copy-templates',
	'copy-img',
	'copy-fonts',
	'copy-config',
	'concat-deps',
    'test-compile-ts'
]);

// clean
gulp.task('clean', function() {
	return del([paths.build + '/**/*', paths.release + '/**/*']);
});

gulp.task('compile-ts', function () {

	return gulp
		.src('src/app/**/*.ts')
		.pipe(embedTemplates({basePath: "src", sourceType:'ts'}))
		//.pipe(sourcemaps.init())
		.pipe(typescript(tscConfig.compilerOptions))
		//.pipe(sourcemaps.write('dist/app/maps'))
		.pipe(gulp.dest(paths.build + 'app'));
});

gulp.task('test-compile-ts', function () {

    return gulp
        .src('src/test/**/*.ts')
        .pipe(typescript(tscConfig.compilerOptions))
        .pipe(gulp.dest(paths.build + 'test'));
});

gulp.task('concat-deps', function() {

	return gulp.src([
			paths.lib + '/node-uuid/uuid.js',
			paths.lib + '/angular2/bundles/angular2-polyfills.js',
			paths.lib + '/systemjs/dist/system.src.js',
			paths.lib + '/rxjs/bundles/Rx.js',
			paths.lib + '/angular2/bundles/angular2.dev.js',
			paths.lib + '/angular2/bundles/http.dev.js',
			paths.lib + '/angular2/bundles/router.dev.js'
		])
		.pipe(concat(pkg.name + '-deps.js'))
		.pipe(uglify())
		.pipe(gulp.dest(paths.build + '/lib'));
});

function watch() {

    gulp.watch('src/scss/**/*.scss', ['sass']);
    gulp.watch('src/app/**/*.ts', ['compile-ts']);
    gulp.watch('src/config/**/*.json', ['copy-config']);
    gulp.watch('src/templates/**/*.html', ['copy-templates','compile-ts']);
    gulp.watch('src/index.html', ['copy-html']);
    gulp.watch('src/img/**/*', ['copy-img']);
    gulp.watch('src/test/**/*ts', ['test-compile-ts']);
}

gulp.task('test-watch', ['build', 'prepare-package', 'package-node-dependencies'], function() {
    watch();
});

// runs the development server and sets up browser reloading
gulp.task('server', ['build', 'prepare-package', 'package-node-dependencies'], function() {

	electronServer.start();
	gulp.watch('main.js', ['prepare-package'], electronServer.restart);
	watch();
	gulp.watch('dist/**/*', electronServer.reload);
});

// copy necessary files to dist in order for them to be included in package
// and remove dev dependencies from index.html
gulp.task('prepare-package', function() {

	gulp.src('src/index.html')
		.pipe(gulp.dest(paths.build));
	return gulp.src(['main.js','package.json']).pipe(gulp.dest('dist'));
});

gulp.task('package-node-dependencies', function() {
    gulp.src('node_modules/angular2-uuid/*' )
        .pipe(gulp.dest('dist/lib/angular2-uuid/'));
});

// builds an electron app package for different platforms
gulp.task('package', [], function() {

	packager({
		dir: paths.build,
		name: pkg.name,
		platform: ['win32', 'darwin', 'linux'],
		arch: 'all',
		version: '0.36.10',
		appBundleId: pkg.name,
		appVersion: pkg.version,
		buildVersion: pkg.version,
		cache: paths.cache,
		helperBundleId: pkg.name,
		icon: 'dist/img/logo',
		out: paths.release
	}, function(err, appPath) {
		if (err)
			throw err;

		var folderPaths = appPath.toString().split(',');
		for (var i in folderPaths) {
			var fileName = folderPaths[i].substring(folderPaths[i].lastIndexOf(path.sep) + 1);
    		var output = fs.createWriteStream(paths.release + '/' + fileName + '.zip');

    		var archive = archiver('zip');
    		archive.on('error', function(err) {
  				throw err;
			});
    		archive.pipe(output);
    		archive.directory(folderPaths[i], fileName, { 'name': fileName });
    		archive.finalize();
		}
    });
});

gulp.task('default', function() {
	runSequence('clean', 'build', 'prepare-package','package-node-dependencies','test', 'package');
});<|endoftext|>


<commit_before>const gulp = require('gulp');
var gutil = require('gutil');
var argv = require('yargs').argv;
var del = require('del');
var git = require('gulp-git');
var install = require('gulp-install');
var karma = require('karma').Server;
var sequence = require('gulp-sequence')
var webpack = require('webpack');
var webpackConfig = require('./config/webpack.prod.js');

//Add paramteter "--Docker" to build containers after build

//run "gulp commit -m "commit message" to test, build, and check-in to source control all in one step
//      Any failures along the way will be reported to the console and the process will stop

// run "gulp test" to discover and run all unit tests (spec.ts) files and display results
//      This will test the app without building or source control checkin

// run "gulp build" to test and build the application
//      This will not check-in to source control source control checkin

//The remaining tasks are not usually run from the command prompt and used only inside of other tasks

var paths = {
    source: "./src/",
    target: "./build/",
    css: [
        'node_modules/font-awesome/css/font-awesome.min.css',
    ],
    fonts: [
        'node_modules/bootstrap/fonts/*',
        'node_modules/font-awesome/fonts/*'
    ],
    js: [
        'node_modules/jquery/dist/jquery.min.js',
    ],
};

gulp.task('build', function (done) {
  sequence('test', ['copyFiles', 'pack'], 'packageInstall', done);
})

gulp.task('commit', function (done) {
    //Don't waist time building if no commit message was passed in
    var commitMessage = argv.m;
    if(commitMessage === undefined) {
         gutil.log('Commit mMessage required: -m "commit message"');
    } else {
         sequence('build', 'git-checkin', 'git-push', done);
        // Missing step git pull before push
    }
});

gulp.task('git-checkin', function (done) {
    var commitMessage = argv.m;
    if(commitMessage === undefined) {
         gutil.log('Commit mMessage required: -m "commit message"');
    } else {
         return gulp.src('.')
            .pipe(git.add())
            .pipe(git.commit(commitMessage));
    }
});

gulp.task('git-push', function (done) {
    git.push('origin', 'dev', function() {
        //Also push to private repository
        git.push('origin', 'dev', { args: "--repo https://paulgilchrist.visualstudio.com/_git/Angular2Template"}, done);
    });
});

gulp.task('clean', function () {
    return del.sync([paths.target + '**']);
});

gulp.task('copyRoot', function () {
    return gulp.src([paths.source + '*.*', '!' + paths.source + '*.ts']).pipe(gulp.dest(paths.target));
});

gulp.task('copyAppCss', function () {
    return gulp.src(paths.source + 'css/*.css').pipe(gulp.dest(paths.target + 'css'));
});

gulp.task('copyVendorCss', function () {
    return gulp.src(paths.source + 'css/*.css').pipe(gulp.dest(paths.target + 'css'));
});

gulp.task('copyVendorFonts', function () {
    return gulp.src(paths.fonts).pipe(gulp.dest(paths.target + 'fonts'));
});

gulp.task('copyVendorJs', function () {
    return gulp.src(paths.js).pipe(gulp.dest(paths.target + 'js'));
});

gulp.task('copyFiles', function (done) {
      sequence('clean', ['copyRoot', 'copyAppCss', 'copyVendorCss', 'copyVendorFonts', 'copyVendorJs'], done);
});

gulp.task('pack', function(done) {
   return webpack(webpackConfig, function(err, stats) {
       if(err || (stats.compilation.errors && stats.compilation.errors.length)) {
            gutil.log('[webpack] Error\n' + stats.compilation.errors);
       } else {
            gutil.log('[webpack] Completed\n' + stats.toString({
                assets: true,
                chunks: false,
                chunkModules: false,
                colors: true,
                hash: false,
                timings: false,
                version: false
            }));
            done();
       }
    });
});

gulp.task('packageInstall', function() {
    return gulp.src([paths.target + 'package.json']).pipe(install());
});

// Run test once and exit
gulp.task('test', function (done) {
    return karma.start({
        configFile: __dirname + '/karma.conf.js',
        singleRun: true
    }, function(err) {
        if (err) {
            //No need to log the error as Karma will have already logged it
        } else {
            done();
        }
    });
});
<commit_msg>Dual git push testing<commit_after>const gulp = require('gulp');
var gutil = require('gutil');
var argv = require('yargs').argv;
var del = require('del');
var git = require('gulp-git');
var install = require('gulp-install');
var karma = require('karma').Server;
var sequence = require('gulp-sequence')
var webpack = require('webpack');
var webpackConfig = require('./config/webpack.prod.js');

//Add paramteter "--Docker" to build containers after build

//run "gulp commit -m "commit message" to test, build, and check-in to source control all in one step
//      Any failures along the way will be reported to the console and the process will stop

// run "gulp test" to discover and run all unit tests (spec.ts) files and display results
//      This will test the app without building or source control checkin

// run "gulp build" to test and build the application
//      This will not check-in to source control source control checkin

//The remaining tasks are not usually run from the command prompt and used only inside of other tasks

var paths = {
    source: "./src/",
    target: "./build/",
    css: [
        'node_modules/font-awesome/css/font-awesome.min.css',
    ],
    fonts: [
        'node_modules/bootstrap/fonts/*',
        'node_modules/font-awesome/fonts/*'
    ],
    js: [
        'node_modules/jquery/dist/jquery.min.js',
    ],
};

gulp.task('build', function (done) {
  sequence('test', ['copyFiles', 'pack'], 'packageInstall', done);
})

gulp.task('commit', function (done) {
    //Don't waist time building if no commit message was passed in
    var commitMessage = argv.m;
    if(commitMessage === undefined) {
         gutil.log('Commit mMessage required: -m "commit message"');
    } else {
         sequence('build', 'git-checkin', 'git-push', done);
        // Missing step git pull before push
    }
});

gulp.task('git-checkin', function (done) {
    var commitMessage = argv.m;
    if(commitMessage === undefined) {
         gutil.log('Commit mMessage required: -m "commit message"');
    } else {
         return gulp.src('.')
            .pipe(git.add())
            .pipe(git.commit(commitMessage));
    }
});

gulp.task('git-push', function (done) {
    git.push('origin', 'dev', function() {
        //Also push to private repository
        git.push('origin', 'dev', { args: '--repo="https://paulgilchrist.visualstudio.com/_git/Angular2Template"'}, done);
    });
});

gulp.task('clean', function () {
    return del.sync([paths.target + '**']);
});

gulp.task('copyRoot', function () {
    return gulp.src([paths.source + '*.*', '!' + paths.source + '*.ts']).pipe(gulp.dest(paths.target));
});

gulp.task('copyAppCss', function () {
    return gulp.src(paths.source + 'css/*.css').pipe(gulp.dest(paths.target + 'css'));
});

gulp.task('copyVendorCss', function () {
    return gulp.src(paths.source + 'css/*.css').pipe(gulp.dest(paths.target + 'css'));
});

gulp.task('copyVendorFonts', function () {
    return gulp.src(paths.fonts).pipe(gulp.dest(paths.target + 'fonts'));
});

gulp.task('copyVendorJs', function () {
    return gulp.src(paths.js).pipe(gulp.dest(paths.target + 'js'));
});

gulp.task('copyFiles', function (done) {
      sequence('clean', ['copyRoot', 'copyAppCss', 'copyVendorCss', 'copyVendorFonts', 'copyVendorJs'], done);
});

gulp.task('pack', function(done) {
   return webpack(webpackConfig, function(err, stats) {
       if(err || (stats.compilation.errors && stats.compilation.errors.length)) {
            gutil.log('[webpack] Error\n' + stats.compilation.errors);
       } else {
            gutil.log('[webpack] Completed\n' + stats.toString({
                assets: true,
                chunks: false,
                chunkModules: false,
                colors: true,
                hash: false,
                timings: false,
                version: false
            }));
            done();
       }
    });
});

gulp.task('packageInstall', function() {
    return gulp.src([paths.target + 'package.json']).pipe(install());
});

// Run test once and exit
gulp.task('test', function (done) {
    return karma.start({
        configFile: __dirname + '/karma.conf.js',
        singleRun: true
    }, function(err) {
        if (err) {
            //No need to log the error as Karma will have already logged it
        } else {
            done();
        }
    });
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');

gulp.task('scripts', function() {
  browserify('./browser.js')
    .require('https')
    .bundle()
    .pipe(source('background.js'))
    .pipe(gulp.dest('.'));
});

gulp.task('watch', function() {

  // Watch .scss files
  gulp.watch('*.js', ['scripts']);

});

gulp.task('default', ['scripts']);
<commit_msg>Avoid watching our own output file with gulp.<commit_after>var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');

gulp.task('scripts', function() {
  browserify('./browser.js')
    .require('https')
    .bundle()
    .pipe(source('background.js'))
    .pipe(gulp.dest('.'));
});

gulp.task('watch', function() {

  // Watch .scss files
  gulp.watch(['*.js', '!background.js'], ['scripts']);

});

gulp.task('default', ['scripts']);
<|endoftext|>


<commit_before>define(
  'ephox.snooker.model.Fitment',

  [
    'ephox.compass.Arr',
    'ephox.peanut.Fun',
    'ephox.perhaps.Result',
    'global!Array',
    'global!Error',
    'global!Math'
  ],

  function (Arr, Fun, Result, Array, Error, Math) {
    var measure = function (startAddress, gridA, gridB) {
      // TODO: avoid throw in production code
      if(startAddress.row() >= gridA.length || startAddress.column() > gridA[0].length) return Result.error('invalid start address out of table bounds, row: ' + startAddress.row() + ', column: ' + startAddress.column());
      var rowRemainder = gridA.slice(startAddress.row());
      var colRemainder = rowRemainder[0].slice(startAddress.column());

      var colRequired= gridB[0].length;
      var rowRequired= gridB.length;
      return Result.value({
        rowDelta: Fun.constant(rowRemainder.length - rowRequired),
        colDelta: Fun.constant(colRemainder.length - colRequired)
      });
    };

    var rowFill = function (grid, amount, generator) {
      var nuRows = Arr.map(new Array(amount), function (row) {
        return Arr.map(grid[0], function (cell) {
          return generator.cell();
        });
      });
      return grid.concat(nuRows);
    };

    var colFill = function (grid, amount, generator) {
      return Arr.map(grid, function (row) {
        var fill = Arr.map(new Array(amount), function () {
          return generator.cell();
        });
        return row.concat(fill);
      });
    };

    var abs = function (negInt) {
      var posInt = Math.abs(negInt);
      return posInt;
    };

    var tailor = function (startAddress, gridA, delta, generator) {
      var fillCols = delta.colDelta() < 0 ? colFill : Fun.identity;
      var fillRows = delta.rowDelta() < 0 ? rowFill : Fun.identity;

      var modifiedCols = fillCols(gridA, abs(delta.colDelta()), generator);
      var tailoredGrid = fillRows(modifiedCols, abs(delta.rowDelta()), generator);
      return tailoredGrid;
    };

    return {
      measure: measure,
      tailor: tailor
    };
  }
);<commit_msg>TBIO-2546: comments<commit_after>define(
  'ephox.snooker.model.Fitment',

  [
    'ephox.compass.Arr',
    'ephox.peanut.Fun',
    'ephox.perhaps.Result',
    'global!Array',
    'global!Error',
    'global!Math'
  ],

  function (Arr, Fun, Result, Array, Error, Math) {
    /*
      Fitment, is a module used to ensure that the Inserted table (gridB) can fit squareley within the Host table (gridA).
        - measure returns a delta of rows and cols, eg:
            - col: 3 means gridB can fit with 3 spaces to spare
            - row: -5 means gridB can needs 5 more rows to completely fit into gridA
            - col: 0, row: 0 depics perfect fitment

        - tailor, requires a delta and returns grid that is built to match the delta
          eg: 3x3 gridA, with a delta col: -3, row: 2 returns a new grid 3 rows x 6 cols
    */

    var measure = function (startAddress, gridA, gridB) {
      if(startAddress.row() >= gridA.length || startAddress.column() > gridA[0].length) return Result.error('invalid start address out of table bounds, row: ' + startAddress.row() + ', column: ' + startAddress.column());
      var rowRemainder = gridA.slice(startAddress.row());
      var colRemainder = rowRemainder[0].slice(startAddress.column());

      var colRequired= gridB[0].length;
      var rowRequired= gridB.length;
      return Result.value({
        rowDelta: Fun.constant(rowRemainder.length - rowRequired),
        colDelta: Fun.constant(colRemainder.length - colRequired)
      });
    };

    var rowFill = function (grid, amount, generator) {
      var nuRows = Arr.map(new Array(amount), function (row) {
        return Arr.map(grid[0], function (cell) {
          return generator.cell();
        });
      });
      return grid.concat(nuRows);
    };

    var colFill = function (grid, amount, generator) {
      return Arr.map(grid, function (row) {
        var fill = Arr.map(new Array(amount), function () {
          return generator.cell();
        });
        return row.concat(fill);
      });
    };

    var abs = function (negInt) {
      var posInt = Math.abs(negInt);
      return posInt;
    };

    var tailor = function (startAddress, gridA, delta, generator) {
      var fillCols = delta.colDelta() < 0 ? colFill : Fun.identity;
      var fillRows = delta.rowDelta() < 0 ? rowFill : Fun.identity;

      var modifiedCols = fillCols(gridA, abs(delta.colDelta()), generator);
      var tailoredGrid = fillRows(modifiedCols, abs(delta.rowDelta()), generator);
      return tailoredGrid;
    };

    return {
      measure: measure,
      tailor: tailor
    };
  }
);<|endoftext|>


<commit_before>
/* ------------------------------------------------------------------------

    Baze Test
    v0.1.0
    Testing tool by Suitmedia

   ------------------------------------------------------------------------ */

var gulp        = require('gulp'),
    gutil       = require('gulp-util'),
    clean       = require('gulp-clean'),
    yargs       = require('yargs').argv,

    // CSS Lint
    cssLint     = require('gulp-csslint'),

    // JS Hint
    jsHint      = require('gulp-jshint'),

    // Page Speed Insight
    psi         = require('psi'),
    // Site to run PSI
    site        = yargs.url;

/* CSS Lint
--------------------------------------------------------------------------- */

var cssLintReporter = function (file) {
    gutil.log();
    gutil.log(gutil.colors.magenta(file.path));
    gutil.log('--------------------------------------------------\n');

    file.csslint.results.forEach(function(result) {
        gutil.log(gutil.colors.gray('line: ' + result.error.line));
        gutil.log('\t' + gutil.colors.blue(result.error.message));
        gutil.log('');
    });

    gutil.log('CSS lint result: ' + gutil.colors.red('✖ ' + file.csslint.errorCount + ' problems'));
};

gulp.task('css-lint', function () {
    var options = {
        'box-sizing'                : false,    // no longer support IE7
        'universal-selector'        : false,    // http://goo.gl/UbxPMq
        'unique-headings'           : false,
        'compatible-vendor-prefixes': false,    // handled by autoprefixer
        'gradients'                 : false,    // handled by autoprefixer
        'vendor-prefix'             : false,    // handled by autoprefixer
        'box-model'                 : false,    // border-box specified
        'known-properties'          : false,
        'floats'                    : false
    };

    return gulp
        .src('./css/*.css')
        .pipe(cssLint(options))
        .pipe(cssLint.reporter(cssLintReporter));

});

/* JS Hint
--------------------------------------------------------------------------- */

gulp.task('js-hint', function () {

    return gulp
        .src('./js/*.js')
        .pipe(jsHint())
        .pipe(jsHint.reporter('jshint-stylish'));

});

/* PSI Desktop
--------------------------------------------------------------------------- */

gulp.task('psi-desktop', function (cb) {

    psi({
        nokey: true,
        url: site,
        strategy: 'desktop'
    }, cb);

});

/* PSI Desktop
--------------------------------------------------------------------------- */

gulp.task('psi-mobile', function (cb) {

    psi({
        nokey: true,
        url: site,
        strategy: 'mobile'
    }, cb);

});

/* Clean
--------------------------------------------------------------------------- */

gulp.task('clean', function () {
    return gulp
        .src(['./css/', './js/'], {read: false})
        .pipe(clean());
});

/* Gulp tasks
--------------------------------------------------------------------------- */

gulp.task('lint', function () {
    gulp.start('css-lint', 'js-hint');
});<commit_msg>copy paste problem<commit_after>
/* ------------------------------------------------------------------------

    Baze Test
    v0.1.0
    Testing tool by Suitmedia

   ------------------------------------------------------------------------ */

var gulp        = require('gulp'),
    gutil       = require('gulp-util'),
    clean       = require('gulp-clean'),
    yargs       = require('yargs').argv,

    // CSS Lint
    cssLint     = require('gulp-csslint'),

    // JS Hint
    jsHint      = require('gulp-jshint'),

    // Page Speed Insight
    psi         = require('psi'),
    // Site to run PSI
    site        = yargs.url;

/* CSS Lint
--------------------------------------------------------------------------- */

var cssLintReporter = function (file) {
    gutil.log();
    gutil.log(gutil.colors.magenta(file.path));
    gutil.log('--------------------------------------------------\n');

    file.csslint.results.forEach(function(result) {
        gutil.log(gutil.colors.gray('line: ' + result.error.line));
        gutil.log('\t' + gutil.colors.blue(result.error.message));
        gutil.log('');
    });

    gutil.log('CSS lint result: ' + gutil.colors.red('✖ ' + file.csslint.errorCount + ' problems'));
};

gulp.task('css-lint', function () {
    var options = {
        'box-sizing'                : false,    // no longer support IE7
        'universal-selector'        : false,    // http://goo.gl/UbxPMq
        'unique-headings'           : false,
        'compatible-vendor-prefixes': false,    // handled by autoprefixer
        'gradients'                 : false,    // handled by autoprefixer
        'vendor-prefix'             : false,    // handled by autoprefixer
        'box-model'                 : false,    // border-box specified
        'known-properties'          : false,
        'floats'                    : false
    };

    return gulp
        .src('./css/*.css')
        .pipe(cssLint(options))
        .pipe(cssLint.reporter(cssLintReporter));

});

/* JS Hint
--------------------------------------------------------------------------- */

gulp.task('js-hint', function () {

    return gulp
        .src('./js/*.js')
        .pipe(jsHint())
        .pipe(jsHint.reporter('jshint-stylish'));

});

/* PSI Desktop
--------------------------------------------------------------------------- */

gulp.task('psi-desktop', function (cb) {

    psi({
        nokey: true,
        url: site,
        strategy: 'desktop'
    }, cb);

});

/* PSI Mobile
--------------------------------------------------------------------------- */

gulp.task('psi-mobile', function (cb) {

    psi({
        nokey: true,
        url: site,
        strategy: 'mobile'
    }, cb);

});

/* Clean
--------------------------------------------------------------------------- */

gulp.task('clean', function () {
    return gulp
        .src(['./css/', './js/'], {read: false})
        .pipe(clean());
});

/* Gulp tasks
--------------------------------------------------------------------------- */

gulp.task('lint', function () {
    gulp.start('css-lint', 'js-hint');
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var mocha = require('gulp-mocha');
var file = require('gulp-file');
var istanbul = require('gulp-istanbul');
var babel = require("gulp-babel");
var webpack = require('webpack-stream');

// var browserify = require('./support/browserify.js');

gulp.task('build-webpack', function() {
  return gulp.src('lib/*.js')
    .pipe(webpack({
      entry: './lib/index.js',
      output: {
        filename: 'socket.io.js',
      },
    }))
    .pipe(babel())
    .pipe(gulp.dest('./'));
});

// By default, individual js files are transformed by babel and exported to /dist
gulp.task("babel", function () {
  return gulp.src("lib/*.js")
    .pipe(babel())
    .pipe(gulp.dest("dist"));
});

gulp.task('build', function(){
  browserify(function(err, out){
    if(err){
      throw err;
    }else{
      gulp.src('')
        .pipe(file('socket.io.js', out))
        .pipe(gulp.dest('./'));
    }
  });
});

gulp.task('test-node', function(){
  gulp.src(['test/*.js', 'test/support/*.js'])
    .pipe(mocha({
      reporter: 'dot'
    }))
    .once('error', function () {
      process.exit(1);
    })
    .once('end', function () {
      process.exit();
    });
});

gulp.task('istanbul-pre-test', function () {
  return gulp.src(['lib/**/*.js'])
    // Covering files
    .pipe(istanbul())
    // Force `require` to return covered files
    .pipe(istanbul.hookRequire());
});

gulp.task('test-cov', ['istanbul-pre-test'], function(){
  gulp.src(['test/*.js', 'test/support/*.js'])
    .pipe(mocha({
      reporter: 'dot'
    }))
    .pipe(istanbul.writeReports())
    .once('error', function (){
      process.exit(1);
    })
    .once('end', function (){
      process.exit();
    });
});

<commit_msg>disable compact by default, enabled browserify<commit_after>var gulp = require('gulp');
var mocha = require('gulp-mocha');
var file = require('gulp-file');
var istanbul = require('gulp-istanbul');
var babel = require("gulp-babel");
var webpack = require('webpack-stream');

var browserify = require('./support/browserify.js');

gulp.task('build-webpack', function() {
  return gulp.src('lib/*.js')
    .pipe(webpack({
      entry: './lib/index.js',
      output: {
        filename: 'socket.io.js',
      },
    }))
    .pipe(babel({
      compact: false
    }))
    .pipe(gulp.dest('./'));
});

// By default, individual js files are transformed by babel and exported to /dist
gulp.task("babel", function () {
  return gulp.src("lib/*.js")
    .pipe(babel())
    .pipe(gulp.dest("dist"));
});

gulp.task('build', function(){
  browserify(function(err, out){
    if(err){
      throw err;
    }else{
      gulp.src('')
        .pipe(file('socket.io.js', out))
        .pipe(gulp.dest('./'));
    }
  });
});

gulp.task('test-node', function(){
  gulp.src(['test/*.js', 'test/support/*.js'])
    .pipe(mocha({
      reporter: 'dot'
    }))
    .once('error', function () {
      process.exit(1);
    })
    .once('end', function () {
      process.exit();
    });
});

gulp.task('istanbul-pre-test', function () {
  return gulp.src(['lib/**/*.js'])
    // Covering files
    .pipe(istanbul())
    // Force `require` to return covered files
    .pipe(istanbul.hookRequire());
});

gulp.task('test-cov', ['istanbul-pre-test'], function(){
  gulp.src(['test/*.js', 'test/support/*.js'])
    .pipe(mocha({
      reporter: 'dot'
    }))
    .pipe(istanbul.writeReports())
    .once('error', function (){
      process.exit(1);
    })
    .once('end', function (){
      process.exit();
    });
});

<|endoftext|>


<commit_before>'use strict'
const gulp = require('gulp')
const exec = require('child_process').exec;
const seq = require('run-sequence');
const DEVELOPMENT_IMAGE = 'movie-library-dev'
const DEVELOPMENT_CONTAINER = 'movie-library-dev'
const DEPENDENCIES_IMAGE = 'movie-library-dep'
const DEPENDENCIES_CONTAINER = 'movie-library-dep'
const DEVELOPMENT_IMAGE_FILE = 'Dockerfile.dev'
const DEPENDENCIES_IMAGE_FILE = 'Dockerfile.dev.dep'

async function cmd (command) {
  return new Promise((resolve, reject) => {
    exec(command, (err, stdout, stderr) => {
      if (err) {
        console.log(stdout);
        reject(stderr)
      } else {
        console.log(stdout);
        resolve(stdout)
      }
    })
  })
}

gulp.task('dev:build', () => {
  const buildDependenciesImage = cmd(`docker build -t ${DEPENDENCIES_IMAGE} -f ${DEPENDENCIES_IMAGE_FILE} .`)
  const buildDevelopmentImage = cmd(`docker build -t ${DEVELOPMENT_IMAGE} -f ${DEVELOPMENT_IMAGE_FILE} .`)
  return Promise.all([buildDependenciesImage, buildDevelopmentImage])
})

gulp.task('dev:run', () => {
  return cmd(`docker run -d --rm -p 3000:3000 -v %cd%:/opt/project --volumes-from ${DEPENDENCIES_CONTAINER} --name ${DEVELOPMENT_CONTAINER} ${DEVELOPMENT_IMAGE}`)
})

gulp.task('dev:rm', async () => {
  const exists = await cmd(`docker ps -q -f name=${DEVELOPMENT_CONTAINER}`)
  if (exists) {
    return cmd(`docker rm -v -f ${DEVELOPMENT_CONTAINER}`)
  }
})

gulp.task('dev:dep:create', () => {
  return cmd(`docker create --name ${DEPENDENCIES_CONTAINER} ${DEPENDENCIES_IMAGE}`)
})

gulp.task('dev:dep:rm', async () => {
  const exists = await cmd(`docker ps -a -q -f name=${DEPENDENCIES_CONTAINER}`)
  if (exists) {
    return cmd(`docker rm -v -f ${DEPENDENCIES_CONTAINER}`)
  }
})

gulp.task('dev:clean', ['dev:rm', 'dev:dep:rm'])

gulp.task('dev', cb => {
  seq(
    ['dev:build', 'dev:clean'],
    'dev:dep:create',
    'dev:run',
    cb
  )
})

gulp.task('test', () => {
  return cmd(`docker exec ${DEVELOPMENT_CONTAINER} npm test`)
})

gulp.task('test:acceptance', () => {
  return cmd(`docker exec ${DEVELOPMENT_CONTAINER} npm run-script test:acceptance`)
})

process.on('uncaughtException', (err) => {
  console.log(`${err}`)
})
<commit_msg>gulp test tasks fixed: display only test results<commit_after>'use strict'
const gulp = require('gulp')
const exec = require('child_process').exec;
const seq = require('run-sequence');
const DEVELOPMENT_IMAGE = 'movie-library-dev'
const DEVELOPMENT_CONTAINER = 'movie-library-dev'
const DEPENDENCIES_IMAGE = 'movie-library-dep'
const DEPENDENCIES_CONTAINER = 'movie-library-dep'
const DEVELOPMENT_IMAGE_FILE = 'Dockerfile.dev'
const DEPENDENCIES_IMAGE_FILE = 'Dockerfile.dev.dep'

async function cmd (command, options = {}) {
  return new Promise((resolve, reject) => {
    exec(command, (err, stdout, stderr) => {
      if (err && !options.omitErr) {
        console.log(stdout);
        reject(stderr)
      } else {
        console.log(stdout);
        resolve(stdout)
      }
    })
  })
}

gulp.task('dev:build', () => {
  const buildDependenciesImage = cmd(`docker build -t ${DEPENDENCIES_IMAGE} -f ${DEPENDENCIES_IMAGE_FILE} .`)
  const buildDevelopmentImage = cmd(`docker build -t ${DEVELOPMENT_IMAGE} -f ${DEVELOPMENT_IMAGE_FILE} .`)
  return Promise.all([buildDependenciesImage, buildDevelopmentImage])
})

gulp.task('dev:run', () => {
  return cmd(`docker run -d --rm -p 3000:3000 -v %cd%:/opt/project --volumes-from ${DEPENDENCIES_CONTAINER} --name ${DEVELOPMENT_CONTAINER} ${DEVELOPMENT_IMAGE}`)
})

gulp.task('dev:rm', async () => {
  const exists = await cmd(`docker ps -q -f name=${DEVELOPMENT_CONTAINER}`)
  if (exists) {
    return cmd(`docker rm -v -f ${DEVELOPMENT_CONTAINER}`)
  }
})

gulp.task('dev:dep:create', () => {
  return cmd(`docker create --name ${DEPENDENCIES_CONTAINER} ${DEPENDENCIES_IMAGE}`)
})

gulp.task('dev:dep:rm', async () => {
  const exists = await cmd(`docker ps -a -q -f name=${DEPENDENCIES_CONTAINER}`)
  if (exists) {
    return cmd(`docker rm -v -f ${DEPENDENCIES_CONTAINER}`)
  }
})

gulp.task('dev:clean', ['dev:rm', 'dev:dep:rm'])

gulp.task('dev', cb => {
  seq(
    ['dev:build', 'dev:clean'],
    'dev:dep:create',
    'dev:run',
    cb
  )
})

gulp.task('test', () => {
  return cmd(`docker exec ${DEVELOPMENT_CONTAINER} npm test`, {omitErr:true})
})

gulp.task('test:acceptance', () => {
  return cmd(`docker exec ${DEVELOPMENT_CONTAINER} npm run-script test:acceptance`, {omitErr:true})
})

process.on('uncaughtException', (err) => {
  console.log(`${err}`)
})
<|endoftext|>


<commit_before>
var execSync = require('child_process').execSync;
var path = require('path');

var gulp = require('gulp');
var jade = require('gulp-pug');
var less = require('gulp-less');
var babel = require('gulp-babel');
var plumber = require('gulp-plumber');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
var markdown = require('jstransformer')(require('jstransformer-markdown'))

gulp.task('less', function () {
  return gulp.src('src/less/style.less')
    .pipe(less({
      paths: [
        path.join(__dirname, 'vendor'),
      ]
    }))
    .pipe(autoprefixer({
      browsers: ['last 2 versions'],
      cascade: false,
    }))
    .pipe(gulp.dest('public/css'));
});

gulp.task('javascript', function() {
  return gulp.src('src/javascript/**/*.js')
    .pipe(babel())
    .pipe(gulp.dest('public/js'));
});

gulp.task('templates', gulp.series(gulp.parallel('javascript', 'less'), function() {
  return gulp.src(['src/templates/**/*.jade', '!src/templates/layout.jade'])
    .pipe(jade({
      locals: {}
    }))
    .pipe(gulp.dest('public/'));
}));

gulp.task('static', function() {
  return gulp.src('src/static/**/*')
    .pipe(gulp.dest('public'));
});

gulp.task('web', gulp.parallel('javascript', 'less', 'templates', 'static'));

gulp.task('xml', function(cb) {
  switch (process.platform) {
    case 'win32':
      execSync('.\\src\\findxml.bat')
      execSync('.\\src\\xml2json.py')
      execSync('.\\src\\json2public.py')
      break;

    default:
      execSync('./src/findxml')
      execSync('./src/xml2json.py')
      execSync('./src/json2public.py')
      break;
  }

  cb();
});

gulp.task('clean', function() {
  return del([
    'public/**',
    'xml/source/**',
    'xml/json/**',
  ]);
});

gulp.task('build', gulp.parallel('xml', 'web'));

gulp.task('default', gulp.parallel('build'));

gulp.task('watch', gulp.series('web', function () {
  gulp.watch('src/templates/**/*', ['web']);
  gulp.watch('src/less/**/*', ['web']);
  gulp.watch('src/javascript/**/*', ['web']);
  gulp.watch('src/static/**/*', ['web']);
}));
<commit_msg>gulp 4 porting fixes and removal of warnings<commit_after>
var execSync = require('child_process').execSync;
var path = require('path');

var gulp = require('gulp');
var jade = require('gulp-pug');
var less = require('gulp-less');
var babel = require('gulp-babel');
var plumber = require('gulp-plumber');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
var markdown = require('jstransformer-markdown');

gulp.task('less', function () {
  return gulp.src('src/less/style.less')
    .pipe(less({
      paths: [
        path.join(__dirname, 'vendor'),
      ]
    }))
    .pipe(autoprefixer({
      browsers: ['last 2 versions'],
      cascade: false,
    }))
    .pipe(gulp.dest('public/css'));
});

gulp.task('javascript', function() {
  return gulp.src('src/javascript/**/*.js')
    .pipe(babel())
    .pipe(gulp.dest('public/js'));
});

gulp.task('templates', gulp.series(gulp.parallel('javascript', 'less'), function() {
  return gulp.src(['src/templates/**/*.jade', '!src/templates/layout.jade'])
    .pipe(jade({
      locals: {}
    }))
    .pipe(gulp.dest('public/'));
}));

gulp.task('static', function() {
  return gulp.src('src/static/**/*')
    .pipe(gulp.dest('public'));
});

gulp.task('web', gulp.parallel('javascript', 'less', 'templates', 'static'));

gulp.task('xml', function(cb) {
  switch (process.platform) {
    case 'win32':
      execSync('.\\src\\findxml.bat');
      execSync('.\\src\\xml2json.py');
      execSync('.\\src\\json2public.py');
      break;

    default:
      execSync('./src/findxml');
      execSync('./src/xml2json.py');
      execSync('./src/json2public.py');
      break;
  }

  cb();
});

gulp.task('clean', function() {
  return del([
    'public/**',
    'xml/source/**',
    'xml/json/**',
  ]);
});

gulp.task('build', gulp.parallel('xml', 'web'));

gulp.task('watch', gulp.series('web', function () {
  gulp.watch('src/templates/**/*', gulp.series('web'));
  gulp.watch('src/less/**/*', gulp.series('web'));
  gulp.watch('src/javascript/**/*', gulp.series('web'));
  gulp.watch('src/static/**/*', gulp.series('web'));
}));
<|endoftext|>


<commit_before>var gulp = require("gulp");
var shell = require("gulp-shell");

var scriptGlobs = ["src/**/*.ts"];

gulp.task("typescript", function() {
	return gulp.src(scriptGlobs)
        .pipe(shell(["node ../TypeScript/built/local/tsc src/styx.ts --out dist/styx.js"]));
});

gulp.task("default", function() {
    return gulp.watch(scriptGlobs, ["typescript"]);
});
<commit_msg>Run 'typescript' task when starting gulp watcher<commit_after>var gulp = require("gulp");
var shell = require("gulp-shell");

var scriptGlobs = ["src/**/*.ts"];

gulp.task("typescript", function() {
	return gulp.src(scriptGlobs)
        .pipe(shell(["node ../TypeScript/built/local/tsc src/styx.ts --out dist/styx.js"]));
});

gulp.task("default", ["typescript"], function() {
    return gulp.watch(scriptGlobs, ["typescript"]);
});
<|endoftext|>


<commit_before>/**
 * starter-vanilla
 * gulpfile.js
 */

var browserify = require('browserify'),
      watchify = require('watchify'),
      babelify = require("babelify"),
          gulp = require('gulp'),
        source = require('vinyl-source-stream'),
        buffer = require('vinyl-buffer'),
    sourcemaps = require('gulp-sourcemaps'),
         gutil = require('gulp-util'),
        uglify = require('gulp-uglify'),
           del = require('del'),
          sass = require('gulp-sass'),
  autoprefixer = require('gulp-autoprefixer'),
        concat = require('gulp-concat'),
   browserSync = require('browser-sync');

/**
 * Task - Default (Watch)
 */
gulp.task('default', ['watch']);

/**
 * Task - Build
 */
gulp.task('build', [
    'clean',
    'browserify',
    'index',
    'sass',
    'assets'
]);

/**
 * Task - Watch
 */
gulp.task('watch', [
    'clean',
    'watchTask',
    'watchify',
    'index',
    'sass',
    'assets'
], function () {
    gulp.start(['browserSync']);
});

/**
 * Task - Browserify
 */
gulp.task('browserify', function () {

    var bundler = browserify('./src/app.js', {debug:true});

    // Transforms go here
    // e.g. bundler.transform(reactify);
    bundler.transform(babelify);

    return bundler.bundle()
        .pipe( source('bundle.js') )
        .pipe( buffer() )
        .pipe( sourcemaps.init({loadMaps: true}) )
            .pipe( uglify() )
            .on('error', gutil.log)
        .pipe( sourcemaps.write('./') )
        .pipe( gulp.dest('./dist') );
});

/**
 * Task - Watchify
 */
gulp.task('watchify', function () {

    var options = watchify.args;
    options.debug = true;

    var bundler = watchify( browserify('./src/app.js', options) );

    // Transforms go here
    // e.g. bundler.transform(reactify);
    bundler.transform(babelify);

    function rebundle () {
        return bundler.bundle()
            .on('error', gutil.log)
            .pipe( source('bundle.js') )
            .pipe( buffer() )
            .pipe( sourcemaps.init({loadMaps: true}) )
            .pipe( sourcemaps.write('./') )
            .pipe( gulp.dest('./dist') )
            .pipe( browserSync.stream() );
    }

    bundler.on('update', rebundle);
    return rebundle();
});

/**
 * Task - BrowserSync
 */
gulp.task('browserSync', function () {

    browserSync({
        browser: 'google chrome canary',
        online: false,
        logSnippet: false,
        notify: false,
        ghostMode: false,
        server: {
            baseDir: './dist'
        }
    });
});

/**
 * Task - WatchTask
 */
gulp.task('watchTask', function () {

    gulp.watch('./src/index.html', ['index']);
    gulp.watch('./src/assets/**/*.*', ['assets']);
    gulp.watch('./src/sass/**/*.scss', ['sass']);
});

/**
 * Task - Index
 */
gulp.task('index', function () {

    return gulp.src('./src/index.html')
        .pipe( gulp.dest('./dist') )
        .pipe( browserSync.stream() );
});

/**
 * Task - Sass
 */
gulp.task('sass', function () {

    return gulp.src('./src/sass/*.scss')
        .pipe( sourcemaps.init() )
            .pipe( sass({
                outputStyle: 'compressed',
                errLogToConsole: true
            }) )
            .on('error', function(err) {
                  console.error(err.toString());
                  this.emit('end');
            })
            .pipe( autoprefixer() )
            .pipe( concat('app.css') )
        .pipe( sourcemaps.write('./') )
        .pipe( gulp.dest('./dist') )
        .pipe( browserSync.stream({match: '**/*.css'}) );
});

/**
 * Task - Assets
 */
gulp.task('assets', function () {

    return gulp.src('./src/assets/**/*.*')
        .pipe( gulp.dest('./dist/assets') )
        .pipe( browserSync.stream() );
});

/**
 * Task - Clean
 */
gulp.task('clean', function (cb) {

    del.sync(['dist']);
    cb(null);
});<commit_msg>Added "options" variable for setting browser / proxy server for Browsersync at the top of gulpfile<commit_after>/**
 * starter-vanilla
 * gulpfile.js
 */

var browserify = require('browserify'),
      watchify = require('watchify'),
      babelify = require("babelify"),
          gulp = require('gulp'),
        source = require('vinyl-source-stream'),
        buffer = require('vinyl-buffer'),
    sourcemaps = require('gulp-sourcemaps'),
         gutil = require('gulp-util'),
        uglify = require('gulp-uglify'),
           del = require('del'),
          sass = require('gulp-sass'),
  autoprefixer = require('gulp-autoprefixer'),
        concat = require('gulp-concat'),
   browserSync = require('browser-sync');

/**
 * Options
 */
var options = {
    /**
     * @type {string} Proxy server to use with Browsersync
     */
    // proxyServer: 'http://localhost:8000',
    /**
     * @type {string} Name of browser Browsersync should open
     */
    // browser: 'google chrome'
};

/**
 * Task - Default (Watch)
 */
gulp.task('default', ['watch']);

/**
 * Task - Build
 */
gulp.task('build', [
    'clean',
    'browserify',
    'index',
    'sass',
    'assets'
]);

/**
 * Task - Watch
 */
gulp.task('watch', [
    'clean',
    'watchTask',
    'watchify',
    'index',
    'sass',
    'assets'
], function () {
    gulp.start(['browserSync']);
});

/**
 * Task - Browserify
 */
gulp.task('browserify', function () {

    var bundler = browserify('./src/app.js', {debug:true});

    // Transforms go here
    // e.g. bundler.transform(reactify);
    bundler.transform(babelify);

    return bundler.bundle()
        .pipe( source('bundle.js') )
        .pipe( buffer() )
        .pipe( sourcemaps.init({loadMaps: true}) )
            .pipe( uglify() )
            .on('error', gutil.log)
        .pipe( sourcemaps.write('./') )
        .pipe( gulp.dest('./dist') );
});

/**
 * Task - Watchify
 */
gulp.task('watchify', function () {

    var options = watchify.args;
    options.debug = true;

    var bundler = watchify( browserify('./src/app.js', options) );

    // Transforms go here
    // e.g. bundler.transform(reactify);
    bundler.transform(babelify);

    function rebundle () {
        return bundler.bundle()
            .on('error', gutil.log)
            .pipe( source('bundle.js') )
            .pipe( buffer() )
            .pipe( sourcemaps.init({loadMaps: true}) )
            .pipe( sourcemaps.write('./') )
            .pipe( gulp.dest('./dist') )
            .pipe( browserSync.stream() );
    }

    bundler.on('update', rebundle);
    return rebundle();
});

/**
 * Task - BrowserSync
 */
gulp.task('browserSync', function () {

    var bsOptions = {
        browser: options.browser || 'google chrome',
        online: false,
        logSnippet: false,
        notify: false,
        ghostMode: false,
        server: {
            baseDir: './dist'
        }
    };

    if (options.proxyServer) {
        bsOptions.proxy = options.proxyServer;
        delete bsOptions.server;
    }

    browserSync(bsOptions);
});

/**
 * Task - WatchTask
 */
gulp.task('watchTask', function () {

    gulp.watch('./src/index.html', ['index']);
    gulp.watch('./src/assets/**/*.*', ['assets']);
    gulp.watch('./src/sass/**/*.scss', ['sass']);
});

/**
 * Task - Index
 */
gulp.task('index', function () {

    return gulp.src('./src/index.html')
        .pipe( gulp.dest('./dist') )
        .pipe( browserSync.stream() );
});

/**
 * Task - Sass
 */
gulp.task('sass', function () {

    return gulp.src('./src/sass/*.scss')
        .pipe( sourcemaps.init() )
            .pipe( sass({
                outputStyle: 'compressed',
                errLogToConsole: true
            }) )
            .on('error', function(err) {
                  console.error(err.toString());
                  this.emit('end');
            })
            .pipe( autoprefixer() )
            .pipe( concat('app.css') )
        .pipe( sourcemaps.write('./') )
        .pipe( gulp.dest('./dist') )
        .pipe( browserSync.stream({match: '**/*.css'}) );
});

/**
 * Task - Assets
 */
gulp.task('assets', function () {

    return gulp.src('./src/assets/**/*.*')
        .pipe( gulp.dest('./dist/assets') )
        .pipe( browserSync.stream() );
});

/**
 * Task - Clean
 */
gulp.task('clean', function (cb) {

    del.sync(['dist']);
    cb(null);
});<|endoftext|>


<commit_before>//
// CSS Basics gulpfile
//

'use strict';

var gulp = require('gulp');
var rename = require('gulp-rename');
var header = require('gulp-header');
var sass = require('gulp-sass');
var clone = require('gulp-clone');
var merge = require('merge-stream');
var postcss = require('gulp-postcss');
var minify = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('autoprefixer');
var flexibility = require('postcss-flexibility'); // testing
var sassdoc = require('sassdoc');
var cp = require('child_process'); // native

var pkg = require('./package.json');
pkg.year = String(new Date().getFullYear());

var browserlist = ['> 1%', 'last 2 versions', 'Firefox ESR'];

var sassOptions = {
  outputStyle: 'expanded',
  sourceComments: false
};

var banner = '/*!\n' +
             ' * <%= pkg.title %> v<%= pkg.version %> <<%= pkg.homepage %>>\n' +
             ' * Copyright 2014-<%= pkg.year %> <%= pkg.author.name %> <<%= pkg.author.url %>>\n' +
             ' * Released under the <%= pkg.license %> license <https://github.com/cheich/CSS-Basics/blob/master/LICENSE>\n' +
             ' */\n';

var themeBanner = '/*!\n' +
                  ' * Theme build on CSS Basics v<%= pkg.version %>\n' +
                  ' */\n';

//
// Default task
//
gulp.task('default', ['basics', 'custom']);

//
// Compile CSS Basics framework
//
gulp.task('basics', function() {
  var stream = gulp.src('scss/basics.scss')
    .pipe(sourcemaps.init())
    .pipe(sass(sassOptions).on('error', function(error) {
      throw(error.message);
    }))
    .pipe(postcss([
      flexibility,
      autoprefixer({ browsers: browserlist })
    ]))
    .pipe(header(banner, { pkg: pkg }));

  var main = stream.pipe(clone())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./dist'));

  var min = stream.pipe(clone())
    .pipe(rename({ suffix: '.min' }))
    .pipe(minify())
    .pipe(gulp.dest('./dist'));

  return merge(main, min);
});

//
// Compile a custom build of the CSS Basics framework
//
gulp.task('custom', function() {
  var cpkg = pkg;
  cpkg.version = pkg.version + ' CUSTOM BUILD';

  var stream = gulp.src('scss/basics-*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass(sassOptions).on('error', function(error) {
      throw(error.message);
    }))
    .pipe(postcss([
      flexibility,
      autoprefixer({ browsers: browserlist })
    ]))
    .pipe(header(banner, { pkg: pkg }));

  var main = stream.pipe(clone())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./dist'));

  var min = stream.pipe(clone())
    .pipe(rename({ suffix: '.min' }))
    .pipe(minify())
    .pipe(gulp.dest('./dist'));

  return merge(main, min);
});

//
// Compile documentation theme
//
gulp.task('doc-style', function() {
  var stream = gulp.src('docs/assets/_scss/**/*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass(sassOptions).on('error', function(error) {
      throw(error.message);
    }))
    .pipe(postcss([
      flexibility,
      autoprefixer({ browsers: browserlist })
    ]))
    .pipe(header(banner, { pkg: pkg }));

  var main = stream.pipe(clone())
    .pipe(sourcemaps.write('./', {
      sourceRoot: './'
    }))
    .pipe(gulp.dest('./docs/assets/css'));

  var min = stream.pipe(clone())
    .pipe(rename({ suffix: '.min' }))
    .pipe(minify())
    .pipe(gulp.dest('./docs/assets/css'));

  return merge(main, min);
});

//
// Sass documentation
//
gulp.task('sassdoc', function() {
  return gulp.src('./scss/basics/**/*.scss')
    .pipe(sassdoc({
      dest: 'docs/_site/sassdoc'
    }));
});

//
// Build HTML documentation
//
gulp.task('doc', ['doc-style'], function() {
  return cp.spawn('jekyll.bat', ['build'], {
    stdio: 'inherit',
    cwd: 'docs'
  });
});

//
// Watch all changes
//
gulp.task('watch', function() {
  gulp.watch('scss/basics-*.scss', ['custom']);
  gulp.watch(['scss/basics.scss', 'scss/basics/**/*.scss'], ['basics']);
  cp.spawn('jekyll.bat', ['build', '--watch'], {
    stdio: 'inherit',
    cwd: 'docs'
  });
});
<commit_msg>Remove doc stuff<commit_after>//
// CSS Basics gulpfile
//

'use strict';

var gulp = require('gulp');
var rename = require('gulp-rename');
var header = require('gulp-header');
var sass = require('gulp-sass');
var clone = require('gulp-clone');
var merge = require('merge-stream');
var postcss = require('gulp-postcss');
var minify = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('autoprefixer');
var flexibility = require('postcss-flexibility'); // testing

var pkg = require('./package.json');
pkg.year = String(new Date().getFullYear());

var browserlist = ['> 1%', 'last 2 versions', 'Firefox ESR'];

var sassOptions = {
  outputStyle: 'expanded',
  sourceComments: false
};

var banner = '/*!\n' +
             ' * <%= pkg.title %> v<%= pkg.version %> <<%= pkg.homepage %>>\n' +
             ' * Copyright 2014-<%= pkg.year %> <%= pkg.author.name %> <<%= pkg.author.url %>>\n' +
             ' * Released under the <%= pkg.license %> license <https://github.com/cheich/css-basics/blob/master/LICENSE>\n' +
             ' */\n';

//
// Default task
//
gulp.task('default', ['basics', 'custom']);

//
// Compile CSS Basics framework
//
gulp.task('basics', function() {
  var stream = gulp.src('scss/basics.scss')
    .pipe(sourcemaps.init())
    .pipe(sass(sassOptions).on('error', function(error) {
      throw(error.message);
    }))
    .pipe(postcss([
      flexibility,
      autoprefixer({ browsers: browserlist })
    ]))
    .pipe(header(banner, { pkg: pkg }));

  var main = stream.pipe(clone())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./dist'));

  var min = stream.pipe(clone())
    .pipe(rename({ suffix: '.min' }))
    .pipe(minify())
    .pipe(gulp.dest('./dist'));

  return merge(main, min);
});

//
// Compile a custom build of the CSS Basics framework
//
gulp.task('custom', function() {
  var cpkg = pkg;
  cpkg.version = pkg.version + ' CUSTOM BUILD';

  var stream = gulp.src('scss/basics-*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass(sassOptions).on('error', function(error) {
      throw(error.message);
    }))
    .pipe(postcss([
      flexibility,
      autoprefixer({ browsers: browserlist })
    ]))
    .pipe(header(banner, { pkg: cpkg }));

  var main = stream.pipe(clone())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./dist'));

  var min = stream.pipe(clone())
    .pipe(rename({ suffix: '.min' }))
    .pipe(minify())
    .pipe(gulp.dest('./dist'));

  return merge(main, min);
});

//
// Watch all changes
//
gulp.task('watch', function() {
  gulp.watch('scss/basics-*.scss', ['custom']);
  gulp.watch(['scss/basics.scss', 'scss/basics/**/*.scss'], ['basics']);
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var less = require('gulp-less');
var cleanCSS = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('default', ['less', 'watch']);

gulp.task('less', function () {
  return gulp.src('assets/less/**/style.less')
          .pipe(sourcemaps.init())
          .pipe(less())
          .pipe(cleanCSS({
            compatibility: 'ie8'
          }))
          .pipe(sourcemaps.write())
          .pipe(gulp.dest('assets/css'));
});

gulp.task('watch', function () {
  gulp.watch(['assets/**/*.less'], ['less']);
  // gulp.watch(['assets/js/inc/*.js'], ['js']);
});<commit_msg>Add bootstrap-js and bootstrap-fonts tasks<commit_after>var gulp = require('gulp');
var less = require('gulp-less');
var cleanCSS = require('gulp-clean-css');
var sourcemaps = require('gulp-sourcemaps');

// The default Gulp.js task
gulp.task('default', ['bootstrap-fonts', 'bootstrap-js', 'less', 'watch']);

// Rebuild CSS from LESS
gulp.task('less', function () {
    return gulp.src('assets/less/**/style.less')
            .pipe(sourcemaps.init())
            .pipe(less())
            .pipe(cleanCSS({
                compatibility: 'ie8'
            }))
            .pipe(sourcemaps.write())
            .pipe(gulp.dest('assets/css'));
});

// Copy Bootstrap js assets in assets/js
gulp.task('bootstrap-js', function () {
    return gulp.src('node_modules/bootstrap/dist/js/bootstrap.min.js')
            .pipe(gulp.dest('assets/js'));
});

// Copy Bootstrap font files in assets/fonts
gulp.task('bootstrap-fonts', function () {
    return gulp.src('node_modules/bootstrap/dist/fonts/*')
            .pipe(gulp.dest('assets/fonts/'));
});

// Watch for LESS and JS file changes
gulp.task('watch', function () {
    gulp.watch(['assets/**/*.less'], ['less']);
    // gulp.watch(['assets/js/*.js'], ['js']);
});<|endoftext|>