Permalink
Browse files

Updated YAML library, made backward compatible, added yaml edge-case …

…tests
  • Loading branch information...
1 parent 40f9a3f commit ec0e3784fbd9f207275732f5b2f6c13858cd87b1 Loren West committed Nov 16, 2011
Showing with 368 additions and 3,049 deletions.
  1. +40 −0 History.md
  2. +1 −1 config/runtime.json
  3. +8 −6 doc/1-protected-test.js.html
  4. +5 −5 doc/2-config-test.js.html
  5. +73 −20 doc/Config.html
  6. +5 −5 doc/ConfigTest.html
  7. +5 −5 doc/ProtectedTest.html
  8. +68 −52 doc/config.js.html
  9. +6 −6 doc/index.html
  10. +1 −1 doc/index.json
  11. +6 −6 doc/module_config.html
  12. +5 −5 doc/module_test.html
  13. +1 −1 doc/raw.json
  14. +62 −46 lib/config.js
  15. +15 −0 node_modules/yaml/History.md
  16. +2 −1 node_modules/yaml/Makefile
  17. +7 −0 node_modules/yaml/examples/boolean.yaml
  18. +1 −1 node_modules/yaml/examples/config.yml
  19. +7 −0 node_modules/yaml/examples/dates.yaml
  20. +41 −9 node_modules/yaml/lib/yaml.js
  21. +1 −1 node_modules/yaml/package.json
  22. +0 −6 node_modules/yaml/spec/fixtures/comments.yml
  23. +0 −4 node_modules/yaml/spec/fixtures/document.yml
  24. +0 −7 node_modules/yaml/spec/fixtures/hash.hash.yml
  25. +0 −1 node_modules/yaml/spec/fixtures/hash.inline.invalid.yml
  26. +0 −4 node_modules/yaml/spec/fixtures/hash.inline.whitespace.yml
  27. +0 −1 node_modules/yaml/spec/fixtures/hash.inline.yml
  28. +0 −3 node_modules/yaml/spec/fixtures/hash.list.yml
  29. +0 −2 node_modules/yaml/spec/fixtures/hash.yml
  30. +0 −4 node_modules/yaml/spec/fixtures/list.hash.yml
  31. +0 −1 node_modules/yaml/spec/fixtures/list.inline.invalid.yml
  32. +0 −1 node_modules/yaml/spec/fixtures/list.inline.yml
  33. +0 −5 node_modules/yaml/spec/fixtures/list.invalid.yml
  34. +0 −7 node_modules/yaml/spec/fixtures/list.list.yml
  35. +0 −6 node_modules/yaml/spec/fixtures/list.lists.yml
  36. +0 −3 node_modules/yaml/spec/fixtures/list.yml
  37. BIN node_modules/yaml/spec/lib/images/bg.png
  38. BIN node_modules/yaml/spec/lib/images/hr.png
  39. BIN node_modules/yaml/spec/lib/images/loading.gif
  40. BIN node_modules/yaml/spec/lib/images/sprites.bg.png
  41. BIN node_modules/yaml/spec/lib/images/sprites.png
  42. BIN node_modules/yaml/spec/lib/images/vr.png
  43. +0 −149 node_modules/yaml/spec/lib/jspec.css
  44. +0 −115 node_modules/yaml/spec/lib/jspec.growl.js
  45. +0 −79 node_modules/yaml/spec/lib/jspec.jquery.js
  46. +0 −1,889 node_modules/yaml/spec/lib/jspec.js
  47. +0 −18 node_modules/yaml/spec/lib/jspec.nodejs.js
  48. +0 −39 node_modules/yaml/spec/lib/jspec.shell.js
  49. +0 −90 node_modules/yaml/spec/lib/jspec.timers.js
  50. +0 −208 node_modules/yaml/spec/lib/jspec.xhr.js
  51. +0 −9 node_modules/yaml/spec/node.js
  52. +0 −222 node_modules/yaml/spec/spec.core.js
  53. +3 −2 package.json
  54. +5 −3 test/1-protected-test.js
View
@@ -0,0 +1,40 @@
+0.4.5 / 2011-11-16
+==================
+
+ * Updated YAML dependency from "0.1.x" to ">=0.2.2"
+ * Added stripping of comment-only and whitespace-only lines in YAML files for backward compatibility
+ * Added more tests for YAML edge cases
+ * Added a homepage link in package.json to the online documentation
+ * Added History.md
+
+0.4.4 / 2011-11-08
+==================
+
+ * Removed deprecated modules from package.json
+
+0.4.3 / 2011-08-02
+==================
+
+ * Made watchForConfigFileChanges public
+
+0.4.2 / 2011-07-11
+==================
+
+ * Added comment stripping from JSON configuration files
+
+0.4.1 / 2011-07-07
+==================
+
+ * Added more tests
+ * Return the module config in setModuleDefaults
+
+0.4.0 / 2011-07-06
+==================
+
+ * Update to version 0.4.0
+
+ * Online documentation
+ * Runtime configuration changes
+ * Configuration value watching
+ * Multi-instance node deployments
+ * Better module developer support
View
@@ -2,5 +2,5 @@
"Customers": {
"dbName": "override_from_runtime_json"
},
- "watchThisValue": 54293
+ "watchThisValue": 54485
}
@@ -4,11 +4,11 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>test 1-protected-test.js </title>
- <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1320799598.57" />
- <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1320799598.57" />
+ <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1321484363.39" />
+ <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1321484363.39" />
- <script type="text/javascript" src="assets/api-js?stamp=1320799598.57"></script>
- <script type="text/javascript" src="assets/ac-js?stamp=1320799598.57"></script>
+ <script type="text/javascript" src="assets/api-js?stamp=1321484363.39"></script>
+ <script type="text/javascript" src="assets/ac-js?stamp=1321484363.39"></script>
</head>
<body id="node-monitor">
@@ -48,7 +48,7 @@
</style>
<div class="highlight"><pre><span class="cm">/**</span>
<span class="cm"> * &lt;p&gt;Unit tests&lt;/p&gt;</span>
-<span class="cm"> * </span>
+<span class="cm"> *</span>
<span class="cm"> * @module test</span>
<span class="cm"> */</span>
@@ -314,6 +314,8 @@
<span class="nx">assert</span><span class="p">.</span><span class="nx">isObject</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">Customers</span><span class="p">);</span>
<span class="nx">assert</span><span class="p">.</span><span class="nx">isTrue</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">Customers</span><span class="p">.</span><span class="nx">dbName</span> <span class="o">==</span> <span class="s1">&#39;from_default_yaml&#39;</span><span class="p">);</span>
<span class="nx">assert</span><span class="p">.</span><span class="nx">isTrue</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">Customers</span><span class="p">.</span><span class="nx">dbPort</span> <span class="o">==</span> <span class="mi">5984</span><span class="p">);</span>
+ <span class="nx">assert</span><span class="p">.</span><span class="nx">isObject</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">AnotherModule</span><span class="p">);</span>
+ <span class="nx">assert</span><span class="p">.</span><span class="nx">isTrue</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">AnotherModule</span><span class="p">.</span><span class="nx">parm2</span> <span class="o">==</span> <span class="s2">&quot;value2&quot;</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">},</span>
@@ -407,7 +409,7 @@
<div id="ft">
<hr />
Released on <a href="https://github.com/lorenwest/node-config">github</a> under the <a href="https://github.com/lorenwest/node-config/blob/master/LICENSE">Apache License 2.0</a>
-<span class="subtitle">version 0.4.4</span>
+<span class="subtitle">version 0.4.5</span>
</div>
</div>
<script type="text/javascript">
@@ -4,11 +4,11 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>test 2-config-test.js </title>
- <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1320799598.57" />
- <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1320799598.57" />
+ <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1321484363.39" />
+ <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1321484363.39" />
- <script type="text/javascript" src="assets/api-js?stamp=1320799598.57"></script>
- <script type="text/javascript" src="assets/ac-js?stamp=1320799598.57"></script>
+ <script type="text/javascript" src="assets/api-js?stamp=1321484363.39"></script>
+ <script type="text/javascript" src="assets/ac-js?stamp=1321484363.39"></script>
</head>
<body id="node-monitor">
@@ -259,7 +259,7 @@
<div id="ft">
<hr />
Released on <a href="https://github.com/lorenwest/node-config">github</a> under the <a href="https://github.com/lorenwest/node-config/blob/master/LICENSE">Apache License 2.0</a>
-<span class="subtitle">version 0.4.4</span>
+<span class="subtitle">version 0.4.5</span>
</div>
</div>
<script type="text/javascript">
View
@@ -4,11 +4,11 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>config Config </title>
- <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1320799598.59" />
- <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1320799598.59" />
+ <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1321484363.42" />
+ <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1321484363.42" />
- <script type="text/javascript" src="assets/api-js?stamp=1320799598.59"></script>
- <script type="text/javascript" src="assets/ac-js?stamp=1320799598.59"></script>
+ <script type="text/javascript" src="assets/api-js?stamp=1321484363.42"></script>
+ <script type="text/javascript" src="assets/ac-js?stamp=1321484363.42"></script>
</head>
<body id="node-monitor">
@@ -262,7 +262,7 @@ <h3 id="methods">Methods</h3>
contents, but can be used to get the diffs between any two Javascript objects.
</p>
<p>
-It works best when object2 originated by deep copying object1, then
+It works best when object2 originated by deep copying object1, then
changes were made to object2, and you want an object that would give you
the changes made to object1 which resulted in object2.
</p>
@@ -738,6 +738,58 @@ <h3 id="methods">Methods</h3>
</div>
<hr />
</div>
+ <div class="protected" rel="yui:method" resource="#method__stripYamlComments">
+ <h4>
+ <a name="method__stripYamlComments">_stripYamlComments</a></h4>
+ <div class="detail" >
+ <code>
+ protected
+
+
+ string
+ <strong property="yui:name">_stripYamlComments</strong>
+ (
+
+
+ fileString
+
+
+ )
+ </code>
+
+ <div class="description" property="yui:description">
+ Strip YAML comments from the string
+The 2.0 yaml parser doesn't allow comment-only or blank lines. Strip them.
+ </div>
+
+ <div class="description">
+
+ <dl rel="yui:parameters">
+ <dt>Parameters:</dt>
+ <dd rel="yui:parameter">
+ <code><span property="yui:name">fileString</span>
+ &lt;<span property="yui:type">string</span>&gt;
+ </code>
+ <span property="yui:description"> The string to strip comments from</span>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt>Returns:
+ <code property="yui:return">
+ string
+ </code></dt>
+ <dd property="yui:returnInfo">The string with comments stripped.</dd>
+ </dl>
+
+
+
+
+ </div>
+
+ </div>
+ <hr />
+ </div>
<div class="" rel="yui:method" resource="#method_constructor">
<h4>
<a name="method_constructor">constructor</a></h4>
@@ -825,12 +877,12 @@ <h3 id="methods">Methods</h3>
<p>Make a configuration property immutable (assuring it cannot be changed
from the current value).</p>
<p>
-This method was built for disabling runtime changes to configuration values,
-but it can be applied to any javascript object.
-</p>
-<p>
This operation cannot be un-done.
</p>
+<p><i>
+This method was built for disabling runtime changes to configuration values,
+but it can be applied to <u>any</u> javascript object.
+</i></p>
<p>Example:</p>
<pre>
var CONFIG = require('config').customer;
@@ -906,7 +958,7 @@ <h3 id="methods">Methods</h3>
Set default configurations for a node.js module.
</p>
<p>
-This allows module developers to attach their configurations onto the
+This allows module developers to attach their configurations onto the
default configuration object so they can be configured by the consumers
of the module.
</p>
@@ -995,15 +1047,15 @@ <h3 id="methods">Methods</h3>
<div class="description" property="yui:description">
<p>Monitor a configuration value for runtime changes.</p>
<p>
-Configuration values can be changed at runtime by the application or by a
-manual change to the config/runtime.json file.
-This method lets you specify a function to run when a configuration
-value changes.
+Configuration values can be changed at runtime by the application or by a
+manual change to the config/runtime.json file.
+This method lets you specify a function to run when a configuration
+value changes.
</p>
-<p>
+<p><i>
This was built for monitoring changes to configuration values,
-but it can be used for watching changes to any javascript object.
-</p>
+but it can be used for watching changes to <u>any</u> javascript object.
+</i></p>
<p>Example:</p>
<pre>
var CONFIG = require('config').customer;
@@ -1081,7 +1133,7 @@ <h3 id="methods">Methods</h3>
<div class="description" property="yui:description">
Monitor the runtime.json file for configuration changes.
<p>
-Long running processes can call this method at startup to have node-config
+Long running processes can call this method at startup to have node-config
automatically monitor and apply changes made to the config/runtime.json file.
</p>
<p>
@@ -1168,6 +1220,7 @@ <h3 id="methods">Methods</h3>
<li class="protected"><a href="#method__parseFile" title="_parseFile">_parseFile</a></li>
<li class="protected"><a href="#method__persistConfigsOnChange" title="_persistConfigsOnChange">_persistConfigsOnChange</a></li>
<li class="protected"><a href="#method__stripComments" title="_stripComments">_stripComments</a></li>
+ <li class="protected"><a href="#method__stripYamlComments" title="_stripYamlComments">_stripYamlComments</a></li>
<li class=""><a href="#method_constructor" title="constructor">constructor</a></li>
<li class=""><a href="#method_makeImmutable" title="makeImmutable">makeImmutable</a></li>
<li class=""><a href="#method_setModuleDefaults" title="setModuleDefaults">setModuleDefaults</a></li>
@@ -1184,11 +1237,11 @@ <h3 id="methods">Methods</h3>
<div id="ft">
<hr />
Released on <a href="https://github.com/lorenwest/node-config">github</a> under the <a href="https://github.com/lorenwest/node-config/blob/master/LICENSE">Apache License 2.0</a>
-<span class="subtitle">version 0.4.4</span>
+<span class="subtitle">version 0.4.5</span>
</div>
</div>
<script type="text/javascript">
- ALL_YUI_PROPS = [{"url": "Config.html#method__attachProtoDeep", "access": "protected", "host": "Config", "type": "method", "name": "_attachProtoDeep"}, {"url": "Config.html#method__cloneDeep", "access": "protected", "host": "Config", "type": "method", "name": "_cloneDeep"}, {"url": "Config.html#method_constructor", "access": "", "host": "Config", "type": "method", "name": "constructor"}, {"url": "Config.html#method__diffDeep", "access": "protected", "host": "Config", "type": "method", "name": "_diffDeep"}, {"url": "Config.html#method__equalsDeep", "access": "protected", "host": "Config", "type": "method", "name": "_equalsDeep"}, {"url": "Config.html#method__extendDeep", "access": "protected", "host": "Config", "type": "method", "name": "_extendDeep"}, {"url": "Config.html#method__isObject", "access": "protected", "host": "Config", "type": "method", "name": "_isObject"}, {"url": "Config.html#method__loadFileConfigs", "access": "protected", "host": "Config", "type": "method", "name": "_loadFileConfigs"}, {"url": "Config.html#method_makeImmutable", "access": "", "host": "Config", "type": "method", "name": "makeImmutable"}, {"url": "Config.html#method__parseFile", "access": "protected", "host": "Config", "type": "method", "name": "_parseFile"}, {"url": "Config.html#method__persistConfigsOnChange", "access": "protected", "host": "Config", "type": "method", "name": "_persistConfigsOnChange"}, {"url": "Config.html#method_setModuleDefaults", "access": "", "host": "Config", "type": "method", "name": "setModuleDefaults"}, {"url": "Config.html#method__stripComments", "access": "protected", "host": "Config", "type": "method", "name": "_stripComments"}, {"url": "Config.html#method_watch", "access": "", "host": "Config", "type": "method", "name": "watch"}, {"url": "Config.html#method_watchForConfigFileChanges", "access": "", "host": "Config", "type": "method", "name": "watchForConfigFileChanges"}];
+ ALL_YUI_PROPS = [{"url": "Config.html#method__attachProtoDeep", "access": "protected", "host": "Config", "type": "method", "name": "_attachProtoDeep"}, {"url": "Config.html#method__cloneDeep", "access": "protected", "host": "Config", "type": "method", "name": "_cloneDeep"}, {"url": "Config.html#method_constructor", "access": "", "host": "Config", "type": "method", "name": "constructor"}, {"url": "Config.html#method__diffDeep", "access": "protected", "host": "Config", "type": "method", "name": "_diffDeep"}, {"url": "Config.html#method__equalsDeep", "access": "protected", "host": "Config", "type": "method", "name": "_equalsDeep"}, {"url": "Config.html#method__extendDeep", "access": "protected", "host": "Config", "type": "method", "name": "_extendDeep"}, {"url": "Config.html#method__isObject", "access": "protected", "host": "Config", "type": "method", "name": "_isObject"}, {"url": "Config.html#method__loadFileConfigs", "access": "protected", "host": "Config", "type": "method", "name": "_loadFileConfigs"}, {"url": "Config.html#method_makeImmutable", "access": "", "host": "Config", "type": "method", "name": "makeImmutable"}, {"url": "Config.html#method__parseFile", "access": "protected", "host": "Config", "type": "method", "name": "_parseFile"}, {"url": "Config.html#method__persistConfigsOnChange", "access": "protected", "host": "Config", "type": "method", "name": "_persistConfigsOnChange"}, {"url": "Config.html#method_setModuleDefaults", "access": "", "host": "Config", "type": "method", "name": "setModuleDefaults"}, {"url": "Config.html#method__stripComments", "access": "protected", "host": "Config", "type": "method", "name": "_stripComments"}, {"url": "Config.html#method__stripYamlComments", "access": "protected", "host": "Config", "type": "method", "name": "_stripYamlComments"}, {"url": "Config.html#method_watch", "access": "", "host": "Config", "type": "method", "name": "watch"}, {"url": "Config.html#method_watchForConfigFileChanges", "access": "", "host": "Config", "type": "method", "name": "watchForConfigFileChanges"}];
</script>
</body>
</html>
View
@@ -4,11 +4,11 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>test ConfigTest </title>
- <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1320799598.57" />
- <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1320799598.57" />
+ <link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css?stamp=1321484363.39" />
+ <link rel="stylesheet" type="text/css" href="assets/api.css?stamp=1321484363.39" />
- <script type="text/javascript" src="assets/api-js?stamp=1320799598.57"></script>
- <script type="text/javascript" src="assets/ac-js?stamp=1320799598.57"></script>
+ <script type="text/javascript" src="assets/api-js?stamp=1321484363.39"></script>
+ <script type="text/javascript" src="assets/ac-js?stamp=1321484363.39"></script>
</head>
<body id="node-monitor">
@@ -119,7 +119,7 @@
<div id="ft">
<hr />
Released on <a href="https://github.com/lorenwest/node-config">github</a> under the <a href="https://github.com/lorenwest/node-config/blob/master/LICENSE">Apache License 2.0</a>
-<span class="subtitle">version 0.4.4</span>
+<span class="subtitle">version 0.4.5</span>
</div>
</div>
<script type="text/javascript">
Oops, something went wrong.

0 comments on commit ec0e378

Please sign in to comment.