mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
If cwd provided explicitly, force using it, fixes #1866
This commit is contained in:
@@ -13,6 +13,12 @@ var createError = require('../util/createError');
|
||||
function init(logger, config) {
|
||||
var project;
|
||||
|
||||
config = config || {};
|
||||
|
||||
if (!config.cwd) {
|
||||
config.cwd = process.cwd();
|
||||
}
|
||||
|
||||
config = defaultConfig(config);
|
||||
|
||||
// This command requires interactive to be enabled
|
||||
|
||||
@@ -10,9 +10,9 @@ var cachedConfigs = {};
|
||||
function defaultConfig(config) {
|
||||
config = config || {};
|
||||
|
||||
var cwd = path.dirname(findup('bower.json', {
|
||||
cwd: config.cwd || process.cwd()
|
||||
})) || config.cwd || process.cwd();
|
||||
var cwd = config.cwd || path.dirname(findup('bower.json', {
|
||||
cwd: process.cwd()
|
||||
})) || process.cwd();
|
||||
|
||||
config.cwd = cwd;
|
||||
|
||||
|
||||
@@ -93,4 +93,4 @@ module.exports = {
|
||||
postinstall: mout.function.partial(hook, 'postinstall', true),
|
||||
//only exposed for test
|
||||
_orderByDependencies: orderByDependencies
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
var path = require('path');
|
||||
var expect = require('expect.js');
|
||||
var helpers = require('../helpers');
|
||||
|
||||
@@ -147,7 +148,9 @@ describe('bower install', function () {
|
||||
}
|
||||
});
|
||||
|
||||
return helpers.run(install, [undefined, undefined, { cwd: tempDir.path + '/foo/bar' }]).then(function() {
|
||||
process.chdir(path.join(tempDir.path, '/foo/bar'));
|
||||
|
||||
return helpers.run(install).then(function() {
|
||||
expect(tempDir.read('assets/package/foo')).to.be('bar');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user