<commit_before>'use strict';

// modules
var assemble = require('fabricator-assemble');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var concat = require('gulp-concat');
var csso = require('gulp-csso');
var del = require('del');
var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
var prefix = require('gulp-autoprefixer');
var rename = require('gulp-rename');
var reload = browserSync.reload;
var runSequence = require('run-sequence');
var sass = require('gulp-sass');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');

// configuration
var config = {
	dev: gutil.env.dev,
	src: {
		scripts: {
			fabricator: [
				'./src/assets/fabricator/scripts/prism.js',
				'./src/assets/fabricator/scripts/fabricator.js'
			],
			toolkit: './src/assets/toolkit/scripts/toolkit.js'
		},
		styles: {
			fabricator: './src/assets/fabricator/styles/fabricator.scss',
			toolkit: './src/assets/toolkit/styles/toolkit.scss'
		},
		images: 'src/assets/toolkit/images/**/*',
		views: './src/toolkit/views/*.html',
		materials: [
			'components',
			'structures',
			'templates',
			'documentation'
		]
	},
	dest: './dist'
};

// clean
gulp.task('clean', function (cb) {
	del([config.dest], cb);
});

// styles
gulp.task('styles:fabricator', function () {
	return gulp.src(config.src.styles.fabricator)
		.pipe(sass({
			errLogToConsole: true
		}))
		.pipe(prefix('last 1 version'))
		.pipe(gulpif(!config.dev, csso()))
		.pipe(rename('f.css'))
		.pipe(gulp.dest(config.dest + '/assets/fabricator/styles'))
		.pipe(gulpif(config.dev, reload({stream:true})));
});

gulp.task('styles:toolkit', function () {
	return gulp.src(config.src.styles.toolkit)
		.pipe(sass({
			errLogToConsole: true
		}))
		.pipe(prefix('last 1 version'))
		.pipe(gulpif(!config.dev, csso()))
		.pipe(gulp.dest(config.dest + '/assets/toolkit/styles'))
		.pipe(gulpif(config.dev, reload({stream:true})));
});

gulp.task('styles', ['styles:fabricator', 'styles:toolkit']);

// scripts
gulp.task('scripts:fabricator', function () {
	return gulp.src(config.src.scripts.fabricator)
		.pipe(concat('f.js'))
		.pipe(gulpif(!config.dev, uglify()))
		.pipe(gulp.dest(config.dest + '/assets/fabricator/scripts'));
});

gulp.task('scripts:toolkit', function () {
	return browserify(config.src.scripts.toolkit)
		.bundle()
		.on('error', function (error) {
			gutil.log(gutil.colors.red(error));
			this.emit('end');
		})
		.pipe(source('toolkit.js'))
		.pipe(gulpif(!config.dev, streamify(uglify())))
		.pipe(gulp.dest(config.dest + '/assets/toolkit/scripts'));
});

gulp.task('scripts', ['scripts:fabricator', 'scripts:toolkit']);

// images
gulp.task('images', ['favicon'], function () {
	return gulp.src(config.src.images)
		.pipe(imagemin())
		.pipe(gulp.dest(config.dest + '/assets/toolkit/images'));
});

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

// assemble
gulp.task('assemble', function(done) {
	assemble({
		helpers: {
			markdown: require('helper-markdown'),
			decode: function (val) {
				return decodeURIComponent(val);
			},
			raw: function (options) {
				return options.fn();
			}
		}
	});
	done();
});

// server
gulp.task('serve', function () {

	var reload = browserSync.reload;

	browserSync({
		server: {
			baseDir: config.dest
		},
		notify: false,
		logPrefix: 'FABRICATOR'
	});

	gulp.watch('src/**/*.{html,md,json,yml}', ['assemble']).on('change', reload);
	gulp.watch('src/assets/fabricator/styles/**/*.scss', ['styles:fabricator']);
	gulp.watch('src/assets/toolkit/styles/**/*.scss', ['styles:toolkit']);
	gulp.watch('src/assets/fabricator/scripts/**/*.js', ['scripts:fabricator']).on('change', reload);
	gulp.watch('src/assets/toolkit/scripts/**/*.js', ['scripts:toolkit']).on('change', reload);
	gulp.watch(config.src.images, ['images']).on('change', reload);
});

// default build task
gulp.task('default', ['clean'], function () {

	// define build tasks
	var tasks = [
		'styles',
		'scripts',
		'images',
		'assemble'
	];

	// run build
	runSequence(tasks, function () {
		if (config.dev) {
			gulp.start('serve');
		}
	});

});
<commit_msg>update gulpfile<commit_after>'use strict';

// modules
var assemble = require('fabricator-assemble');
var browserify = require('browserify');
var browserSync = require('browser-sync');
var concat = require('gulp-concat');
var csso = require('gulp-csso');
var del = require('del');
var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
var prefix = require('gulp-autoprefixer');
var rename = require('gulp-rename');
var reload = browserSync.reload;
var runSequence = require('run-sequence');
var sass = require('gulp-sass');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');

// configuration
var config = {
	dev: gutil.env.dev,
	src: {
		scripts: {
			fabricator: [
				'src/assets/fabricator/scripts/prism.js',
				'src/assets/fabricator/scripts/fabricator.js'
			],
			toolkit: './src/assets/toolkit/scripts/toolkit.js'
		},
		styles: {
			fabricator: 'src/assets/fabricator/styles/fabricator.scss',
			toolkit: 'src/assets/toolkit/styles/toolkit.scss'
		},
		images: 'src/assets/toolkit/images/**/*',
		views: 'src/toolkit/views/*.html'
	},
	dest: 'dist'
};

// clean
gulp.task('clean', function (cb) {
	del([config.dest], cb);
});

// styles
gulp.task('styles:fabricator', function () {
	return gulp.src(config.src.styles.fabricator)
		.pipe(sass({
			errLogToConsole: true
		}))
		.pipe(prefix('last 1 version'))
		.pipe(gulpif(!config.dev, csso()))
		.pipe(rename('f.css'))
		.pipe(gulp.dest(config.dest + '/assets/fabricator/styles'))
		.pipe(gulpif(config.dev, reload({stream:true})));
});

gulp.task('styles:toolkit', function () {
	return gulp.src(config.src.styles.toolkit)
		.pipe(sass({
			errLogToConsole: true
		}))
		.pipe(prefix('last 1 version'))
		.pipe(gulpif(!config.dev, csso()))
		.pipe(gulp.dest(config.dest + '/assets/toolkit/styles'))
		.pipe(gulpif(config.dev, reload({stream:true})));
});

gulp.task('styles', ['styles:fabricator', 'styles:toolkit']);

// scripts
gulp.task('scripts:fabricator', function () {
	return gulp.src(config.src.scripts.fabricator)
		.pipe(concat('f.js'))
		.pipe(gulpif(!config.dev, uglify()))
		.pipe(gulp.dest(config.dest + '/assets/fabricator/scripts'));
});

gulp.task('scripts:toolkit', function () {
	return browserify(config.src.scripts.toolkit)
		.bundle()
		.on('error', function (error) {
			gutil.log(gutil.colors.red(error));
			this.emit('end');
		})
		.pipe(source('toolkit.js'))
		.pipe(gulpif(!config.dev, streamify(uglify())))
		.pipe(gulp.dest(config.dest + '/assets/toolkit/scripts'));
});

gulp.task('scripts', ['scripts:fabricator', 'scripts:toolkit']);

// images
gulp.task('images', ['favicon'], function () {
	return gulp.src(config.src.images)
		.pipe(imagemin())
		.pipe(gulp.dest(config.dest + '/assets/toolkit/images'));
});

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

// assemble
gulp.task('assemble', function(done) {
	assemble({
		helpers: {
			markdown: require('helper-markdown'),
			decode: function (val) {
				return decodeURIComponent(val);
			},
			raw: function (options) {
				return options.fn();
			}
		}
	});
	done();
});

// server
gulp.task('serve', function () {

	var reload = browserSync.reload;

	browserSync({
		server: {
			baseDir: config.dest
		},
		notify: false,
		logPrefix: 'FABRICATOR'
	});

	gulp.watch('src/**/*.{html,md,json,yml}', ['assemble']).on('change', reload);
	gulp.watch('src/assets/fabricator/styles/**/*.scss', ['styles:fabricator']);
	gulp.watch('src/assets/toolkit/styles/**/*.scss', ['styles:toolkit']);
	gulp.watch('src/assets/fabricator/scripts/**/*.js', ['scripts:fabricator']).on('change', reload);
	gulp.watch('src/assets/toolkit/scripts/**/*.js', ['scripts:toolkit']).on('change', reload);
	gulp.watch(config.src.images, ['images']).on('change', reload);
});

// default build task
gulp.task('default', ['clean'], function () {

	// define build tasks
	var tasks = [
		'styles',
		'scripts',
		'images',
		'assemble'
	];

	// run build
	runSequence(tasks, function () {
		if (config.dev) {
			gulp.start('serve');
		}
	});

});
<|endoftext|>


<commit_before>/*jslint indent: 2, nomen: true, regexp: true */
"use strict";

/*
 * Load modules / packages
 */

var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var cache = require('gulp-cached');
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var deleted = require('gulp-deleted');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
var livereload = require('gulp-livereload');
var notify = require('gulp-notify');
var pixrem = require('gulp-pixrem');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
var rev = require('gulp-rev');
var sass = require('gulp-ruby-sass');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');

var del = require('del');
var notifier = require('node-notifier');
var path = require('path');
var _ = require('underscore');

/*
 * Settings
 */

var paths = {
  dev: 'dev/',
  build: 'htdocs/',
  index: 'index.+(html|php)',
  site: [
    '**/*',
    '.htaccess',
    '!styles{,/**}',        // specific task!
    '!scripts/*',           // specific task!
    '!scripts/lib{,/**}',   // specific task!
    '!images{,/**}'         // specific task!
  ],
  styles: {
    src: 'styles/',
    main: 'styles/main.scss',
    files: 'styles/**/*.scss',
    dest: 'styles/main.min.css'
  },
  scripts: {
    src: 'scripts/',
    main: 'scripts/main.js',
    files: [
      'scripts/**/*.js',
      '!scripts/**/*.min.js'
    ],
    concat: ['scripts/main.js', 'scripts/lib/qux.js'],
    dest: 'scripts/main.min.js'
  },
  images: {
    src: 'images/',
    files: 'images/**/*'
  },
  static: {
    files: '**/*.+(html|php|jade)'
  }
};
var config = {
  env: 'dev'
};

/*
 * Utils
 */

function pathPrefixer(path, base) {
  // preserve !negation for excluded files
  var re = /^(.+)(!)(.+)$/;
  if (typeof path === 'string') {
    return (base + path).replace(re, '$2$1$3');
  }
  return _.map(path, function (item) { return (base + item).replace(re, '$2$1$3'); });
}
/*
 * Tasks
 */

// DEFAULT task -> DEV
gulp.task('default', ['styles', 'scripts', 'watch'], function () {
  console.log('gulp default');
  notifier.notify({
    title: 'Gulp notification',
    message: 'DEV task COMPLETE!'
  });
});

// stylesheets : sass + sourcemaps + autoprefixer + pixrem + livereload
gulp.task('styles', function () {
  return sass(pathPrefixer(paths.styles.main, paths.dev), { sourcemap: true, style: 'compressed'})
    .pipe(plumber())
    .pipe(autoprefixer({
      browsers: ['last 2 versions', '> 5%', 'ie >= 8', 'Firefox ESR'],
      cascade: false
    }))
    .pipe(pixrem('18px'))
    .pipe(rename({
      suffix: ".min"
    }))
    // .pipe(sourcemaps.write('./', {
    //   includeContent: false
    // }))
    .pipe(gulpif(
      config.env === 'dev',
      sourcemaps.write('./', {
        includeContent: false
      })
    ))
    // .pipe(gulp.dest(paths.dev + paths.styles.src))
    .pipe(gulpif(
      config.env === 'dev',
      gulp.dest(paths.dev + paths.styles.src),
      gulp.dest(paths.build + paths.styles.src)
    ))
    .pipe(livereload())
    .pipe(notify({
      onLast: true,
      message: 'STYLES task SUCCESS!',
      icon: null
    }));
});

// scripts concat + uglify + sourcemaps
gulp.task('scripts', function () {
  return gulp.src(pathPrefixer(paths.scripts.concat, paths.dev))
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(concat('main.js'))
    .pipe(uglify())
    .pipe(rename({
      suffix: ".min"
    }))
    // .pipe(sourcemaps.write('./', {
    //   includeContent: false
    // }))
    .pipe(gulpif(
      config.env === 'dev',
      sourcemaps.write('./', {
        includeContent: false
      })
    ))
    // .pipe(gulp.dest(paths.dev + paths.scripts.src))
    .pipe(gulpif(
      config.env === 'dev',
      gulp.dest(paths.dev + paths.scripts.src),
      gulp.dest(paths.build + paths.scripts.src)
    ))
    .pipe(livereload())
    .pipe(notify({
      onLast: true,
      message: 'SCRIPTS task SUCCESS!',
      icon: null
    }));
});

// images optimisation (only changed)
gulp.task('images', function () {
  return gulp
    .src(pathPrefixer(paths.images.files, paths.dev))
    .pipe(gulpif(
      config.env === 'dev',
      cache('images'),
      changed(paths.build + paths.images.src, {hasChanged: changed.compareSha1Digest})
    ))
    // .pipe(cache('images'))
    // .pipe(changed(paths.build))
    // .pipe(changed(paths.build + paths.images.src, {hasChanged: changed.compareSha1Digest}))
    .pipe(imagemin())
    .pipe(gulpif(
      config.env === 'dev',
      gulp.dest(paths.dev + paths.images.src),
      gulp.dest(paths.build + paths.images.src)
    ))
    // .pipe(gulp.dest(paths.build + paths.images.src))
    .pipe(notify({
      onLast: true,
      message: 'IMAGES task SUCCESS!',
      icon: null
    }));
});

// livereload for “static” files (.html, .php, .jade, …)
gulp.task('static', function () {
  livereload.reload();
});

// livereload is listening to you…
gulp.task('watch', function () {
  livereload.listen();
  gulp.watch(pathPrefixer(paths.styles.files, paths.dev), ['styles']);
  gulp.watch(pathPrefixer(paths.scripts.files, paths.dev), ['scripts']);
  gulp.watch(pathPrefixer(paths.images.files, paths.dev), ['images']);
  gulp.watch(pathPrefixer(paths.static.files, paths.dev), ['static']);
});

// BUILD task
// gulp.task('build', ['init-build', 'copy', 'scripts', 'styles', 'images', 'revision-clean', 'revision-write', 'revision-refs'], function () {
gulp.task('build', ['init-build', 'copy', 'styles', 'scripts', 'images'], function () {
  console.timeEnd('BUILD TIME');
  notifier.notify({
    title: 'Gulp notification',
    message: 'BUILD task COMPLETE!'
  });
});

// set build config
gulp.task('init-build', function () {
  config.env = 'build';
  console.time('BUILD TIME');
});

// copy (all) changed files except styles/scripts/images + .htaccess + remove deleted files
gulp.task('copy', ['init-build'], function () {
  return gulp
    .src(pathPrefixer(paths.site, paths.dev))
    .pipe(deleted(paths.dev, paths.build, pathPrefixer(paths.site, paths.dev)))
    .pipe(changed(paths.build, {hasChanged: changed.compareSha1Digest}))
    .pipe(gulp.dest(paths.build))
    .pipe(notify({
      onLast: true,
      message: 'COPY task SUCCESS!',
      icon: null
    }));
});

// revision control for styles and scripts
gulp.task('rev', function () {
  return gulp
    .src([paths.build + paths.styles.dest, paths.build + paths.scripts.dest], { base: 'htdocs' })
    .pipe(rev())
    .pipe(gulp.dest('htdocs'))
    .pipe(rev.manifest())
    .pipe(gulp.dest('htdocs'));
});

// clean styles and scripts after revision
gulp.task('rev-clean', ['rev'], function (cb) {
  del([paths.build + paths.styles.dest, paths.build + paths.scripts.dest], cb);
});
<commit_msg>summer cleaning!<commit_after>/*jslint indent: 2, nomen: true, regexp: true */
'use strict';

/*
 * Load modules / packages
 */

var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var cache = require('gulp-cached');
var changed = require('gulp-changed');
var concat = require('gulp-concat');
var deleted = require('gulp-deleted');
var gulpif = require('gulp-if');
var imagemin = require('gulp-imagemin');
var livereload = require('gulp-livereload');
var notify = require('gulp-notify');
var pixrem = require('gulp-pixrem');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
var rev = require('gulp-rev');
var sass = require('gulp-ruby-sass');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');

var del = require('del');
var notifier = require('node-notifier');
var path = require('path');
var _ = require('underscore');

/*
 * Settings
 */

var paths = {
  dev: 'dev/',
  build: 'htdocs/',
  index: 'index.+(html|php)',
  site: [
    '**/*',
    '.htaccess',
    '!styles{,/**}',        // specific task!
    '!scripts/*',           // specific task!
    '!scripts/lib{,/**}',   // specific task!
    '!images{,/**}'         // specific task!
  ],
  styles: {
    src: 'styles/',
    main: 'styles/main.scss',
    files: 'styles/**/*.scss',
    dest: 'styles/main.min.css'
  },
  scripts: {
    src: 'scripts/',
    main: 'scripts/main.js',
    files: [
      'scripts/**/*.js',
      '!scripts/**/*.min.js'
    ],
    concat: ['scripts/main.js', 'scripts/lib/qux.js'],
    dest: 'scripts/main.min.js'
  },
  images: {
    src: 'images/',
    files: 'images/**/*'
  },
  static: {
    files: '**/*.+(html|php|jade)'
  }
};
var config = {
  env: 'dev'
};

/*
 * Utils
 */

// Path(s) concatenation: @base (string) + @path (string or array)
function pathPrefixer(path, base) {
  // preserve !negation for excluded files
  var re = /^(.+)(!)(.+)$/;
  if (typeof path === 'string') {
    return (base + path).replace(re, '$2$1$3');
  }
  return _.map(path, function (item) { return (base + item).replace(re, '$2$1$3'); });
}

/*
 * Tasks
 */

// DEFAULT task -> DEV
gulp.task('default', ['styles', 'scripts', 'watch'], function () {
  console.log('gulp default');
  notifier.notify({
    title: 'Gulp notification',
    message: 'DEV task COMPLETE!'
  });
});

// stylesheets: sass + autoprefixer + pixrem + livereload + sourcemaps (only in dev mode)
gulp.task('styles', function () {
  return sass(pathPrefixer(paths.styles.main, paths.dev), { sourcemap: true, style: 'compressed'})
    .pipe(plumber())
    .pipe(autoprefixer({
      browsers: ['last 2 versions', '> 5%', 'ie >= 8', 'Firefox ESR'],
      cascade: false
    }))
    // .pipe(pixrem('18px'))
    .pipe(rename({
      suffix: ".min"
    }))
    .pipe(gulpif(
      config.env === 'dev',
      sourcemaps.write('./')
    ))
    .pipe(gulpif(
      config.env === 'dev',
      gulp.dest(paths.dev + paths.styles.src),
      gulp.dest(paths.build + paths.styles.src)
    ))
    .pipe(livereload())
    .pipe(notify({
      onLast: true,
      message: 'STYLES task SUCCESS!',
      icon: null
    }));
});

// scripts: concat + uglify + livereload + sourcemaps (only in dev mode)
gulp.task('scripts', function () {
  return gulp.src(pathPrefixer(paths.scripts.concat, paths.dev))
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(concat('main.js'))
    .pipe(uglify())
    .pipe(rename({
      suffix: ".min"
    }))
    .pipe(gulpif(
      config.env === 'dev',
      sourcemaps.write('./')
    ))
    .pipe(gulpif(
      config.env === 'dev',
      gulp.dest(paths.dev + paths.scripts.src),
      gulp.dest(paths.build + paths.scripts.src)
    ))
    .pipe(livereload())
    .pipe(notify({
      onLast: true,
      message: 'SCRIPTS task SUCCESS!',
      icon: null
    }));
});

// images optimisation
// dev mode: only changed images (via cache)
// build mode: only changed images (via SHA comparison)
gulp.task('images', function () {
  return gulp
    .src(pathPrefixer(paths.images.files, paths.dev))
    .pipe(gulpif(
      config.env === 'dev',
      cache('images'),
      changed(paths.build + paths.images.src, {hasChanged: changed.compareSha1Digest})
    ))
    .pipe(imagemin())
    .pipe(gulpif(
      config.env === 'dev',
      gulp.dest(paths.dev + paths.images.src),
      gulp.dest(paths.build + paths.images.src)
    ))
    .pipe(notify({
      onLast: true,
      message: 'IMAGES task SUCCESS!',
      icon: null
    }));
});

// livereload for “static” files (.html, .php, .jade, …)
gulp.task('static', function () {
  livereload.reload();
});

// livereload is listening to you…
gulp.task('watch', function () {
  livereload.listen();
  gulp.watch(pathPrefixer(paths.styles.files, paths.dev), ['styles']);
  gulp.watch(pathPrefixer(paths.scripts.files, paths.dev), ['scripts']);
  gulp.watch(pathPrefixer(paths.images.files, paths.dev), ['images']);
  gulp.watch(pathPrefixer(paths.static.files, paths.dev), ['static']);
});

// BUILD task
// gulp.task('build', ['init-build', 'copy', 'scripts', 'styles', 'images', 'revision-clean', 'revision-write', 'revision-refs'], function () {
gulp.task('build', ['init-build', 'copy', 'styles', 'scripts', 'images'], function () {
  console.timeEnd('BUILD TIME');
  notifier.notify({
    title: 'Gulp notification',
    message: 'BUILD task COMPLETE!'
  });
});

// set build config
gulp.task('init-build', function () {
  config.env = 'build';
  console.time('BUILD TIME');
});

// copy (all) changed files except styles/scripts/images + .htaccess + remove deleted files
gulp.task('copy', ['init-build'], function () {
  return gulp
    .src(pathPrefixer(paths.site, paths.dev))
    .pipe(deleted(paths.dev, paths.build, pathPrefixer(paths.site, paths.dev)))
    .pipe(changed(paths.build, {hasChanged: changed.compareSha1Digest}))
    .pipe(gulp.dest(paths.build))
    .pipe(notify({
      onLast: true,
      message: 'COPY task SUCCESS!',
      icon: null
    }));
});

// revision control for styles and scripts
gulp.task('rev', function () {
  return gulp
    .src([paths.build + paths.styles.dest, paths.build + paths.scripts.dest], { base: 'htdocs' })
    .pipe(rev())
    .pipe(gulp.dest('htdocs'))
    .pipe(rev.manifest())
    .pipe(gulp.dest('htdocs'));
});

// clean styles and scripts after revision
gulp.task('rev-clean', ['rev'], function (cb) {
  del([paths.build + paths.styles.dest, paths.build + paths.scripts.dest], cb);
});
<|endoftext|>


<commit_before>'use strict';

const gulp = require('gulp');
const gutil = require('gulp-util');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');
const cleanCSS = require('gulp-clean-css');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');

const production = !!gutil.env.production;

// Copy the files
gulp.task('copy', function () {
    return gulp.src(['node_modules/fine-uploader/fine-uploader/**/*'], {'base': 'node_modules/fine-uploader/fine-uploader'})
        .pipe(gulp.dest('assets/fine-uploader'));
});

// Build app.js
gulp.task('scripts', function () {
    return gulp.src('assets/handler.js')
        .pipe(production ? uglify() : gutil.noop())
        .pipe(rename('handler.min.js'))
        .on('error', gutil.log)
        .pipe(production ? sourcemaps.write() : gutil.noop())
        .pipe(gulp.dest('assets'));
});

// Build bundle.css
gulp.task('styles', function () {
    return gulp.src('assets/handler.css')
        .pipe(production ? sourcemaps.init() : gutil.noop())
        .pipe(postcss([autoprefixer({browsers: ['> 5%']})]))
        .pipe(production ? sourcemaps.write() : gutil.noop())
        .pipe(production ? cleanCSS() : gutil.noop())
        .pipe(rename('handler.min.css'))
        .pipe(gulp.dest('assets'));
});

// Watch task
gulp.task('watch', function () {
    gulp.watch(['assets/*.js'], ['scripts']);
    gulp.watch(['assets/*.css'], ['styles']);
});

// Build task
gulp.task('build', ['copy', 'scripts', 'styles']);

// Build by default
gulp.task('default', ['build']);

// Build and watch task
gulp.task('build:watch', ['build', 'watch']);<commit_msg>Set the production enviornment as default<commit_after>'use strict';

const gulp = require('gulp');
const gutil = require('gulp-util');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');
const cleanCSS = require('gulp-clean-css');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');

const production = !gutil.env.development;

// Copy the files
gulp.task('copy', function () {
    return gulp.src(['node_modules/fine-uploader/fine-uploader/**/*'], {'base': 'node_modules/fine-uploader/fine-uploader'})
        .pipe(gulp.dest('assets/fine-uploader'));
});

// Build app.js
gulp.task('scripts', function () {
    return gulp.src('assets/handler.js')
        .pipe(production ? uglify() : gutil.noop())
        .pipe(rename('handler.min.js'))
        .on('error', gutil.log)
        .pipe(production ? sourcemaps.write() : gutil.noop())
        .pipe(gulp.dest('assets'));
});

// Build bundle.css
gulp.task('styles', function () {
    return gulp.src('assets/handler.css')
        .pipe(production ? sourcemaps.init() : gutil.noop())
        .pipe(postcss([autoprefixer({browsers: ['> 5%']})]))
        .pipe(production ? sourcemaps.write() : gutil.noop())
        .pipe(production ? cleanCSS() : gutil.noop())
        .pipe(rename('handler.min.css'))
        .pipe(gulp.dest('assets'));
});

// Watch task
gulp.task('watch', function () {
    gulp.watch(['assets/*.js'], ['scripts']);
    gulp.watch(['assets/*.css'], ['styles']);
});

// Build task
gulp.task('build', ['copy', 'scripts', 'styles']);

// Build by default
gulp.task('default', ['build']);

// Build and watch task
gulp.task('build:watch', ['build', 'watch']);<|endoftext|>


<commit_before>var gulp = require('gulp');
var minifyHTML = require('gulp-minify-html');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var changed = require('gulp-changed');
var imagemin = require('gulp-imagemin');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var del = require('del');
var concat = require('gulp-concat');
var refresh = require('gulp-livereload');
var modRewrite = require('connect-modrewrite');
var RevAll = require('gulp-rev-all');
var runSequence = require('run-sequence');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var gulpIf = require('gulp-if');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');

var paths = {
    dist: 'dist',
    jshint: [
        'app/scripts/**/*.js',
        'app/theme/**/*.js'
    ],
    html: 'app/**/*.html',
    misc: 'app/*.{htaccess,ico,xml}',
    scripts: [
        'app/scripts/config.js',
        'app/scripts/main.js',
        'app/scripts/**/init.js',
        'app/scripts/**/*.js'
    ],
    theme: {
        dist: 'dist/theme',
        css: 'app/theme/styles/**/*.css',
        // images, videos, fonts
        media: 'app/theme/**/*.{png,gif,jpg,jpeg,ico,svg,mp4,ogv,webm,pdf,eot,ttf,woff}',
        scripts: [
            'app/theme/lib/**/*.js',
            'app/theme/**/*.js'
        ]
    },
    lib: {
        dist: 'dist/lib',
        scripts: [
            'app/lib/jquery.min.js',
            'app/lib/angular.min.js',
            'app/lib/*.js' // NOTE: no folder glob, or it would clobber .ie
        ],
        ie: 'app/lib/ie/*.js'
    }
};

var handleError = function(err) {
    gutil.log(gutil.colors.red('# Error in ' + err.plugin));
    gutil.log('File: %s:%s', err.fileName, err.lineNumber);
    gutil.log('Error Message: %s', err.message);
    gutil.beep();
}

var host = {
    port: '8080',
    lrPort: '35729'
};

// REFACTOR: don't rely on env
var env = process.env.NODE_ENV || 'development';
var isProduction = (env == 'production');

// Empties folders to start fresh
gulp.task('clean', function (cb) {
    return del(['dist/*', '!dist/media'], cb);
});

gulp.task('jshint', function () {
    return gulp.src(paths.jshint)
        .pipe(jshint())
        .pipe(jshint.reporter(require('jshint-stylish')));
});

gulp.task('html', function () {
    return gulp.src(paths.html)
        .pipe(changed(paths.dist))
        .pipe(minifyHTML({
            collapseWhitespace: true,
            collapseBooleanAttributes: true,
            removeCommentsFromCDATA: true,
            removeOptionalTags: true,
            conditionals: true,
            quotes: true,
            empty: true
        }))
        .pipe(gulp.dest(paths.dist));
});

gulp.task('misc', function () {
    // REFACTOR: don't rely on env version
    var robotPath = isProduction ? 'app/robots.prod.txt' : 'app/robots.dev.txt';
    gulp.src(robotPath)
        .pipe(rename('robots.txt'))
        .pipe(gulp.dest(paths.dist));

    return gulp.src(paths.misc)
            .pipe(gulp.dest(paths.dist));
});

gulp.task('scripts', function () {
    return gulp.src(paths.scripts)
        .pipe(sourcemaps.init())
        .pipe(plumber(handleError))
        .pipe(uglify({
            mangle: false
        }))
        .pipe(plumber.stop())
        .pipe(concat('main.js'))
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest(paths.dist + '/scripts'))
        .pipe(refresh());
});

gulp.task('theme.sass', function() {
    return gulp.src('app/theme/styles/bootstrap/bootstrap.scss')
    .pipe(sass({
        outputStyle: 'expanded',
        precision: 8
    }))
    .pipe(gulp.dest('app/theme/styles'));
})
gulp.task('theme.css', function () {
    return gulp.src(paths.theme.css)
        .pipe(sourcemaps.init())
        .pipe(autoprefix('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
        .pipe(minifyCSS())
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest(paths.theme.dist + '/styles'))
        .pipe(refresh());
});

gulp.task('theme.scripts', function () {
    return gulp.src(paths.theme.scripts)
        .pipe(sourcemaps.init())
        .pipe(plumber(handleError))
        .pipe(uglify({
            mangle: false
        }))
        .pipe(plumber.stop())
        .pipe(concat('main.js'))
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest(paths.theme.dist))
        .pipe(refresh());
});

gulp.task('theme.media', function () {
    return gulp.src(paths.theme.media)
        .pipe(changed(paths.theme.dist))
        .pipe(gulpIf(isProduction, imagemin()))
        .pipe(gulp.dest(paths.theme.dist));
});

gulp.task('lib.scripts', function () {
    return gulp.src(paths.lib.scripts)
        .pipe(concat('lib.js'))
        .pipe(gulp.dest(paths.lib.dist));
});

// IE libs can stick together, but need to be separate from other libs
gulp.task('lib.ie', function() {
    return gulp.src(paths.lib.ie)
        .pipe(concat('ie-libs.js'))
        .pipe(gulp.dest(paths.lib.dist));
});

gulp.task('watch',function(){
    refresh.listen({ basePath: paths.dist });

    gulp.start('livereload');

    gulp.watch(["app/**/*.html"],['html']);
    gulp.watch(["app/**/*.css"],['theme.css']);
    gulp.watch(["app/**/*.scss"],['theme.sass']);
    gulp.watch(["app/scripts/**/*.js"],['scripts']);
    gulp.watch(["app/theme/**/*.js"],['theme.scripts']);
});

gulp.task('livereload', function(){
    var path = require('path');
    var express = require('express');
    var app = express();
    var staticFolder = path.join(__dirname, 'dist');

    app.use(modRewrite([
        '!\\. /index.html [L]'
    ]))
        .use(express.static(staticFolder));

    app.listen( host.port, function() {
        console.log('server started: http://localhost:' + host.port);
        return gulp;
    });
});

gulp.task('revision', function(){
    // REFACTOR: don't rely on env
    if(isProduction) {
        var revAll = new RevAll({
            dontUpdateReference: [/^((?!.js|.css).)*$/g],
            dontRenameFile: [/^((?!.js|.css).)*$/g]
        });

        gulp.src('dist/**')
            .pipe(revAll.revision())
            .pipe(gulp.dest('dist'));
    }
});

gulp.task('lib', ['lib.ie', 'lib.scripts']);
gulp.task('theme', [
    'theme.css',
    'theme.scripts',
    'theme.media'
]);

// For production
gulp.task('build', function(){
    // note: revision has a short circuit for dev
    runSequence('clean', 'theme.sass', [
        'html',
        'misc',
        'scripts',
        'theme',
        'lib'
    ], 'revision');
});

// For development
gulp.task('serve', ['default']);
gulp.task('default', ['build'], function(){
    gulp.start('watch');
});
<commit_msg>cleanup comments<commit_after>var gulp = require('gulp');
var minifyHTML = require('gulp-minify-html');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var changed = require('gulp-changed');
var imagemin = require('gulp-imagemin');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var del = require('del');
var concat = require('gulp-concat');
var refresh = require('gulp-livereload');
var modRewrite = require('connect-modrewrite');
var RevAll = require('gulp-rev-all');
var runSequence = require('run-sequence');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var gulpIf = require('gulp-if');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');

var paths = {
    dist: 'dist',
    jshint: [
        'app/scripts/**/*.js',
        'app/theme/**/*.js'
    ],
    html: 'app/**/*.html',
    misc: 'app/*.{htaccess,ico,xml}',
    scripts: [
        'app/scripts/config.js',
        'app/scripts/main.js',
        'app/scripts/**/init.js',
        'app/scripts/**/*.js'
    ],
    theme: {
        dist: 'dist/theme',
        css: 'app/theme/styles/**/*.css',
        // images, videos, fonts
        media: 'app/theme/**/*.{png,gif,jpg,jpeg,ico,svg,mp4,ogv,webm,pdf,eot,ttf,woff}',
        scripts: [
            'app/theme/lib/**/*.js',
            'app/theme/**/*.js'
        ]
    },
    lib: {
        dist: 'dist/lib',
        scripts: [
            'app/lib/jquery.min.js',
            'app/lib/angular.min.js',
            'app/lib/*.js' // NOTE: no folder glob, or it would clobber .ie
        ],
        ie: 'app/lib/ie/*.js'
    }
};

var handleError = function(err) {
    gutil.log(gutil.colors.red('# Error in ' + err.plugin));
    gutil.log('File: %s:%s', err.fileName, err.lineNumber);
    gutil.log('Error Message: %s', err.message);
    gutil.beep();
}

var host = {
    port: '8080',
    lrPort: '35729'
};

// REFACTOR: don't rely on env
var env = process.env.NODE_ENV || 'development';
var isProduction = (env == 'production');

// Empties folders to start fresh
gulp.task('clean', function (cb) {
    return del(['dist/*', '!dist/media'], cb);
});

gulp.task('jshint', function () {
    return gulp.src(paths.jshint)
        .pipe(jshint())
        .pipe(jshint.reporter(require('jshint-stylish')));
});

gulp.task('html', function () {
    return gulp.src(paths.html)
        .pipe(changed(paths.dist))
        .pipe(minifyHTML({
            collapseWhitespace: true,
            collapseBooleanAttributes: true,
            removeCommentsFromCDATA: true,
            removeOptionalTags: true,
            conditionals: true,
            quotes: true,
            empty: true
        }))
        .pipe(gulp.dest(paths.dist));
});

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

    var robotPath = isProduction ? 'app/robots.prod.txt' : 'app/robots.dev.txt';
    gulp.src(robotPath)
        .pipe(rename('robots.txt'))
        .pipe(gulp.dest(paths.dist));

    return gulp.src(paths.misc)
            .pipe(gulp.dest(paths.dist));
});

gulp.task('scripts', function () {
    return gulp.src(paths.scripts)
        .pipe(sourcemaps.init())
        .pipe(plumber(handleError))
        .pipe(uglify({
            mangle: false
        }))
        .pipe(plumber.stop())
        .pipe(concat('main.js'))
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest(paths.dist + '/scripts'))
        .pipe(refresh());
});

gulp.task('theme.sass', function() {
    return gulp.src('app/theme/styles/bootstrap/bootstrap.scss')
    .pipe(sass({
        outputStyle: 'expanded',
        precision: 8
    }))
    .pipe(gulp.dest('app/theme/styles'));
})
gulp.task('theme.css', function () {
    return gulp.src(paths.theme.css)
        .pipe(sourcemaps.init())
        .pipe(autoprefix('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
        .pipe(minifyCSS())
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest(paths.theme.dist + '/styles'))
        .pipe(refresh());
});

gulp.task('theme.scripts', function () {
    return gulp.src(paths.theme.scripts)
        .pipe(sourcemaps.init())
        .pipe(plumber(handleError))
        .pipe(uglify({
            mangle: false
        }))
        .pipe(plumber.stop())
        .pipe(concat('main.js'))
        .pipe(sourcemaps.write('./maps'))
        .pipe(gulp.dest(paths.theme.dist))
        .pipe(refresh());
});

gulp.task('theme.media', function () {
    return gulp.src(paths.theme.media)
        .pipe(changed(paths.theme.dist))
        .pipe(gulpIf(isProduction, imagemin()))
        .pipe(gulp.dest(paths.theme.dist));
});

gulp.task('lib.scripts', function () {
    return gulp.src(paths.lib.scripts)
        .pipe(concat('lib.js'))
        .pipe(gulp.dest(paths.lib.dist));
});

// IE libs can stick together, but need to be separate from other libs
gulp.task('lib.ie', function() {
    return gulp.src(paths.lib.ie)
        .pipe(concat('ie-libs.js'))
        .pipe(gulp.dest(paths.lib.dist));
});

gulp.task('watch',function(){
    refresh.listen({ basePath: paths.dist });

    gulp.start('livereload');

    gulp.watch(["app/**/*.html"],['html']);
    gulp.watch(["app/**/*.css"],['theme.css']);
    gulp.watch(["app/**/*.scss"],['theme.sass']);
    gulp.watch(["app/scripts/**/*.js"],['scripts']);
    gulp.watch(["app/theme/**/*.js"],['theme.scripts']);
});

gulp.task('livereload', function(){
    var path = require('path');
    var express = require('express');
    var app = express();
    var staticFolder = path.join(__dirname, 'dist');

    app.use(modRewrite([
        '!\\. /index.html [L]'
    ]))
        .use(express.static(staticFolder));

    app.listen( host.port, function() {
        console.log('server started: http://localhost:' + host.port);
        return gulp;
    });
});

gulp.task('revision', function(){
    if(isProduction) {
        var revAll = new RevAll({
            dontUpdateReference: [/^((?!.js|.css).)*$/g],
            dontRenameFile: [/^((?!.js|.css).)*$/g]
        });

        gulp.src('dist/**')
            .pipe(revAll.revision())
            .pipe(gulp.dest('dist'));
    }
});

gulp.task('lib', ['lib.ie', 'lib.scripts']);
gulp.task('theme', [
    'theme.css',
    'theme.scripts',
    'theme.media'
]);

// For production
gulp.task('build', function(){
    // note: revision has a short circuit for dev
    runSequence('clean', 'theme.sass', [
        'html',
        'misc',
        'scripts',
        'theme',
        'lib'
    ], 'revision');
});

// For development
gulp.task('serve', ['default']);
gulp.task('default', ['build'], function(){
    gulp.start('watch');
});
<|endoftext|>


<commit_before>//* @public
/**
	_moon.Panel_ is the default kind for controls created inside a
	[moon.Panels](#moon.Panels) container. A _moon.Panels_ will typically contain
	several instances of _moon.Panel_.

	The built-in features of _moon.Panel_ include a header and a FittableRows
	layout for the main body content.
*/

enyo.kind({
	name: "moon.Panel",
	//* @public
	published: {
		//* Facade for the header's _title_ property
		title: "",
		//* Facade for the header's _titleAbove_ property
		titleAbove: "",
		//* Facade for the header's _titleBelow_ property
		titleBelow: "",
		//* Facade for the header's _subTitleBelow_ property
		subTitleBelow: "",
		/**
			If true, the header's _titleAbove_ property is automatically populated
			with the panel index
		*/
		autoNumber: true,
		//* Facade for the header's _small_ property
		smallHeader: false,
		//* If true, the header collapses when the panel body is scrolled down
		collapsingHeader: false,
		//* Title's _allowHtml_ property
		allowHtmlHeader: false,
		//* URL of a background image for the header
		headerBackgroundSrc: null,
		//* Position properties for the header's background image
		headerBackgroundPosition: "top right",
		//* Header options
		headerOptions: null
	},
	events: {
		//* Fires when this panel has completed its pre-arrangement transition.
		onPreTransitionComplete: "",
		//* Fires when this panel has completed its post-arrangement transition.
		onPostTransitionComplete: ""
	},
	//* @protected
	handlers: {
		onScroll: "scroll"
	},

	//* @protected
	spotlight: "container",
	fit: true,
	classes: "moon-panel",
	layoutKind: "FittableRowsLayout",
	headerOption: null, //* Deprecated
	panelTools : [
		{name: "breadcrumb", ontap: "handleBreadcrumbTap", classes: "moon-panel-breadcrumb", components: [
			{name: "breadcrumbViewport", classes: "moon-panel-breadcrumb-viewport", components: [
				{name: "breadcrumbBackground", classes: "moon-panel-mini-header-wrapper", components: [
					{name: "breadcrumbTitleAbove", classes: "moon-super-header-text moon-panel-mini-header-title-above"},
					{name: "breadcrumbText", mixins: ["moon.MarqueeSupport", "moon.MarqueeItem"], classes: "moon-sub-header-text moon-panel-mini-header"}
				]}
			]}
		]},
		{name: "viewport", classes: "moon-panel-viewport", components: [
			{name: "contentWrapper", kind:"FittableRows", classes: "moon-panel-content-wrapper", components: [
				/* header will be created here programmatically in createTools after mixing-in headerOptions */
				{name: "panelBody", kind: "FittableRows", fit: true, classes: "moon-panel-body"}
			]}
		]},

		{name: "animator", kind: "enyo.StyleAnimator", onComplete: "animationComplete"}
	],
	headerConfig : {name: "header", kind: "moon.Header", onComplete: "headerAnimationComplete", marqueeOnRender: false, isChrome: true},
	bindings: [
		{from: ".title", to: ".$.header.title"},
		{from: ".title", to: ".$.breadcrumbText.content"},
		{from: ".titleAbove", to: ".$.header.titleAbove"},
		{from: ".titleAbove", to: ".$.breadcrumbTitleAbove.content"},
		{from: ".titleBelow", to: ".$.header.titleBelow"},
		{from: ".subTitleBelow", to: ".$.header.subTitleBelow"},
		{from: ".smallHeader", to: ".$.header.small"},
		{from: ".allowHtmlHeader", to: ".$.header.allowHtml"},
		{from: ".headerBackgroundSrc", to: ".$.header.backgroundSrc"},
		{from: ".headerBackgroundPosition", to: ".$.header.backgroundPosition"}
	],

	headerComponents: [],
	isBreadcrumb: false,
	isHeaderCollapsed: false,
	shrinking: false,
	growing: false,

	create: function() {
		this.inherited(arguments);
		// FIXME: Need to determine whether headerComponents was passed on the instance or kind to get the ownership correct
		if (this.headerComponents) {
			var owner = this.hasOwnProperty("headerComponents") ? this.getInstanceOwner() : this;
			this.$.header.createComponents(this.headerComponents, {owner: owner});
		}
		this.autoNumberChanged();
	},
	initComponents: function() {
		this.createTools();
		this.controlParentName = "panelBody";
		this.discoverControlParent();
		this.inherited(arguments);
	},
	createTools: function() {
		// Create everything but the header
		this.createChrome(this.panelTools);
		// Special-handling for header, which can have its options modified by the instance
		var hc = enyo.clone(this.headerConfig || {});
		hc.addBefore = this.$.panelBody;
		enyo.mixin(hc, this.headerOptions || this.headerOption);
		this.$.contentWrapper.createComponent(hc, {owner:this});
	},
	//* On reflow, updates _this.$.contentWrapper_ bounds.
	reflow: function() {
		this.inherited(arguments);
		this.getInitAnimationValues();
		this.updateViewportSize();
		this.createShrinkAnimation();
		this.createGrowAnimation();
	},
	//* Updates _this.$.contentWrapper_ to have the height/width of _this_.
	updateViewportSize: function() {
		var node = this.hasNode();

		if (!node || this.isBreadcrumb) {
			return;
		}

		this.$.viewport.applyStyle("height", this.initialHeight + "px");
		this.$.viewport.applyStyle("width", this.initialWidth + "px");
		this.$.contentWrapper.applyStyle("height", this.initialHeight + "px");
		this.$.contentWrapper.applyStyle("width", this.initialWidth + "px");
	},
	//* Forcibly applies layout kind changes to _this.$.panelBody_.
	layoutKindChanged: function() {
		this.$.panelBody.setLayoutKind(this.getLayoutKind());
	},
	//* When _this.isBreadcrumb_ changes, updates spottability.
	isBreadcrumbChanged: function() {
		if (this.isBreadcrumb) {
			this.addSpottableBreadcrumbProps();
		} else {
			this.removeSpottableBreadcrumbProps();
		}
	},
	handleBreadcrumbTap: function(inSender, inEvent) {
		inEvent.breadcrumbTap = true;
	},
	scroll: function(inSender, inEvent) {
		if (this.collapsingHeader && !this.smallHeader) {
			if (inEvent.originator.y < 0) {
				this.collapseHeader();
			} else {
				this.expandHeader();
			}
		}
	},
	collapseHeader: function() {
		if (!this.isHeaderCollapsed) {
			this.$.header.collapseToSmall();
			this.isHeaderCollapsed = true;
		}
	},
	expandHeader: function() {
		if (this.isHeaderCollapsed) {
			this.$.header.expandToLarge();
			this.isHeaderCollapsed = false;
		}
	},
	//* Updates _this.titleAbove_ when _this.autoNumber_ changes.
	autoNumberChanged: function() {
		if (this.getAutoNumber() === true && this.container) {
			// This gets the index regardless of whether the panel is client or chome
			var n = this.parent.indexOfChild(this) + 1;
			n = ((n < 10) ? "0" : "") + n;
			this.setTitleAbove(n);
		}
	},
	//* Updates _this.header_ when _title_ changes.
	titleChanged: function() {
		this.$.header.setTitle(this.getTitle());
	},
	//* Updates _this.header_ when _titleAbove_ changes.
	titleAboveChanged: function() {
		this.$.header.setTitleAbove(this.getTitleAbove());
	},
	generateAutoNumber: function() {
		var adjustedIndex = this.indexInContainer() + 1;
		return (adjustedIndex < 10) ? "0"+ adjustedIndex : adjustedIndex;
	},
	addSpottableBreadcrumbProps: function() {
		this.$.breadcrumbBackground.spotlight = true;
	},
	removeSpottableBreadcrumbProps: function() {
		this.$.breadcrumbBackground.spotlight = false;
		this.$.breadcrumbBackground.removeClass("spotlight");
	},
	stopMarquees: function() {
		this.$.breadcrumbText.stopMarquee();
		this.$.header.stopMarquee();
	},
	startMarqueeAsNeeded: function(inInfo) {
		var onscreen = !inInfo.offscreen;
		if (onscreen) {
			if (this.isBreadcrumb) {
				this.$.breadcrumbText.startMarquee();
			}
			else {
				this.$.header.startMarquee();
			}
		}
	},
	//* Updates panel header dynamically.
	getHeader: function() {
		return this.$.header;
	},
	// Called directly by moon.Panels
	initPanel: function(inInfo) {
		this.startJob("initPanel", function() {
			this.set("isBreadcrumb", inInfo.breadcrumb);
			if (this.isBreadcrumb) {
				this.shrink();
			}
			this.startMarqueeAsNeeded(inInfo);
		}, 0);
	},
	// Called directly by moon.Panels
	preTransition: function(inInfo) {
		this.stopMarquees();

		if (!this.shrinking && inInfo.breadcrumb && (!this.isBreadcrumb || this.growing)) {
			this.shrinkAnimation();
			return true;
		}

		return false;
	},
	// Called directly by moon.Panels
	postTransition: function(inInfo) {
		if (!this.growing && !inInfo.breadcrumb && (this.isBreadcrumb || this.shrinking)) {
			this.growAnimation();
			return true;
		}

		return false;
	},
	// Called directly by moon.Panels
	transitionFinished: function(inInfo) {
		if (!inInfo.animate) {
			this.stopMarquees();

			if (this.isBreadcrumb === true && inInfo.breadcrumb === false) {
				this.grow();
			}
			if (this.isBreadcrumb === false && inInfo.breadcrumb === true) {
				this.shrink();
			}
		}
		this.set("isBreadcrumb", inInfo.breadcrumb);
		this.startMarqueeAsNeeded(inInfo);
	},
	shrinkAnimation: function() {
		this.growing = false;
		this.shrinking = true;
		this.haltAnimations();
		this.$.animator.play("shrink");
	},
	shrink: function() {
		this.$.animator.jumpToEnd("shrink");
	},
	growAnimation: function() {
		this.growing = true;
		this.shrinking = false;
		this.haltAnimations();
		this.$.animator.play("grow");
	},
	grow: function() {
		this.$.animator.jumpToEnd("grow");
	},
	//* @protected
	getInitAnimationValues: function() {
		var node = this.hasNode();
		this.initialHeight = node.offsetHeight;
		this.initialWidth = node.offsetWidth;
	},
	haltAnimations: function() {
		this.$.animator.stop();
		this.$.animator.pause("grow");
		this.$.animator.pause("shrink");
	},
	preTransitionComplete: function() {
		this.shrinking = false;
		this.doPreTransitionComplete();
	},
	postTransitionComplete: function() {
		this.growing = false;
		this.doPostTransitionComplete();
		this.resized();
	},
	animationComplete: function(inSender, inEvent) {
		switch (inEvent.animation.name) {
		case "shrink":
			this.preTransitionComplete();
			return true;
		case "grow":
			this.postTransitionComplete();
			return true;
		}
	},
	headerAnimationComplete: function(inSender, inEvent) {
		switch (inEvent.animation.name) {
		case "collapseToSmall":
		case "expandToLarge":
			// FIXME: It would be better to call this during the animation so it resizes
			// smoothly, but that's not possible with CSS transitions; it will jump now
			this.resized();
			break;
		}
	},
	createGrowAnimation: function() {
		this.$.animator.newAnimation({
			name: "grow",
			duration: 400,
			timingFunction: "cubic-bezier(.25,.1,.25,1)",
			keyframes: {
				0: [
					{control: this.$.viewport, properties: {"height"  : "0px"}},
					{control: this.$.breadcrumbViewport, properties: { "height": "current" }}
				],
				50: [
					{control: this.$.breadcrumbViewport, properties: { "height": "0px" }}
				],
				100: [
					{control: this.$.viewport, properties: {"height" : this.initialHeight + "px"}}
				]
			}
		});
	},
	createShrinkAnimation: function() {
		this.$.animator.newAnimation({
			name: "shrink",
			duration: 500,
			timingFunction: "cubic-bezier(.25,.1,.25,1)",
			keyframes: {
				0: [
					{control: this.$.viewport, properties: { "height"  : "current" }}
				],
				50: [
					{control: this.$.breadcrumbViewport, properties: { "height": "current" }}
				],
				100: [
					{control: this.$.viewport, properties: { "height"  : "0px" }},
					{control: this.$.breadcrumbViewport, properties: { "height": "370px" }}
				]
			}
		});
	}
});
<commit_msg>Avoiding need for async shrinkage in moon.Panel.<commit_after>//* @public
/**
	_moon.Panel_ is the default kind for controls created inside a
	[moon.Panels](#moon.Panels) container. A _moon.Panels_ will typically contain
	several instances of _moon.Panel_.

	The built-in features of _moon.Panel_ include a header and a FittableRows
	layout for the main body content.
*/

enyo.kind({
	name: "moon.Panel",
	//* @public
	published: {
		//* Facade for the header's _title_ property
		title: "",
		//* Facade for the header's _titleAbove_ property
		titleAbove: "",
		//* Facade for the header's _titleBelow_ property
		titleBelow: "",
		//* Facade for the header's _subTitleBelow_ property
		subTitleBelow: "",
		/**
			If true, the header's _titleAbove_ property is automatically populated
			with the panel index
		*/
		autoNumber: true,
		//* Facade for the header's _small_ property
		smallHeader: false,
		//* If true, the header collapses when the panel body is scrolled down
		collapsingHeader: false,
		//* Title's _allowHtml_ property
		allowHtmlHeader: false,
		//* URL of a background image for the header
		headerBackgroundSrc: null,
		//* Position properties for the header's background image
		headerBackgroundPosition: "top right",
		//* Header options
		headerOptions: null
	},
	events: {
		//* Fires when this panel has completed its pre-arrangement transition.
		onPreTransitionComplete: "",
		//* Fires when this panel has completed its post-arrangement transition.
		onPostTransitionComplete: ""
	},
	//* @protected
	handlers: {
		onScroll: "scroll"
	},

	//* @protected
	spotlight: "container",
	fit: true,
	classes: "moon-panel",
	layoutKind: "FittableRowsLayout",
	headerOption: null, //* Deprecated
	panelTools : [
		{name: "breadcrumb", ontap: "handleBreadcrumbTap", classes: "moon-panel-breadcrumb", components: [
			{name: "breadcrumbViewport", classes: "moon-panel-breadcrumb-viewport", components: [
				{name: "breadcrumbBackground", classes: "moon-panel-mini-header-wrapper", components: [
					{name: "breadcrumbTitleAbove", classes: "moon-super-header-text moon-panel-mini-header-title-above"},
					{name: "breadcrumbText", mixins: ["moon.MarqueeSupport", "moon.MarqueeItem"], classes: "moon-sub-header-text moon-panel-mini-header"}
				]}
			]}
		]},
		{name: "viewport", classes: "moon-panel-viewport", components: [
			{name: "contentWrapper", kind:"FittableRows", classes: "moon-panel-content-wrapper", components: [
				/* header will be created here programmatically in createTools after mixing-in headerOptions */
				{name: "panelBody", kind: "FittableRows", fit: true, classes: "moon-panel-body"}
			]}
		]},

		{name: "animator", kind: "enyo.StyleAnimator", onComplete: "animationComplete"}
	],
	headerConfig : {name: "header", kind: "moon.Header", onComplete: "headerAnimationComplete", isChrome: true},
	bindings: [
		{from: ".title", to: ".$.header.title"},
		{from: ".title", to: ".$.breadcrumbText.content"},
		{from: ".titleAbove", to: ".$.header.titleAbove"},
		{from: ".titleAbove", to: ".$.breadcrumbTitleAbove.content"},
		{from: ".titleBelow", to: ".$.header.titleBelow"},
		{from: ".subTitleBelow", to: ".$.header.subTitleBelow"},
		{from: ".smallHeader", to: ".$.header.small"},
		{from: ".allowHtmlHeader", to: ".$.header.allowHtml"},
		{from: ".headerBackgroundSrc", to: ".$.header.backgroundSrc"},
		{from: ".headerBackgroundPosition", to: ".$.header.backgroundPosition"}
	],

	headerComponents: [],
	isBreadcrumb: false,
	isHeaderCollapsed: false,
	shrinking: false,
	growing: false,

	create: function() {
		this.inherited(arguments);
		// FIXME: Need to determine whether headerComponents was passed on the instance or kind to get the ownership correct
		if (this.headerComponents) {
			var owner = this.hasOwnProperty("headerComponents") ? this.getInstanceOwner() : this;
			this.$.header.createComponents(this.headerComponents, {owner: owner});
		}
		this.autoNumberChanged();
	},
	initComponents: function() {
		this.createTools();
		this.controlParentName = "panelBody";
		this.discoverControlParent();
		this.inherited(arguments);
	},
	createTools: function() {
		// Create everything but the header
		this.createChrome(this.panelTools);
		// Special-handling for header, which can have its options modified by the instance
		var hc = enyo.clone(this.headerConfig || {});
		hc.addBefore = this.$.panelBody;
		enyo.mixin(hc, this.headerOptions || this.headerOption);
		this.$.contentWrapper.createComponent(hc, {owner:this});
	},
	//* On reflow, updates _this.$.contentWrapper_ bounds.
	reflow: function() {
		this.inherited(arguments);
		this.getInitAnimationValues();
		this.updateViewportSize();
		this.createShrinkAnimation();
		this.createGrowAnimation();
		this.shrinkAsNeeded();
	},
	//* Updates _this.$.contentWrapper_ to have the height/width of _this_.
	updateViewportSize: function() {
		var node = this.hasNode();

		if (!node || this.isBreadcrumb) {
			return;
		}

		this.$.viewport.applyStyle("height", this.initialHeight + "px");
		this.$.viewport.applyStyle("width", this.initialWidth + "px");
		this.$.contentWrapper.applyStyle("height", this.initialHeight + "px");
		this.$.contentWrapper.applyStyle("width", this.initialWidth + "px");
	},
	//* Forcibly applies layout kind changes to _this.$.panelBody_.
	layoutKindChanged: function() {
		this.$.panelBody.setLayoutKind(this.getLayoutKind());
	},
	//* When _this.isBreadcrumb_ changes, updates spottability.
	isBreadcrumbChanged: function() {
		if (this.isBreadcrumb) {
			this.addSpottableBreadcrumbProps();
		} else {
			this.removeSpottableBreadcrumbProps();
		}
	},
	handleBreadcrumbTap: function(inSender, inEvent) {
		inEvent.breadcrumbTap = true;
	},
	scroll: function(inSender, inEvent) {
		if (this.collapsingHeader && !this.smallHeader) {
			if (inEvent.originator.y < 0) {
				this.collapseHeader();
			} else {
				this.expandHeader();
			}
		}
	},
	collapseHeader: function() {
		if (!this.isHeaderCollapsed) {
			this.$.header.collapseToSmall();
			this.isHeaderCollapsed = true;
		}
	},
	expandHeader: function() {
		if (this.isHeaderCollapsed) {
			this.$.header.expandToLarge();
			this.isHeaderCollapsed = false;
		}
	},
	//* Updates _this.titleAbove_ when _this.autoNumber_ changes.
	autoNumberChanged: function() {
		if (this.getAutoNumber() === true && this.container) {
			// This gets the index regardless of whether the panel is client or chome
			var n = this.parent.indexOfChild(this) + 1;
			n = ((n < 10) ? "0" : "") + n;
			this.setTitleAbove(n);
		}
	},
	//* Updates _this.header_ when _title_ changes.
	titleChanged: function() {
		this.$.header.setTitle(this.getTitle());
	},
	//* Updates _this.header_ when _titleAbove_ changes.
	titleAboveChanged: function() {
		this.$.header.setTitleAbove(this.getTitleAbove());
	},
	generateAutoNumber: function() {
		var adjustedIndex = this.indexInContainer() + 1;
		return (adjustedIndex < 10) ? "0"+ adjustedIndex : adjustedIndex;
	},
	addSpottableBreadcrumbProps: function() {
		this.$.breadcrumbBackground.spotlight = true;
	},
	removeSpottableBreadcrumbProps: function() {
		this.$.breadcrumbBackground.spotlight = false;
		this.$.breadcrumbBackground.removeClass("spotlight");
	},
	shrinkAsNeeded: function() {
		if (this.needsToShrink) {
			this.shrink();
			this.needsToShrink = false;
		}
	},
	stopMarquees: function() {
		this.$.breadcrumbText.stopMarquee();
		this.$.header.stopMarquee();
	},
	startMarqueeAsNeeded: function(inInfo) {
		var onscreen = !inInfo.offscreen;
		if (onscreen) {
			if (this.isBreadcrumb) {
				this.$.breadcrumbText.startMarquee();
			}
			else {
				this.$.header.startMarquee();
			}
		}
	},
	//* Updates panel header dynamically.
	getHeader: function() {
		return this.$.header;
	},
	// Called directly by moon.Panels
	initPanel: function(inInfo) {
		this.set("isBreadcrumb", inInfo.breadcrumb);
		if (this.isBreadcrumb) {
			this.needsToShrink = true;
		}
		this.startMarqueeAsNeeded(inInfo);
	},
	// Called directly by moon.Panels
	preTransition: function(inInfo) {
		this.stopMarquees();

		if (!this.shrinking && inInfo.breadcrumb && (!this.isBreadcrumb || this.growing)) {
			this.shrinkAnimation();
			return true;
		}

		return false;
	},
	// Called directly by moon.Panels
	postTransition: function(inInfo) {
		if (!this.growing && !inInfo.breadcrumb && (this.isBreadcrumb || this.shrinking)) {
			this.growAnimation();
			return true;
		}

		return false;
	},
	// Called directly by moon.Panels
	transitionFinished: function(inInfo) {
		if (!inInfo.animate) {
			this.stopMarquees();

			if (this.isBreadcrumb === true && inInfo.breadcrumb === false) {
				this.grow();
			}
			if (this.isBreadcrumb === false && inInfo.breadcrumb === true) {
				this.shrink();
			}
		}
		this.set("isBreadcrumb", inInfo.breadcrumb);
		this.startMarqueeAsNeeded(inInfo);
	},
	shrinkAnimation: function() {
		this.growing = false;
		this.shrinking = true;
		this.haltAnimations();
		this.$.animator.play("shrink");
	},
	shrink: function() {
		this.$.animator.jumpToEnd("shrink");
	},
	growAnimation: function() {
		this.growing = true;
		this.shrinking = false;
		this.haltAnimations();
		this.$.animator.play("grow");
	},
	grow: function() {
		this.$.animator.jumpToEnd("grow");
	},
	//* @protected
	getInitAnimationValues: function() {
		var node = this.hasNode();
		this.initialHeight = node.offsetHeight;
		this.initialWidth = node.offsetWidth;
	},
	haltAnimations: function() {
		this.$.animator.stop();
		this.$.animator.pause("grow");
		this.$.animator.pause("shrink");
	},
	preTransitionComplete: function() {
		this.shrinking = false;
		this.doPreTransitionComplete();
	},
	postTransitionComplete: function() {
		this.growing = false;
		this.doPostTransitionComplete();
		this.resized();
	},
	animationComplete: function(inSender, inEvent) {
		switch (inEvent.animation.name) {
		case "shrink":
			this.preTransitionComplete();
			return true;
		case "grow":
			this.postTransitionComplete();
			return true;
		}
	},
	headerAnimationComplete: function(inSender, inEvent) {
		switch (inEvent.animation.name) {
		case "collapseToSmall":
		case "expandToLarge":
			// FIXME: It would be better to call this during the animation so it resizes
			// smoothly, but that's not possible with CSS transitions; it will jump now
			this.resized();
			break;
		}
	},
	createGrowAnimation: function() {
		this.$.animator.newAnimation({
			name: "grow",
			duration: 400,
			timingFunction: "cubic-bezier(.25,.1,.25,1)",
			keyframes: {
				0: [
					{control: this.$.viewport, properties: {"height"  : "0px"}},
					{control: this.$.breadcrumbViewport, properties: { "height": "current" }}
				],
				50: [
					{control: this.$.breadcrumbViewport, properties: { "height": "0px" }}
				],
				100: [
					{control: this.$.viewport, properties: {"height" : this.initialHeight + "px"}}
				]
			}
		});
	},
	createShrinkAnimation: function() {
		this.$.animator.newAnimation({
			name: "shrink",
			duration: 500,
			timingFunction: "cubic-bezier(.25,.1,.25,1)",
			keyframes: {
				0: [
					{control: this.$.viewport, properties: { "height"  : "current" }}
				],
				50: [
					{control: this.$.breadcrumbViewport, properties: { "height": "current" }}
				],
				100: [
					{control: this.$.viewport, properties: { "height"  : "0px" }},
					{control: this.$.breadcrumbViewport, properties: { "height": "370px" }}
				]
			}
		});
	}
});
<|endoftext|>


<commit_before>'use strict';

var gulp = require('gulp'),
    $ = require('gulp-load-plugins')(),
    babel = require('babel-core/register'),
    spawn = require('child_process').spawn,
    srcFiles = './src/**/*.js',
    testFiles = './src/**/*.spec.js';

gulp.task('clean', function () {
  require('del').sync('lib');
});

gulp.task('cover', function(cb) {
  var cmd = spawn('node', [
    'node_modules/istanbul/lib/cli.js',
    'cover',
    '--root', '.',
    '-x', '**/*.spec.js',
    'node_modules/mocha/bin/_mocha',
    '--', '--opts', '.mocha.opts'
  ], {
    stdio: 'inherit'
  });

  cmd.on('close', cb);
});

gulp.task('test', function() {
  return gulp.src(testFiles, { read: false })
    .pipe($.mocha());
});

gulp.task('lint', function () {
  return gulp.src(srcFiles)
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe($.eslint.failAfterError());
});

gulp.task('babel', function() {
  return gulp.src(srcFiles)
    .pipe($.babel())
    .pipe(gulp.dest('lib'));
});

gulp.task('watch', function() {
  gulp.watch([srcFiles, testFiles], ['test']);
});

gulp.task('build', [
  'clean',
  'babel'
]);

gulp.task('default', [
  'lint',
  'test',
  'watch'
]);
<commit_msg>Remove tests from build<commit_after>'use strict';

var gulp = require('gulp'),
    $ = require('gulp-load-plugins')(),
    babel = require('babel-core/register'),
    spawn = require('child_process').spawn,
    srcFiles = './src/**/!(*.spec).js',
    testFiles = './src/**/*.spec.js';

gulp.task('clean', function () {
  require('del').sync('lib');
});

gulp.task('cover', function(cb) {
  var cmd = spawn('node', [
    'node_modules/istanbul/lib/cli.js',
    'cover',
    '--root', '.',
    '-x', '**/*.spec.js',
    'node_modules/mocha/bin/_mocha',
    '--', '--opts', '.mocha.opts'
  ], {
    stdio: 'inherit'
  });

  cmd.on('close', cb);
});

gulp.task('test', function() {
  return gulp.src(testFiles, { read: false })
    .pipe($.mocha());
});

gulp.task('lint', function () {
  return gulp.src(srcFiles)
    .pipe($.eslint())
    .pipe($.eslint.format())
    .pipe($.eslint.failAfterError());
});

gulp.task('babel', function() {
  return gulp.src(srcFiles)
    .pipe($.babel())
    .pipe(gulp.dest('lib'));
});

gulp.task('watch', function() {
  gulp.watch([srcFiles, testFiles], ['test']);
});

gulp.task('build', [
  'clean',
  'babel'
]);

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


<commit_before>// vars and includes
var babel = require('gulp-babel');
var del = require('del');
var gulp = require('gulp');
var concat = require('gulp-concat-util');
var eslint = require('gulp-eslint');
var jasmine = require('gulp-jasmine');
var gutil = require('gulp-util');
var path = require('path');
var sourcemaps = require('gulp-sourcemaps');
var streamqueue = require('streamqueue');
var uglify = require('gulp-uglify');
var vinylPaths = require('vinyl-paths');

// *** DEV ***
gulp.task('dev', ['dev:compile'], function() {
    gulp.watch('./source/**/*.js', ['dev:js', 'test']);
});

gulp.task('dev:compile', ['dev:precompile', 'dev:js']);

gulp.task('dev:precompile', ['dev:clean']);

// deletes css and js/dist directories as well as all their contents
gulp.task('dev:clean', function() {
    var directories = [
        './dist'
    ];

    return gulp.src(directories, {read: false})
        .pipe(vinylPaths(del))
        .on('err', gutil.log);
});

// concats the JS source files into a single app.js file. Performs JS linting and ES6->ES5 transpilation
gulp.task('dev:js', ['dev:clean'], function() {
    var appFiles = './source/**/*.js',
        destPath = './dist',
        stream = streamqueue({ objectMode: true });

    stream.queue(
        gulp.src(appFiles).pipe(eslint()).pipe(eslint.format())
    );

    return stream.done()
        .pipe(sourcemaps.init())
        .pipe(babel({ modules: "umd" }))
        .pipe(concat('treenode.js'))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(destPath))
});

// *** PROD ***
gulp.task('prod', ['prod:js']);

gulp.task('prod:js', ['dev:js'], function() {
    var appFiles = './source/**/*.js',
        destPath = './dist',
        stream = streamqueue({ objectMode: true });

    stream.queue(
        gulp.src(appFiles).pipe(eslint()).pipe(eslint.format())
    );

    return stream.done()
        .pipe(babel({ modules: "umd" }))
        .pipe(concat('treenode.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest(destPath));
});

// *** TEST ***
gulp.task('test', ['test:jasmine']);

gulp.task('test:jasmine', function() {
    return gulp.src('./test/**/*.spec.js')
        .pipe(jasmine());
});<commit_msg>Include Dev as a necessary dependency for Test in Gulp file<commit_after>// vars and includes
var babel = require('gulp-babel');
var del = require('del');
var gulp = require('gulp');
var concat = require('gulp-concat-util');
var eslint = require('gulp-eslint');
var jasmine = require('gulp-jasmine');
var gutil = require('gulp-util');
var path = require('path');
var sourcemaps = require('gulp-sourcemaps');
var streamqueue = require('streamqueue');
var uglify = require('gulp-uglify');
var vinylPaths = require('vinyl-paths');

// *** DEV ***
gulp.task('dev', ['dev:compile'], function() {
    gulp.watch('./source/**/*.js', ['dev:js', 'test']);
});

gulp.task('dev:compile', ['dev:precompile', 'dev:js']);

gulp.task('dev:precompile', ['dev:clean']);

// deletes css and js/dist directories as well as all their contents
gulp.task('dev:clean', function() {
    var directories = [
        './dist'
    ];

    return gulp.src(directories, {read: false})
        .pipe(vinylPaths(del))
        .on('err', gutil.log);
});

// concats the JS source files into a single app.js file. Performs JS linting and ES6->ES5 transpilation
gulp.task('dev:js', ['dev:clean'], function() {
    var appFiles = './source/**/*.js',
        destPath = './dist',
        stream = streamqueue({ objectMode: true });

    stream.queue(
        gulp.src(appFiles).pipe(eslint()).pipe(eslint.format())
    );

    return stream.done()
        .pipe(sourcemaps.init())
        .pipe(babel({ modules: "umd" }))
        .pipe(concat('treenode.js'))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(destPath))
});

// *** PROD ***
gulp.task('prod', ['prod:js']);

gulp.task('prod:js', ['dev:js'], function() {
    var appFiles = './source/**/*.js',
        destPath = './dist',
        stream = streamqueue({ objectMode: true });

    stream.queue(
        gulp.src(appFiles).pipe(eslint()).pipe(eslint.format())
    );

    return stream.done()
        .pipe(babel({ modules: "umd" }))
        .pipe(concat('treenode.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest(destPath));
});

// *** TEST ***
gulp.task('test', ['test:jasmine']);

gulp.task('test:jasmine', ['dev:js'], function() {
    return gulp.src('./test/**/*.spec.js')
        .pipe(jasmine());
});<|endoftext|>


<commit_before>var gulp = require('gulp')
var sass = require('gulp-sass')
var concat = require('gulp-concat')
var minify = require('gulp-minify-css')
var rename = require('gulp-rename')
var babel = require('gulp-babel')
var fs = require('fs')
// var shell = require('gulp-shell')

var jsDirectories = ['bin', 'lib', 'middlewares', 'plugins', 'routes']
var jsGlob = function(prefix) {
  return jsDirectories.map(function(e) {
    return [
      [prefix, e, '**', '*.js'].join('/'),
      [prefix, e, '*.js'].join('/')
    ]
  })
  .reduce(function(a, b) { return a.concat(b) })
  .concat(['!./gulpfile.js', './*.js'])
}

gulp.task('styles', function() {
  return gulp.src('./client/scss/*.scss')
  .pipe(sass({
    includePaths: ['bower_components/foundation/scss']
  }))
  .pipe(concat('app.css'))
  .pipe(gulp.dest('./client/css'))
  .pipe(minify())
  .pipe(rename('app.min.css'))
  .pipe(gulp.dest('./client/css'))
})

gulp.task('babelize', function() {
  return gulp.src(jsGlob('.'), {base: './'})
  .pipe(babel())
  .pipe(gulp.dest('./dist/'))
})

gulp.task('prepublish:backup', function() {
  return gulp.src(jsGlob('.'), {base: './'})
  .pipe(gulp.dest('./src'))
})

//git stash to revert
gulp.task('prepublish:babelize', ['babelize', 'prepublish:backup'], function() {
  return gulp.src(jsGlob('./dist'), {base: './dist'})
  .pipe(rename(function(path) {
    path.dirname = path.dirname.replace('..', '.')
  }))
  .pipe(gulp.dest('.'))
})

gulp.task('prepublish:restore', function() {
  return gulp.src(jsGlob('./src'), {base: './src'})
  .pipe(rename(function(path) {
    path.dirname = path.dirname.replace('..', '.')
  }))
  .pipe(gulp.dest('.'))
})

gulp.task('default', ['styles'])
// gulp.task('prepublish', 'prepublish:babelize', shell.task('npm publish'), 'prepublish:restore')

gulp.task('watch', ['default'], function() {
  gulp.watch('./client/scss/*.scss', ['styles'])
})
<commit_msg>chore(gulp): Publish task<commit_after>var gulp = require('gulp')
var sass = require('gulp-sass')
var concat = require('gulp-concat')
var minify = require('gulp-minify-css')
var rename = require('gulp-rename')
var babel = require('gulp-babel')
var fs = require('fs')
var shell = require('gulp-shell')

var jsDirectories = ['bin', 'lib', 'middlewares', 'plugins', 'routes']
var jsGlob = function(prefix) {
  return jsDirectories.map(function(e) {
    return [
      [prefix, e, '**', '*.js'].join('/'),
      [prefix, e, '*.js'].join('/')
    ]
  })
  .reduce(function(a, b) { return a.concat(b) })
  .concat(['!./gulpfile.js', './*.js'])
}

gulp.task('styles', function() {
  return gulp.src('./client/scss/*.scss')
  .pipe(sass({
    includePaths: ['bower_components/foundation/scss']
  }))
  .pipe(concat('app.css'))
  .pipe(gulp.dest('./client/css'))
  .pipe(minify())
  .pipe(rename('app.min.css'))
  .pipe(gulp.dest('./client/css'))
})

gulp.task('babelize', function() {
  return gulp.src(jsGlob('.'), {base: './'})
  .pipe(babel())
  .pipe(gulp.dest('./dist/'))
})

gulp.task('prepublish:backup', function() {
  return gulp.src(jsGlob('.'), {base: './'})
  .pipe(gulp.dest('./src'))
})

//git stash to revert
gulp.task('prepublish:babelize', ['babelize', 'prepublish:backup'], function() {
  return gulp.src(jsGlob('./dist'), {base: './dist'})
  .pipe(rename(function(path) {
    path.dirname = path.dirname.replace('..', '.')
  }))
  .pipe(gulp.dest('.'))
})

gulp.task('prepublish:restore', function() {
  return gulp.src(jsGlob('./src'), {base: './src'})
  .pipe(rename(function(path) {
    path.dirname = path.dirname.replace('..', '.')
  }))
  .pipe(gulp.dest('.'))
})

gulp.task('prepublish:npm', ['prepublish:babelize'], shell.task('npm publish'))

gulp.task('default', ['styles'])
gulp.task('publish', ['prepublish:npm', 'prepublish:restore'])

gulp.task('watch', ['default'], function() {
  gulp.watch('./client/scss/*.scss', ['styles'])
})
<|endoftext|>


<commit_before>var gulp = require('gulp-help')(require('gulp'));
var zip = require('gulp-zip');
var gutil = require('gulp-util');
var rimraf = require('rimraf');
var path = require('path');
var extensionPath = path.resolve(__dirname, 'extension');
var browserify = require('browserify');
var transform = require('vinyl-transform');

gulp.task('default', ['build']);
gulp.task('build', 'Rebuild the extension files', ['extension-assets', 'extension-browserify']);

gulp.task('extension-browserify', 'Browserify the extension files', ['prepare'], function() {
  var browserified = transform(function(filename) {
    var b = browserify(filename);
    return b.bundle();
  });

  return gulp.src([
    './extension/src/index.js'
  ])
  .pipe(browserified)
  .pipe(gulp.dest('./extension/dist'));
});

gulp.task('extension-assets', 'Copy the extension source assets into the dist folder', ['prepare', 'chromex-assets'], function() {
  return gulp.src([
    './extension/src/*.png',
    './extension/src/*.svg',
    './extension/src/*.json'
  ])
  .pipe(gulp.dest('./extension/dist'));
});

gulp.task('chromex-assets', 'Assets required for the chromex code to work as expected', ['prepare'], function() {
  return gulp.src([
    './node_modules/chromex/scripts/*.js'
  ])
  .pipe(gulp.dest('./extension/dist/scripts'));
});

gulp.task('prepare', 'Prepare the build', ['clean'], function() {
});

gulp.task('clean', 'Clean the extension dist directory', function(cb) {
  rimraf(path.join(extensionPath, 'dist'), cb);
});

gulp.task('package', 'Package the extension for deployment', ['build'], function() {
  return gulp.src([
    './extension/dist/**',
  ], { base: './extension/dist' })
  .pipe(zip('extension-bundle.zip'))
  .pipe(gulp.dest('.//'));
});
<commit_msg>gulpfile moved to rtc-screenshare-extension repo<commit_after><|endoftext|>


<commit_before>var gulp = require('gulp');
var webserver = require('gulp-webserver'); // https://www.npmjs.com/package/gulp-webserver
var inject = require('gulp-inject'); // https://www.npmjs.com/package/gulp-inject
var util = require('gulp-util'); // https://www.npmjs.com/package/gulp-util
var debug = require('gulp-debug'); // https://www.npmjs.com/package/gulp-debug
var jshint = require('gulp-jshint'); // https://github.com/spalger/gulp-jshint
var jscs = require('gulp-jscs'); // https://github.com/jscs-dev/gulp-jscs
var map = require('map-stream'); // https://github.com/dominictarr/map-stream
var yargs = require('yargs').argv; // https://www.npmjs.com/package/yargs
var gulpif = require('gulp-if'); // https://github.com/robrich/gulp-if
var annotate = require('gulp-ng-annotate'); // https://www.npmjs.com/package/gulp-ng-annotate
var filter = require('gulp-filter'); // https://www.npmjs.com/package/gulp-filter
var uglify = require('gulp-uglify'); // https://github.com/terinjokes/gulp-uglify
var useref = require('gulp-useref'); // https://www.npmjs.com/package/gulp-useref
var minify = require('gulp-minify-css'); // https://www.npmjs.com/package/gulp-minify-css
var imagemin = require('gulp-imagemin'); // https://github.com/sindresorhus/gulp-imagemin
var listing = require('gulp-task-listing'); // https://www.npmjs.com/package/gulp-task-listing
var templatecache = require('gulp-angular-templatecache'); // https://www.npmjs.com/package/gulp-angular-templatecache
var htmlmin = require('gulp-htmlmin'); // https://github.com/jonschlinkert/gulp-htmlmin
var config = require('./gulp.config.js');
var runsequence = require('run-sequence'); // https://www.npmjs.com/package/run-sequence

/**
 * Prepares everything to serve the development build
 */
gulp.task('serve', ['inject', 'webserver', 'watchers'], function() {
    util.log(util.colors.bgBlue('Serving Development'));
});

/**
 * Starts a webserver to launch the development build
 */
gulp.task('webserver', ['dev-settings'], function() {
    gulp.src(config.root)
        .pipe(webserver({
            // https://github.com/schickling/gulp-webserver
            // http://stephenradford.me/gulp-angularjs-and-html5mode/
            fallback: config.index,
            livereload: true,
            open: true
        }));
});

/**
 * Launch a webserver to serve the production build
 */
gulp.task('serve-production', ['build'], function() {
    util.log(util.colors.bgBlue('Serving Production Build'));
    gulp.src(config.build)
        .pipe(webserver({
            // https://github.com/schickling/gulp-webserver
            // http://stephenradford.me/gulp-angularjs-and-html5mode/
            fallback: config.index,
            livereload: true,
            open: true
        }));
});

/**
 * Watcher setup, watch for changes in js, css and html files
 * ignore changes to the templates.js file since it is auto-generated
 *
 *  @bug when adding folders gulp might crash, at least in linux
 *  the problem seems to be with gaze, and has no easy solution
 */
gulp.task('watchers', function(){
    util.log(util.colors.bgBlue('Setting Up Watchers'));
    gulp.watch([config.jsfiles, config.cssfiles, config.htmlfiles, '!/app/core/templates.js'], ['html-inject']);
    gulp.watch([config.checkfiles], ['check']);
    // we could set up here a watcher for the bower files, but that means the task
    // will run twice on install, and none on uninstall since there appears
    // to be some issues with the watch task and also with the gaze dependency
    // so we decided to go back and use bower hooks, unfortunately bower does not
    // have a postuninstall hook, so we are f... well, i've discover that it supports preuninstall
    // so we are going that route, see the .bowerrc file
});

/*
 * Injects css and js files in index.html file
 */
gulp.task('inject', function(){
    return runsequence('bower-html-inject', 'html-inject');
});

/**
 *  Read the index.html file and inject css and js files using gulp-inject
 */
gulp.task('html-inject', ['templatecache'], function() {
    // gulp util uses chalk, see reference
    // https://github.com/chalk/chalk
    util.log(util.colors.bgBlue('Custom Code HTML Inject'));
    return gulp
.src(config.index)
        // gulp src options: https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpsrcglobs-options
        // we do not need to read the file content, all we need here are the paths
        // gulp inject options: https://github.com/klei/gulp-inject#optionsrelative
.pipe(inject(gulp.src(config.jsfiles.concat(config.cssfiles), {read: false}), {relative: false, addRootSlash: false}))
.pipe(gulp.dest(config.root));
});

/**
 *  Uses Wiredep to read dependencies from bower.json file
 *  and inject them in the index.html file
 *  this task is also called by the hooks defined in .bowerrc
 */
gulp.task('bower-html-inject', function() {
    util.log(util.colors.bgBlue('Bower Dependencies HTML Inject'));
    var wiredep = require('wiredep').stream;

    var options = {
        bowerJson: require(config.bowerjson),
        directory: config.libs
    };

    return gulp
   .src(config.index)
   .pipe(wiredep(options))
   .pipe(gulp.dest(config.root));
});

/**
 * Lints JavaScript code and enforces coding style. Rules are
 * defined in .jshintrc and .jscsrc respectively
 */
gulp.task('check', function(){
    runsequence('check-jshint', 'check-jscs');
});

/**
 * Code linting using jshint
 */
gulp.task('check-jshint', function() {
    util.log(util.colors.bgBlue('Code check using JSHint'));
    return gulp
   .src(config.checkfiles)
   .pipe(jshint())
   .pipe(jshint.reporter('jshint-stylish'), {verbose: true}) //stylish reporter https://github.com/sindresorhus/jshint-stylish
   .pipe(JSHintBeepReporter());
});

/**
 * Custom jshint reporterer
 *
 * This will beep to warn about jshint fails
 */
var JSHintBeepReporter = function(file, cb) {
    return map(function (file, cb) {
        if (!file.jshint.success) {
            util.beep();
        }
        cb(null, file);
    })
};

/**
 * Check code style using jscs
 */
gulp.task('check-jscs', function() {
    util.log(util.colors.bgBlue('Code check using JSCS'));
    return gulp
   .src(config.checkfiles)
   .pipe(jscs())
   .pipe(jscs.reporter())
   .pipe(JSCSBeepReporter());
});

/**
 * Custom jscs reporterer
 *
 * This will beep to warn about jscs fails
 */
var JSCSBeepReporter = function () {
    return map(function (file) {
        if (!file.jscs.success) {
            util.beep();
        }
        action(file);
    });
};

/**
 * Creates a build to prepare the app for production
 * reads the index.html and picks the required css and js
 * files using useref
 */
gulp.task('build', ['inject', 'images', 'icons', 'production-settings'], function() {
    util.log(util.colors.bgBlue('Building App for Production'));
    return gulp
    .src(config.index)
    .pipe(useref())
    .pipe(gulpif('*.js', annotate()))
    .pipe(gulpif('*.js', uglify()))
    .pipe(gulpif('*.css', minify()))
    // the index.html minification step must be the last one since the useref plugin
    // depends on the comments to know where to find and inject files
    .pipe(gulpif('index.html', htmlmin({collapseWhitespace: true, removeComments: true})))
    .pipe(gulp.dest(config.build));
});

/**
 * Compresses images and copies them to the build folder
 */
gulp.task('images', function() {
    util.log(util.colors.bgBlue('Compressing and Copying Images to Build Folder'));
    return gulp
   .src(config.images)
   .pipe(imagemin())
   .pipe(gulp.dest(config.build + 'images'));
});

/**
 * Copies icons to build folder
 */
gulp.task('icons', function() {
    var dest = config.build + 'content/icons';
    util.log(util.colors.bgBlue('Copying Icons to Build Folder'));
    return gulp
        .src(config.icons)
        .pipe(gulp.dest(dest));
});

/**
 * Copies development settings file to app folder
 */
gulp.task('dev-settings',function(){
    util.log(util.colors.bgBlue('Copying Development Settings File'));
    return gulp
   .src('dist/angular/development/settings.js')
   .pipe(gulp.dest(config.core));
});

/**
 * Copies production settings file to app folder
 */
gulp.task('production-settings',function(){
    util.log(util.colors.bgBlue('Copying Production Settings File'));
    return gulp
   .src('dist/angular/production/settings.js')
   .pipe(gulp.dest(config.core));
});

/**
 * Creates $templateCache from the html templates
 */
gulp.task('templatecache', function() {
    util.log(util.colors.bgBlue('Create an Angular Template Cache'));
    return gulp
        .src(config.htmlfiles)
        // http://perfectionkills.com/experimenting-with-html-minifier/#collapse_whitespace
        .pipe(htmlmin({collapseWhitespace: true}))
        .pipe(templatecache('templates.js', {
            module: 'app.core',
            standalone: false,
            root: 'app/'
        }))
        .pipe(gulp.dest(config.core));
});

/**
 * Lists all available tasks
 * @todo customize list by overring filters
 * By default, is is defined as the regular expression /[-_:]/
 * which means that any task with a hyphen, underscore, or colon in it's name is assumed to be a subtask
 */
gulp.task('help', listing);

/**
 * Sets up the default task, this just calls the help task
 */
gulp.task('default', ['help']);
<commit_msg>Fixed a bug where JSCSBeepReporter was calling an undefined function<commit_after>var gulp = require('gulp');
var webserver = require('gulp-webserver'); // https://www.npmjs.com/package/gulp-webserver
var inject = require('gulp-inject'); // https://www.npmjs.com/package/gulp-inject
var util = require('gulp-util'); // https://www.npmjs.com/package/gulp-util
var debug = require('gulp-debug'); // https://www.npmjs.com/package/gulp-debug
var jshint = require('gulp-jshint'); // https://github.com/spalger/gulp-jshint
var jscs = require('gulp-jscs'); // https://github.com/jscs-dev/gulp-jscs
var map = require('map-stream'); // https://github.com/dominictarr/map-stream
var yargs = require('yargs').argv; // https://www.npmjs.com/package/yargs
var gulpif = require('gulp-if'); // https://github.com/robrich/gulp-if
var annotate = require('gulp-ng-annotate'); // https://www.npmjs.com/package/gulp-ng-annotate
var filter = require('gulp-filter'); // https://www.npmjs.com/package/gulp-filter
var uglify = require('gulp-uglify'); // https://github.com/terinjokes/gulp-uglify
var useref = require('gulp-useref'); // https://www.npmjs.com/package/gulp-useref
var minify = require('gulp-minify-css'); // https://www.npmjs.com/package/gulp-minify-css
var imagemin = require('gulp-imagemin'); // https://github.com/sindresorhus/gulp-imagemin
var listing = require('gulp-task-listing'); // https://www.npmjs.com/package/gulp-task-listing
var templatecache = require('gulp-angular-templatecache'); // https://www.npmjs.com/package/gulp-angular-templatecache
var htmlmin = require('gulp-htmlmin'); // https://github.com/jonschlinkert/gulp-htmlmin
var config = require('./gulp.config.js');
var runsequence = require('run-sequence'); // https://www.npmjs.com/package/run-sequence

/**
 * Prepares everything to serve the development build
 */
gulp.task('serve', ['inject', 'webserver', 'watchers'], function() {
    util.log(util.colors.bgBlue('Serving Development'));
});

/**
 * Starts a webserver to launch the development build
 */
gulp.task('webserver', ['dev-settings'], function() {
    gulp.src(config.root)
        .pipe(webserver({
            // https://github.com/schickling/gulp-webserver
            // http://stephenradford.me/gulp-angularjs-and-html5mode/
            fallback: config.index,
            livereload: true,
            open: true
        }));
});

/**
 * Launch a webserver to serve the production build
 */
gulp.task('serve-production', ['build'], function() {
    util.log(util.colors.bgBlue('Serving Production Build'));
    gulp.src(config.build)
        .pipe(webserver({
            // https://github.com/schickling/gulp-webserver
            // http://stephenradford.me/gulp-angularjs-and-html5mode/
            fallback: config.index,
            livereload: true,
            open: true
        }));
});

/**
 * Watcher setup, watch for changes in js, css and html files
 * ignore changes to the templates.js file since it is auto-generated
 *
 *  @bug when adding folders gulp might crash, at least in linux
 *  the problem seems to be with gaze, and has no easy solution
 */
gulp.task('watchers', function(){
    util.log(util.colors.bgBlue('Setting Up Watchers'));
    gulp.watch([config.jsfiles, config.cssfiles, config.htmlfiles, '!/app/core/templates.js'], ['html-inject']);
    gulp.watch([config.checkfiles], ['check']);
    // we could set up here a watcher for the bower files, but that means the task
    // will run twice on install, and none on uninstall since there appears
    // to be some issues with the watch task and also with the gaze dependency
    // so we decided to go back and use bower hooks, unfortunately bower does not
    // have a postuninstall hook, so we are f... well, i've discover that it supports preuninstall
    // so we are going that route, see the .bowerrc file
});

/*
 * Injects css and js files in index.html file
 */
gulp.task('inject', function(){
    return runsequence('bower-html-inject', 'html-inject');
});

/**
 *  Read the index.html file and inject css and js files using gulp-inject
 */
gulp.task('html-inject', ['templatecache'], function() {
    // gulp util uses chalk, see reference
    // https://github.com/chalk/chalk
    util.log(util.colors.bgBlue('Custom Code HTML Inject'));
    return gulp
.src(config.index)
        // gulp src options: https://github.com/gulpjs/gulp/blob/master/docs/API.md#gulpsrcglobs-options
        // we do not need to read the file content, all we need here are the paths
        // gulp inject options: https://github.com/klei/gulp-inject#optionsrelative
.pipe(inject(gulp.src(config.jsfiles.concat(config.cssfiles), {read: false}), {relative: false, addRootSlash: false}))
.pipe(gulp.dest(config.root));
});

/**
 *  Uses Wiredep to read dependencies from bower.json file
 *  and inject them in the index.html file
 *  this task is also called by the hooks defined in .bowerrc
 */
gulp.task('bower-html-inject', function() {
    util.log(util.colors.bgBlue('Bower Dependencies HTML Inject'));
    var wiredep = require('wiredep').stream;

    var options = {
        bowerJson: require(config.bowerjson),
        directory: config.libs
    };

    return gulp
   .src(config.index)
   .pipe(wiredep(options))
   .pipe(gulp.dest(config.root));
});

/**
 * Lints JavaScript code and enforces coding style. Rules are
 * defined in .jshintrc and .jscsrc respectively
 */
gulp.task('check', function(){
    runsequence('check-jshint', 'check-jscs');
});

/**
 * Code linting using jshint
 */
gulp.task('check-jshint', function() {
    util.log(util.colors.bgBlue('Code check using JSHint'));
    return gulp
   .src(config.checkfiles)
   .pipe(jshint())
   .pipe(jshint.reporter('jshint-stylish'), {verbose: true}) //stylish reporter https://github.com/sindresorhus/jshint-stylish
   .pipe(JSHintBeepReporter());
});

/**
 * Custom jshint reporterer
 *
 * This will beep to warn about jshint fails
 */
var JSHintBeepReporter = function(file, cb) {
    return map(function (file, cb) {
        if (!file.jshint.success) {
            util.beep();
        }
        cb(null, file);
    })
};

/**
 * Check code style using jscs
 */
gulp.task('check-jscs', function() {
    util.log(util.colors.bgBlue('Code check using JSCS'));
    return gulp
   .src(config.checkfiles)
   .pipe(jscs())
   .pipe(jscs.reporter())
   .pipe(JSCSBeepReporter());
});

/**
 * Custom jscs reporterer
 *
 * This will beep to warn about jscs fails
 */
var JSCSBeepReporter = function () {
    return map(function (file) {
        if (!file.jscs.success) {
            util.beep();
        }
    });
};

/**
 * Creates a build to prepare the app for production
 * reads the index.html and picks the required css and js
 * files using useref
 */
gulp.task('build', ['inject', 'images', 'icons', 'production-settings'], function() {
    util.log(util.colors.bgBlue('Building App for Production'));
    return gulp
    .src(config.index)
    .pipe(useref())
    .pipe(gulpif('*.js', annotate()))
    .pipe(gulpif('*.js', uglify()))
    .pipe(gulpif('*.css', minify()))
    // the index.html minification step must be the last one since the useref plugin
    // depends on the comments to know where to find and inject files
    .pipe(gulpif('index.html', htmlmin({collapseWhitespace: true, removeComments: true})))
    .pipe(gulp.dest(config.build));
});

/**
 * Compresses images and copies them to the build folder
 */
gulp.task('images', function() {
    util.log(util.colors.bgBlue('Compressing and Copying Images to Build Folder'));
    return gulp
   .src(config.images)
   .pipe(imagemin())
   .pipe(gulp.dest(config.build + 'images'));
});

/**
 * Copies icons to build folder
 */
gulp.task('icons', function() {
    var dest = config.build + 'content/icons';
    util.log(util.colors.bgBlue('Copying Icons to Build Folder'));
    return gulp
        .src(config.icons)
        .pipe(gulp.dest(dest));
});

/**
 * Copies development settings file to app folder
 */
gulp.task('dev-settings',function(){
    util.log(util.colors.bgBlue('Copying Development Settings File'));
    return gulp
   .src('dist/angular/development/settings.js')
   .pipe(gulp.dest(config.core));
});

/**
 * Copies production settings file to app folder
 */
gulp.task('production-settings',function(){
    util.log(util.colors.bgBlue('Copying Production Settings File'));
    return gulp
   .src('dist/angular/production/settings.js')
   .pipe(gulp.dest(config.core));
});

/**
 * Creates $templateCache from the html templates
 */
gulp.task('templatecache', function() {
    util.log(util.colors.bgBlue('Create an Angular Template Cache'));
    return gulp
        .src(config.htmlfiles)
        // http://perfectionkills.com/experimenting-with-html-minifier/#collapse_whitespace
        .pipe(htmlmin({collapseWhitespace: true}))
        .pipe(templatecache('templates.js', {
            module: 'app.core',
            standalone: false,
            root: 'app/'
        }))
        .pipe(gulp.dest(config.core));
});

/**
 * Lists all available tasks
 * @todo customize list by overring filters
 * By default, is is defined as the regular expression /[-_:]/
 * which means that any task with a hyphen, underscore, or colon in it's name is assumed to be a subtask
 */
gulp.task('help', listing);

/**
 * Sets up the default task, this just calls the help task
 */
gulp.task('default', ['help']);
<|endoftext|>