Skip to content

Commit

Permalink
feat(directories): Support target directories in normal mode
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg committed Jun 14, 2016
1 parent dfd8ec5 commit e3bf811
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/get_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ var _ = require('lodash');
var script = fs.readFileSync(path.join(__dirname, '_get_config.js')).toString();

function getConfig(leftPath, rightPath) {
var leftDir = path.dirname(path.resolve(leftPath));
var rightDir = path.dirname(path.resolve(rightPath));
var leftDir = path.resolve(leftPath);
var rightDir = path.resolve(rightPath);

var left = getConfigForDir(leftDir);
var right = getConfigForDir(rightDir);
Expand All @@ -24,7 +24,9 @@ function getConfig(leftPath, rightPath) {
};
}

function getConfigForDir(dir) {
function getConfigForDir(startPath) {
var stat = fs.statSync(startPath);
var dir = stat.isDirectory() ? startPath : path.dirname(startPath);
var filename = '__get_config.js';
var target = path.join(dir, filename);

Expand Down
4 changes: 2 additions & 2 deletions test/integration/test_get_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var getConfig = require('src/get_config');

describe('integration/getConfig', function() {
it('loads two config files', function() {
var left = 'test/integration/left/index.js';
var right = 'test/integration/right/index.js';
var left = 'test/integration/left';
var right = 'test/integration/right';

var actual = getConfig(left, right);

Expand Down

0 comments on commit e3bf811

Please sign in to comment.