Skip to content

Commit

Permalink
v2.1.0 (#19)
Browse files Browse the repository at this point in the history
* v2.1.0
  • Loading branch information
kimung authored Jan 1, 2018
1 parent 029c1c5 commit 8737a57
Show file tree
Hide file tree
Showing 19 changed files with 1,194 additions and 65 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 2.1.0 - 2018-01-01
### Added
- path resolve
- yaml load
### Changed
- refactoring
- update copyright

## 2.0.2 - 2017-12-22
### Added
- tests
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Kim UNG
Copyright (c) 2016 - 2018 RDUK <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2017 RDUK <[email protected]>
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -40,4 +40,4 @@ module.exports = function(env) {

module.exports.load = function() {
return module.exports(process.env.NODE_ENV);
};
};
8 changes: 4 additions & 4 deletions lib/manager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2017 RDUK <[email protected]>
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,7 +27,7 @@
const fs = require('fs');
const extend = require('extend');
const errors = require('@rduk/errors');
const loadYaml = require('./utils/loadYaml');
const yaml = require('./sections/field/yaml');

const DEFAULT_PKG_CONFIG = {
rduk: {
Expand Down Expand Up @@ -77,11 +77,11 @@ ConfigurationManager.prototype.init = function(env) {
let configFileName = path + config.prefix + '.' + env + config.ext;

if (fs.existsSync(defaultConfigFileName)) {
document = loadYaml(defaultConfigFileName);
document = yaml.load(defaultConfigFileName);
}

if(defaultConfigFileName !== configFileName && fs.existsSync(configFileName)) {
document = extend(true, document || {}, loadYaml(configFileName));
document = extend(true, document || {}, yaml.load(configFileName));
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/sections/connections.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2017 RDUK <[email protected]>
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
45 changes: 45 additions & 0 deletions lib/sections/field/path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

'use strict';

var errors = require('@rduk/errors');

module.exports = {
resolve: function(path) {
if (!path || typeof path !== 'string') {
errors.throwArgumentError('path', path);
}

if (/^\w/.test(path)) {
path = '~/' + path;
}

if (path[0] === '~' && path[1] === '/') {
path = process.env.PWD + path.substring(1);
}

return path;
}
};
15 changes: 4 additions & 11 deletions lib/sections/field/type.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2017 RDUK <[email protected]>
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,17 +25,10 @@
'use strict';

var errors = require('@rduk/errors');
var path = require('./path');

module.exports = {
load: function(path) {
if (!path || typeof path !== 'string') {
errors.throwArgumentError('path', path);
}

if (path[0] === '~' && path[1] === '/') {
path = process.env.PWD + path.substring(1);
}

return require(path);
load: function(filepath) {
return require(path.resolve(filepath));
}
};
35 changes: 35 additions & 0 deletions lib/sections/field/yaml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

'use strict';

var errors = require('@rduk/errors');
var path = require('./path');
var loadYaml = require('../../utils/loadYaml');

module.exports = {
load: function(filepath) {
return loadYaml(path.resolve(filepath));
}
};
2 changes: 1 addition & 1 deletion lib/sections/settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2017 RDUK <[email protected]>
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/loadYaml.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MIT License
*
* Copyright (c) 2016 - 2017 RDUK <[email protected]>
* Copyright (c) 2016 - 2018 RDUK <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 8737a57

Please sign in to comment.