Guess name from the source in the GitResolver.

This commit is contained in:
André Cruz
2013-04-23 23:18:31 +01:00
parent 627c75b6b9
commit 3231ac15c9

View File

@@ -10,6 +10,11 @@ var createError = require('../../util/createError');
var GitResolver = function (source, options) {
Resolver.call(this, source, options);
// Guess the name
if (this._guessedName) {
this._name = path.basename(this._source, '.git');
}
};
util.inherits(GitResolver, Resolver);
@@ -138,6 +143,12 @@ GitResolver.prototype._cleanup = function () {
};
GitResolver.prototype._savePkgMeta = function (meta) {
// Ensure that the .version is fulfilled with the resolution
// version if any
// TODO: emit a warning if the json version is different than the resolved one
// also add a test for this stuff
meta.version = this._resolution.version;
// Save resolution to be used in hasNew later
meta._resolution = this._resolution;