From 6943bfac53204bd8752913f2960004e01d66d71a Mon Sep 17 00:00:00 2001 From: jlukic Date: Thu, 12 Feb 2015 16:06:09 -0500 Subject: [PATCH] Refactoring config --- tasks/config/user.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tasks/config/user.js b/tasks/config/user.js index 32864a4de..ab9a2bef5 100644 --- a/tasks/config/user.js +++ b/tasks/config/user.js @@ -13,8 +13,11 @@ var defaults = require('./defaults'), config = require('./project/config'), + // semantic.json settings + userConfig, + // final config object - userConfig + gulpConfig ; @@ -32,28 +35,23 @@ catch(error) { } } -if(!userConfig) { - // No semantic.json file use tasks/config/defaults.js - console.error('Using default values for gulp'); - userConfig = extend(false, {}, defaults); -} -else { - // extend defaults using shallow copy - userConfig = extend(false, {}, defaults, userConfig); -} - +// extend user config with defaults +gulpConfig = (!userConfig) + ? extend(false, {}, defaults) + : extend(false, {}, defaults, userConfig) +; /******************************* Add Derived Values *******************************/ -// adds additional derived values to config -userConfig = config.addDerivedValues(userConfig); +// adds calculated values +config.addDerivedValues(gulpConfig); /******************************* Export *******************************/ -module.exports = userConfig; +module.exports = gulpConfig;