From 3231ac15c9967f04979e4e7444b471ddf3812574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Cruz?= Date: Tue, 23 Apr 2013 23:18:31 +0100 Subject: [PATCH] Guess name from the source in the GitResolver. --- lib/resolve/resolvers/GitResolver.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/resolve/resolvers/GitResolver.js b/lib/resolve/resolvers/GitResolver.js index 9f90ae6e..be5ee65b 100644 --- a/lib/resolve/resolvers/GitResolver.js +++ b/lib/resolve/resolvers/GitResolver.js @@ -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;