Add format-code.sh to run special clang verify
The phosphor-webui repo requires only certain directories
be verified with clang-format. This script utilizes the
override capabilities of the format-code.sh CI process
to handle this.
Change-Id: Icb759a7d94d2b007fa88261dacc39913b1076a0a
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/gulp_tasks/webapp.js b/gulp_tasks/webapp.js
index e514543..edeaff8 100644
--- a/gulp_tasks/webapp.js
+++ b/gulp_tasks/webapp.js
@@ -3,12 +3,10 @@
'use strict';
-var options = require('../gulp-options.js'),
- gulp = require('gulp'),
+var options = require('../gulp-options.js'), gulp = require('gulp'),
// Base dependencies
- clean = require('gulp-clean'),
- rename = require('gulp-rename'),
+ clean = require('gulp-clean'), rename = require('gulp-rename'),
util = require('gulp-util'),
// Angular gulp dependencies
@@ -17,115 +15,99 @@
ngConstant = require('gulp-ng-constant'),
// Classical gulp dependencies
- stripDebug = require('gulp-strip-debug'),
- uglify = require('gulp-uglify'),
- sass = require('gulp-sass'),
- cleanCss = require('gulp-clean-css'),
- rev = require('gulp-rev'),
- revReplace = require('gulp-rev-replace'),
- gulpIf = require('gulp-if'),
- useref = require('gulp-useref'),
+ stripDebug = require('gulp-strip-debug'), uglify = require('gulp-uglify'),
+ sass = require('gulp-sass'), cleanCss = require('gulp-clean-css'),
+ rev = require('gulp-rev'), revReplace = require('gulp-rev-replace'),
+ gulpIf = require('gulp-if'), useref = require('gulp-useref'),
jsoncombine = require('gulp-jsoncombine'),
htmlParser = require('gulp-htmlparser');
-var runSequence = require('run-sequence'),
- es = require('event-stream');
+var runSequence = require('run-sequence'), es = require('event-stream');
-gulp.task('webapp:clean', function () {
- return gulp
- .src([options.targetFolderPath + '/webapp', options.dirname + '/.temp'], { 'read': false })
- .pipe(clean({'force': true}));
+gulp.task('webapp:clean', function() {
+ return gulp
+ .src(
+ [options.targetFolderPath + '/webapp', options.dirname + '/.temp'],
+ {'read': false})
+ .pipe(clean({'force': true}));
});
-gulp.task('webapp:sasscompile', function () {
- return gulp
- .src('app/styles/index.scss')
- .pipe(sass.sync().on('error', util.log))
- .pipe(gulp.dest(options.srcFolderPath + '/styles'))
+gulp.task('webapp:sasscompile', function() {
+ return gulp.src('app/styles/index.scss')
+ .pipe(sass.sync().on('error', util.log))
+ .pipe(gulp.dest(options.srcFolderPath + '/styles'));
});
// ----- To .temp from app
-gulp.task('webapp:copyjs', function () {
- return gulp.src(options.srcFolderPath + '/**/*.js')
- .pipe(ngAnnotate()) // Check angular dependencies injection
- .pipe(stripDebug()) // Remove all logs
- .pipe(uglify({ 'mangle': false }))
- .pipe(gulp.dest(options.dirname + '/.temp'));
+gulp.task('webapp:copyjs', function() {
+ return gulp.src(options.srcFolderPath + '/**/*.js')
+ .pipe(ngAnnotate()) // Check angular dependencies injection
+ .pipe(stripDebug()) // Remove all logs
+ .pipe(uglify({'mangle': false}))
+ .pipe(gulp.dest(options.dirname + '/.temp'));
});
-gulp.task('webapp:copyothers', function () {
- return gulp.src(['**/*', '!**/*.js', '!**/*.css', '!**/*.scss'], { 'cwd': options.srcFolderPath }) // All except JS files
- .pipe(gulp.dest(options.tempFolderPath));
+gulp.task('webapp:copyothers', function() {
+ return gulp
+ .src(
+ ['**/*', '!**/*.js', '!**/*.css', '!**/*.scss'],
+ {'cwd': options.srcFolderPath}) // All except JS files
+ .pipe(gulp.dest(options.tempFolderPath));
});
-gulp.task('webapp:copycss', function () {
- return gulp
- .src('app/styles/index.css')
- .pipe(cleanCss())
- .pipe(gulp.dest(options.tempFolderPath + '/styles'));
+gulp.task('webapp:copycss', function() {
+ return gulp.src('app/styles/index.css')
+ .pipe(cleanCss())
+ .pipe(gulp.dest(options.tempFolderPath + '/styles'));
});
-gulp.task('webapp:constants', function () {
- return gulp
- .src('environment-constants.json')
- .pipe(ngConstant({
- 'name': 'app.constants',
- 'deps': false
- }))
- .pipe(rename('environment-constants.js'))
- .pipe(gulp.dest(options.tempFolderPath + '/constants'));
+gulp.task('webapp:constants', function() {
+ return gulp.src('environment-constants.json')
+ .pipe(ngConstant({'name': 'app.constants', 'deps': false}))
+ .pipe(rename('environment-constants.js'))
+ .pipe(gulp.dest(options.tempFolderPath + '/constants'));
});
// ----- To target/webapp from .temp and bower_components
-gulp.task('webapp:template', function () {
- return gulp.src([options.srcFolderPath + '/**/*.html', '!' + options.srcFolderPath + '/index.html'])
- .pipe(ngTemplateCache('templates.js', {
- 'module': 'app.templates',
- 'standalone': true
- }))
- .pipe(gulp.dest(options.tempFolderPath));
+gulp.task('webapp:template', function() {
+ return gulp
+ .src([
+ options.srcFolderPath + '/**/*.html',
+ '!' + options.srcFolderPath + '/index.html'
+ ])
+ .pipe(ngTemplateCache(
+ 'templates.js', {'module': 'app.templates', 'standalone': true}))
+ .pipe(gulp.dest(options.tempFolderPath));
});
-gulp.task('webapp:useref', function () {
- var tasks = ['index.html'].map(function (indexPage) {
- var assets = useref.assets({ });
+gulp.task('webapp:useref', function() {
+ var tasks = ['index.html'].map(function(indexPage) {
+ var assets = useref.assets({});
- return gulp.src(options.tempFolderPath + '/' + indexPage)
- .pipe(assets)
- .pipe(assets.restore())
- .pipe(useref())
- .pipe(revReplace()) // Force useref to apply the 'rev' method
- .pipe(gulp.dest(options.targetFolderPath + '/webapp'));
- });
-
- return es.concat.apply(null, tasks);
-});
-
-gulp.task('webapp:copyresources', function () {
- return gulp.src(['**/*.*', '!**/*.js', '!**/*.css', '!**/*.html', '!**/*.log'], { 'cwd': options.tempFolderPath })
+ return gulp.src(options.tempFolderPath + '/' + indexPage)
+ .pipe(assets)
+ .pipe(assets.restore())
+ .pipe(useref())
+ .pipe(revReplace()) // Force useref to apply the 'rev' method
.pipe(gulp.dest(options.targetFolderPath + '/webapp'));
+ });
+
+ return es.concat.apply(null, tasks);
});
-module.exports = function (callback) {
- return runSequence(
- 'webapp:clean',
- 'webapp:sasscompile',
- [
- 'webapp:copyjs',
- 'webapp:copycss',
- 'webapp:copyothers'
- ],
- [
- 'webapp:constants',
- 'webapp:template'
- ],
- [
- 'webapp:useref'
- ],
- [
- 'webapp:copyresources'
- ],
- callback
- );
+gulp.task('webapp:copyresources', function() {
+ return gulp
+ .src(
+ ['**/*.*', '!**/*.js', '!**/*.css', '!**/*.html', '!**/*.log'],
+ {'cwd': options.tempFolderPath})
+ .pipe(gulp.dest(options.targetFolderPath + '/webapp'));
+});
+
+module.exports = function(callback) {
+ return runSequence(
+ 'webapp:clean', 'webapp:sasscompile',
+ ['webapp:copyjs', 'webapp:copycss', 'webapp:copyothers'],
+ ['webapp:constants', 'webapp:template'], ['webapp:useref'],
+ ['webapp:copyresources'], callback);
};