blob: ee29c80647283930afcd4469bd332b570d6d129f [file] [log] [blame]
Matteo Scandolofb46ae62017-08-08 09:10:50 -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 Scandolod819c922016-12-02 14:06:14 -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
Matteo Scandolof6acdbe2016-12-13 10:29:37 -080032exports.ngModule = 'app';
33
Matteo Scandolod819c922016-12-02 14:06:14 -080034/**
35 * The main paths of your project handle these with care
36 */
37exports.paths = {
38 src: 'src',
39 dist: 'dist',
Matteo Scandolo43ffb672016-12-02 14:49:58 -080040 appConfig: 'conf/app',
Matteo Scandolod819c922016-12-02 14:06:14 -080041 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};