blob: ee29c80647283930afcd4469bd332b570d6d129f [file] [log] [blame]
Matteo Scandoloa86e0a12017-08-08 13:05:27 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
Matteo Scandoloe19fa102017-03-09 15:38:59 -080019'use strict';
20
21/**
22 * This file contains the variables used in other gulp files
23 * which defines tasks
24 * By design, we only put there very generic config values
25 * which are used in several places to keep good readability
26 * of the tasks
27 */
28
29const path = require('path');
30const gutil = require('gulp-util');
31
32exports.ngModule = 'app';
33
34/**
35 * The main paths of your project handle these with care
36 */
37exports.paths = {
38 src: 'src',
Matteo Scandolo7c80bf12017-11-16 13:24:53 -080039 dist: 'dist',
Matteo Scandoloe19fa102017-03-09 15:38:59 -080040 appConfig: 'conf/app',
41 tmp: '.tmp',
42 e2e: 'e2e',
43 tasks: 'gulp_tasks'
44};
45
46exports.path = {};
47for (const pathName in exports.paths) {
48 if (exports.paths.hasOwnProperty(pathName)) {
49 exports.path[pathName] = function pathJoin() {
50 const pathValue = exports.paths[pathName];
51 const funcArgs = Array.prototype.slice.call(arguments);
52 const joinArgs = [pathValue].concat(funcArgs);
53 return path.join.apply(this, joinArgs);
54 };
55 }
56}
57
58/**
59 * Common implementation for an error handler of a Gulp plugin
60 */
61exports.errorHandler = function (title) {
62 return function (err) {
63 gutil.log(gutil.colors.red(`[${title}]`), err.toString());
64 this.emit('end');
65 };
66};