From 5c819b72c988cf7c393aa0622fd614035eaf5226 Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Thu, 11 Feb 2016 14:22:12 +0100 Subject: [PATCH 01/24] 5.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d01ac30..c800108 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Morten Siebuhr ", "name": "oconf", "description": "Configuration", - "version": "5.0.0", + "version": "5.1.0", "repository": { "type": "git", "url": "https://github.com/One-com/node-oconf.git" From f6048e8d81d5162b58e5b525f9a33cb26733f890 Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Thu, 11 Feb 2016 15:49:10 +0100 Subject: [PATCH 02/24] Added some failing tests, seems like I didn't cover all the combinations of #public blocks and #public-suffixed keys. --- test/lib/index.spec.js | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/lib/index.spec.js b/test/lib/index.spec.js index 4395a6a..e725893 100644 --- a/test/lib/index.spec.js +++ b/test/lib/index.spec.js @@ -438,5 +438,67 @@ describe('#public behaviour', function () { } }, 'to result in error', new Error('foo#public clashes with foo inside #public block')); }); + + it.skip('should allow overwriting a key inside a #public block with a #public-suffixed key of the same name', function () { + return expect(function () { + expect(oconf.load('/testdata/config.cjson'), 'to equal', { + foo: { + abc: 123 + }, + '#public': { + foo: { + abc: 123 + } + } + }); + }, 'with fs mocked out', { + '/testdata': { + 'config.cjson': JSON.stringify({ + '#include': '/testdata/included.cjson', + foo: { + 'abc#public': 123 + } + }), + 'included.cjson': JSON.stringify({ + foo: { + '#public': { + abc: 456 + } + } + }) + } + }, 'not to error'); + }); + + it.skip('should allow overwriting a #public-suffixed key with a key of the same name inside a #public block', function () { + return expect(function () { + expect(oconf.load('/testdata/config.cjson'), 'to equal', { + foo: { + abc: 123 + }, + '#public': { + foo: { + abc: 123 + } + } + }); + }, 'with fs mocked out', { + '/testdata': { + 'config.cjson': JSON.stringify({ + '#include': '/testdata/included.cjson', + foo: { + '#public': { + abc: 123 + } + } + }), + 'included.cjson': JSON.stringify({ + foo: { + 'abc#public': 456 + } + }) + } + }, 'not to error'); + }); }); }); From 300b6967a3d84c2f8aae446a31d7bd00a1f53119 Mon Sep 17 00:00:00 2001 From: Maarten Winter Date: Tue, 16 Feb 2016 11:51:22 +0100 Subject: [PATCH 03/24] Output the culprit when an unsupported combination of public and non-public properties is used --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 7060a13..e57ec73 100644 --- a/lib/index.js +++ b/lib/index.js @@ -71,7 +71,7 @@ module.exports.load = function load(rootFileName, options) { Object.keys(obj['#public']).forEach(function (key) { if (key in obj) { - throw new Error('Unsupported combination of public and non-public properties, check your tree structure'); + throw new Error('Unsupported combination of public and non-public properties for key "' + key + '", check your tree structure: ' + JSON.stringify(obj)); } if (obj['#public'][key] !== 'undefined') { From a3fedc8f29c1929e8008bb950589ca466422172e Mon Sep 17 00:00:00 2001 From: Maarten Winter Date: Tue, 16 Feb 2016 11:51:45 +0100 Subject: [PATCH 04/24] 5.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c800108..df42155 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Morten Siebuhr ", "name": "oconf", "description": "Configuration", - "version": "5.1.0", + "version": "5.1.1", "repository": { "type": "git", "url": "https://github.com/One-com/node-oconf.git" From 64c40f5bdbeb2b7c21cc352d95298a14a5603a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20Birkestr=C3=B8m?= Date: Mon, 20 Jun 2016 17:25:48 +0200 Subject: [PATCH 05/24] Remove deprecated util.puts --- bin/oconf | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/oconf b/bin/oconf index 1850979..57e1ec2 100755 --- a/bin/oconf +++ b/bin/oconf @@ -1,7 +1,5 @@ #!/usr/bin/env node - var oconf = require('../lib/index'); -var util = require('util'); var argp = require('optimist') .usage('Usage: $0 [--lint|--extract-option