Matteo Scandolo | f0446ed | 2017-08-08 13:05:24 -0700 | [diff] [blame] | 1 | |
| 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 Scandolo | c46a82d | 2017-03-24 18:37:18 -0700 | [diff] [blame] | 19 | '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 | |
| 29 | const path = require('path'); |
| 30 | const gutil = require('gulp-util'); |
| 31 | |
| 32 | exports.ngModule = 'app'; |
| 33 | |
| 34 | /** |
| 35 | * The main paths of your project handle these with care |
| 36 | */ |
| 37 | exports.paths = { |
| 38 | src: 'src', |
| 39 | dist: 'dist/extensions/rcord', // NOTE that 'rcord' have to match the extension name provided in platform install |
| 40 | appConfig: 'conf/app', |
| 41 | tmp: '.tmp', |
| 42 | e2e: 'e2e', |
| 43 | tasks: 'gulp_tasks' |
| 44 | }; |
| 45 | |
| 46 | exports.path = {}; |
| 47 | for (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 | */ |
| 61 | exports.errorHandler = function (title) { |
| 62 | return function (err) { |
| 63 | gutil.log(gutil.colors.red(`[${title}]`), err.toString()); |
| 64 | this.emit('end'); |
| 65 | }; |
| 66 | }; |