Skip to content

Commit

Permalink
release 0.6.6
Browse files Browse the repository at this point in the history
fix YOG_ENV prefer conf issue
  • Loading branch information
hefangshi committed Mar 17, 2016
1 parent db5648d commit 56b70d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function readdirWithEnvSync(path, prefer) {
function getPreferFile() {
// check if prefer file is exist
if (prefer) {
var preferFile = dirname + p.sep + confname + '.' + prefer + ext;
var preferFile = dirname + p.sep + confname + prefer + ext;
if (fs.existsSync(preferFile)) {
return preferFile;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yog2-kernel",
"version": "0.6.5",
"version": "0.6.6",
"description": "yog2 kernel",
"main": "index.js",
"keywords": [
Expand Down
13 changes: 13 additions & 0 deletions test/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ describe('loader.loadFolder', function () {
result.c.dev.should.be.false;
});

it('should load prefer file 2', function () {
var result = loader.loadFolder(__dirname + '/loader/dev', '.prod');
result.should.have.property('a');
result.should.not.have.property('b');
result.should.have.property('c');
result.should.have.property('d');
result.should.have.property('f');
result.a.dev.should.be.false;
result.c.dev.should.be.false;
result.d.default.should.be.true;
result.f.prod.should.be.true;
});

it('should not load unmatched subfixed file', function () {
var result = loader.loadFolder(__dirname + '/loader/dev', '');
result.should.have.property('a');
Expand Down
11 changes: 11 additions & 0 deletions test/loader/dev/f.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* fis
* http://fis.baidu.com/
* 2015/1/19
*/

'use strict';

module.exports.f = {
'prod': true
};

0 comments on commit 56b70d7

Please sign in to comment.