| <component name="CopyrightManager"> | ||
| <copyright> | ||
| <option name="notice" value="Copyright (c) &#36;today.year. David M. Lee, II <leedm777@yahoo.com>" /> | ||
| <option name="keyword" value="Copyright" /> | ||
| <option name="allowReplaceKeyword" value="David M. Lee, II" /> | ||
| <option name="myName" value="dave" /> | ||
| <option name="myLocal" value="true" /> | ||
| </copyright> | ||
| </component> |
| <component name="CopyrightManager"> | ||
| <settings default=""> | ||
| <module2copyright /> | ||
| <settings default="dave"> | ||
| <LanguageOptions name="__TEMPLATE__"> | ||
| <option name="addBlankAfter" value="false" /> | ||
| <option name="block" value="false" /> | ||
| </LanguageOptions> | ||
| </settings> | ||
| </component> |
+2
-0
@@ -5,2 +5,4 @@ <?xml version="1.0" encoding="UTF-8"?> | ||
| <type id="JRUBY" /> | ||
| <type id="Python" /> | ||
| <type id="sass-stdlib" /> | ||
| </component> | ||
@@ -7,0 +9,0 @@ <component name="IdProvider" IDEtalkID="20364A77574125419E815085C6DCB674" /> |
+1
-1
| { | ||
| "name": "parfait", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "author": "David M. Lee, II <leedm777@yahoo.com>", | ||
@@ -5,0 +5,0 @@ "description": "A sweet multi-layered configuration framework", |
+27
-0
@@ -25,2 +25,9 @@ # Parfait.js | ||
| ## Installation | ||
| Parfait.js is [hosted on NPM][], so you can simply install it, and add | ||
| it to your `package.json` as a dependency. | ||
| $ npm install --save parfait | ||
| ## How it works | ||
@@ -89,1 +96,21 @@ | ||
| configuration should be. | ||
| ## TODO | ||
| * Array append/prepend (either single item or another array) | ||
| # Append 'bar' to the array 'foo' | ||
| "foo+": "bar" | ||
| # Append 'bar', 'bam', 'bang' to the array 'foo' | ||
| "foo+": [ "bar", "bam", "bang" ] | ||
| # Prepend 'bar' to the array 'foo' | ||
| "+foo": "bar" | ||
| * Object replacement instead of merging | ||
| # Discard 'foo' and replace with empty object | ||
| "foo=": {} | ||
| # Discard 'foo' and replace with given object | ||
| "foo=": { "bar": 3.14159 } | ||
| * Individual key deleltion | ||
| # Remove 'foo' | ||
| "foo-": null | ||
| [hosted on NPM]: https://www.npmjs.org/package/parfait |
+14
-7
@@ -0,1 +1,4 @@ | ||
| # Copyright (c) 2014. David M. Lee, II <leedm777@yahoo.com> | ||
| 'use strict' | ||
| Q = require 'q' | ||
@@ -12,12 +15,14 @@ path = require 'path' | ||
| @param {String} environment | ||
| @param {String} directory | ||
| @param {*} config | ||
| @param {String} environment Environment to select. | ||
| @param {String} directory Directory to process configuration files. | ||
| @param {*} preConfig Base configuration to start with. | ||
| @param {*} postConfig Config to merge on top of final result. | ||
| @param {appdirs} appdirs Methods `siteDataDir` and `userDataDir` for locating site and user data directories, respectively. | ||
| @return {Promise<Object>} Consolidated configuration object. | ||
| ### | ||
| configure = ({environment, directory, config, appdirs}) -> | ||
| configure = ({environment, directory, preConfig, postConfig, appdirs}) -> | ||
| environment ?= (process.env && process.env.NODE_ENV) || 'development' | ||
| directory ?= 'config' | ||
| config ?= {} | ||
| preConfig ?= {} | ||
| postConfig ?= {} | ||
| appdirs ?= appdirsDefault | ||
@@ -29,4 +34,4 @@ | ||
| # Apply the base config to the hard coded config | ||
| processDirectory directory, config | ||
| # Apply the base config to the hard coded preConfig | ||
| processDirectory directory, preConfig | ||
| .then (baseConfig) -> | ||
@@ -53,2 +58,4 @@ # Now the environment specific base config | ||
| processDirectory envDirectory(userDir), userConfig | ||
| .then (userEnvConfig) -> | ||
| confmerge userEnvConfig, postConfig | ||
@@ -55,0 +62,0 @@ ### |
@@ -0,1 +1,4 @@ | ||
| # Copyright (c) 2014. David M. Lee, II <leedm777@yahoo.com> | ||
| 'use strict' | ||
| _ = require('lodash') | ||
@@ -2,0 +5,0 @@ |
@@ -0,1 +1,4 @@ | ||
| # Copyright (c) 2014. David M. Lee, II <leedm777@yahoo.com> | ||
| 'use strict' | ||
| fs = require 'fs' | ||
@@ -2,0 +5,0 @@ Q = require 'q' |
+5
-1
@@ -0,1 +1,4 @@ | ||
| # Copyright (c) 2014. David M. Lee, II <leedm777@yahoo.com> | ||
| 'use strict' | ||
| ### | ||
@@ -6,3 +9,4 @@ Parfait.js loader. | ||
| configure = require './configure' | ||
| confmerge = require './confmerge' | ||
| module.exports = { configure } | ||
| module.exports = { configure, confmerge } |
@@ -0,1 +1,3 @@ | ||
| # Copyright (c) 2014. David M. Lee, II <leedm777@yahoo.com> | ||
| 'use strict' | ||
@@ -2,0 +4,0 @@ if process.env.COVERAGE = 'true' |
@@ -0,1 +1,4 @@ | ||
| # Copyright (c) 2014. David M. Lee, II <leedm777@yahoo.com> | ||
| 'use strict' | ||
| mocha = require 'mocha' | ||
@@ -66,3 +69,3 @@ chai = require 'chai' | ||
| directory: 'test/site-user.config/base', | ||
| config: | ||
| preConfig: | ||
| parfait: | ||
@@ -91,3 +94,3 @@ appName: 'someApp', | ||
| environment: 'test', | ||
| config: | ||
| preConfig: | ||
| parfait: | ||
@@ -94,0 +97,0 @@ appName: 'someApp', |
23694
9.82%45
2.27%115
30.68%