Skip to content

Commit

Permalink
Refactoring config
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed Feb 12, 2015
1 parent eb223c6 commit 6943bfa
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tasks/config/user.js
Expand Up @@ -13,8 +13,11 @@ var
defaults = require('./defaults'),
config = require('./project/config'),

// semantic.json settings
userConfig,

// final config object
userConfig
gulpConfig
;


Expand All @@ -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;

0 comments on commit 6943bfa

Please sign in to comment.