mirror of
https://github.com/bower/bower.git
synced 2026-02-12 06:55:04 -05:00
Complete some more tests related with the base resolver.
This commit is contained in:
@@ -12,6 +12,8 @@ var glob = require('glob');
|
||||
var config = require('../config');
|
||||
var createError = require('../util/createError');
|
||||
|
||||
tmp.setGracefulCleanup();
|
||||
|
||||
var Resolver = function (source, options) {
|
||||
options = options || {};
|
||||
|
||||
@@ -95,8 +97,8 @@ Resolver.prototype._createTempDir = function () {
|
||||
.then(function () {
|
||||
return Q.nfcall(tmp.dir, {
|
||||
template: path.join(baseDir, this._name + '-XXXXXX'),
|
||||
mode: parseInt('0777', 8) & (~process.umask())
|
||||
//unsafeCleanup: true // TODO: don't forget enable this
|
||||
mode: parseInt('0777', 8) & ~process.umask(),
|
||||
unsafeCleanup: true
|
||||
});
|
||||
}.bind(this))
|
||||
.then(function (dir) {
|
||||
@@ -116,7 +118,7 @@ Resolver.prototype._readJson = function (dir) {
|
||||
// Read it
|
||||
return Q.nfcall(bowerJson.read, filename)
|
||||
.then(null, function (err) {
|
||||
throw createError('Something went wrong when reading "' + filename + '"', err.code, {
|
||||
throw createError('Something went wrong while reading "' + filename + '"', err.code, {
|
||||
details: err.message
|
||||
});
|
||||
});
|
||||
@@ -128,11 +130,12 @@ Resolver.prototype._readJson = function (dir) {
|
||||
|
||||
Resolver.prototype._applyPkgMeta = function (meta) {
|
||||
// Check if name defined in the json is different
|
||||
// If so and if the name was "guessed", assume the json name
|
||||
if (meta.name !== this._name) {
|
||||
// If so and if the name was "guessed", assume the json name
|
||||
if (this._guessedName) {
|
||||
this._name = meta.name;
|
||||
this.emit('name_change', this._name);
|
||||
// Otherwise use/force the configured one
|
||||
} else {
|
||||
meta.name = this._name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user