Repository: bower/bower (js)

Issue:
Uninstall package via URL
My first time with Bower installing a package from my own repo, I was confused the `uninstall` does not work using the repo URL. Since I am sure it is easy to implement crawling the installed packages to look for the repo URL and run the existing uninstall logic when the package was found, I would like this as a little feature request. This should improve the UX a little bit.

**What happened:**

```
bower install --save git://my.git/user/repo.git
> package#version vendor/bower/package

bower uninstall git://my.git/user/repo.git
> bower not-installed 'git://my.git/user/repo.git'
```

What I expected:

```
bower install --save git://my.git/user/repo.git
> package#version vendor/bower/package

bower uninstall git://my.git/user/repo.git
> bower uninstall 'package'
```


Pull request description:
Fix #2352 - add the functionality of removing with git address
- 1 unit test to see if it works


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c421a6e5..6f8afe3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
 # Changelog
 
+## Unreleased
+
+- Change default shorthand resolver for github from `git://` to `https://`
+- Allow to type the entire version when conflict occured, #2243
+- Allow `owner/reponame` shorthand for registering components, #2248
+- Allow single-char repo names and package names, #2249
+- Make `bower version` no longer honor `version` in bower.json, #2232
+- Add `postinstall` hook, #2252
+- Allow for `@` instead of `#` for `install` and `info` commands, #2322
+- Upgrade all bundled modules
+
 ## 1.7.9 - 2016-04-05
 
 - Show warnings for invalid bower.json fields
@@ -83,7 +94,7 @@ https://github.com/npm/npm/issues/11227
 - Update bower config
   - Loads the .bowerrc file from the cwd specified on the command line
   - Allow the use of environment variables in .bowerrc ([#41](https://github.com/bower/config/issues/41))
-	- Allow for array notation in ENV variables ([#44](https://github.com/bower/config/issues/44))
+  - Allow for array notation in ENV variables ([#44](https://github.com/bower/config/issues/44))
 
 ## 1.6.9 - 2015-12-04
 
diff --git a/lib/core/Project.js b/lib/core/Project.js
index 2c4f3410..62f649b7 100644
--- a/lib/core/Project.js
+++ b/lib/core/Project.js
@@ -213,6 +213,20 @@ Project.prototype.update = function (names, options) {
     });
 };
 
+function resolveUrlNames(names, flattened)
+{
+    for (var i = 0; i < names.length; i++)
+        if (! flattened[names[i]])
+    {
+            var url = names[i].trim().replace(/\/$/, '');
+            var packName;
+            for (packName in flattened)
+                if (! ( !flattened[packName].source))
+                    if (url == flattened[packName].source.trim().replace(/\/$/, ''))
+                        names[i] = packName;
+        }
+}
+
 Project.prototype.uninstall = function (names, options) {
     var that = this;
     var packages = {};
@@ -230,6 +244,7 @@ Project.prototype.uninstall = function (names, options) {
     // Fill in the packages to be uninstalled
     .spread(function (json, tree, flattened) {
         var promise = Q.resolve();
+        resolveUrlNames(names, flattened);
 
         names.forEach(function (name) {
             var decEndpoint = flattened[name];
diff --git a/lib/core/resolvers/GitResolver.js b/lib/core/resolvers/GitResolver.js
index 3c161a3f..9f4917f6 100644
--- a/lib/core/resolvers/GitResolver.js
+++ b/lib/core/resolvers/GitResolver.js
@@ -206,7 +206,7 @@ GitResolver.prototype._savePkgMeta = function (meta) {
         version = semver.clean(this._resolution.tag);
 
         // Warn if the package meta version is different than the resolved one
-        if (typeof meta.version === 'string' && semver.neq(meta.version, version)) {
+        if (typeof meta.version === 'string' && semver.valid(meta.version) && semver.neq(meta.version, version)) {
             this._logger.warn('mismatch', 'Version declared in the json (' + meta.version + ') is different than the resolved one (' + version + ')', {
                 resolution: this._resolution,
                 pkgMeta: meta
diff --git a/lib/core/resolvers/pluginResolverFactory.js b/lib/core/resolvers/pluginResolverFactory.js
index 799203c8..d751d1f5 100644
--- a/lib/core/resolvers/pluginResolverFactory.js
+++ b/lib/core/resolvers/pluginResolverFactory.js
@@ -109,7 +109,7 @@ function pluginResolverFactory(resolverFactory, bower) {
                             throw createError('Resolver did not provide releases of package.');
                         }
 
-                        var releases = this._releases = result;
+                        var releases = that._releases = result;
 
                         var versions = releases.filter(function (target) {
                             return semver.clean(target.version);
diff --git a/lib/util/readJson.js b/lib/util/readJson.js
index 370cb8a1..09fc38fb 100644
--- a/lib/util/readJson.js
+++ b/lib/util/readJson.js
@@ -19,7 +19,9 @@ function readJson(file, options) {
 
         if (options.logger) {
             var issues = bowerJson.getIssues(json);
-
+            if (issues.warnings.length > 0){
+                options.logger.warn('invalid-meta', 'for:' + jsonFile);
+            }
             issues.warnings.forEach(function (warning) {
                 options.logger.warn('invalid-meta', warning);
             });
diff --git a/package.json b/package.json
index b1331c86..0fda14cc 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
   "dependencies": {
     "abbrev": "^1.0.5",
     "archy": "1.0.0",
-    "bower-config": "^1.3.1",
+    "bower-config": "^1.4.0",
     "bower-endpoint-parser": "^0.2.2",
     "bower-json": "^0.8.1",
     "bower-logger": "^0.2.2",
diff --git a/packages/bower-config/package.json b/packages/bower-config/package.json
index cc1f3f91..feac4880 100644
--- a/packages/bower-config/package.json
+++ b/packages/bower-config/package.json
@@ -4,7 +4,7 @@
   "description": "The Bower config reader and writer.",
   "author": "Twitter",
   "license": "MIT",
-  "repository": "bower/config",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-config",
   "main": "lib/Config",
   "homepage": "http://bower.io",
   "engines": {
diff --git a/packages/bower-endpoint-parser/package.json b/packages/bower-endpoint-parser/package.json
index aa726064..145e25c5 100644
--- a/packages/bower-endpoint-parser/package.json
+++ b/packages/bower-endpoint-parser/package.json
@@ -9,10 +9,7 @@
       "url": "https://github.com/bower/endpoint-parser/blob/master/LICENSE"
     }
   ],
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/bower/endpoint-parser.git"
-  },
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-endpoint-parser",
   "main": "index.js",
   "engines": {
     "node": ">=0.8.0"
diff --git a/packages/bower-json/package.json b/packages/bower-json/package.json
index a145b194..e6187cbb 100644
--- a/packages/bower-json/package.json
+++ b/packages/bower-json/package.json
@@ -4,7 +4,7 @@
   "description": "Read bower.json files with semantics, normalisation, defaults and validation",
   "author": "Twitter",
   "license": "MIT",
-  "repository": "bower/json",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-json",
   "main": "lib/json",
   "engines": {
     "node": ">=0.10.0"
diff --git a/packages/bower-logger/package.json b/packages/bower-logger/package.json
index a3c78190..26eed872 100644
--- a/packages/bower-logger/package.json
+++ b/packages/bower-logger/package.json
@@ -9,7 +9,7 @@
       "url": "https://github.com/bower/logger/blob/master/LICENSE"
     }
   ],
-  "repository": "bower/logger",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-logger",
   "main": "lib/Logger",
   "engines": {
     "node": ">=0.10.0"
diff --git a/packages/bower-registry-client/package.json b/packages/bower-registry-client/package.json
index e7eb5658..74c206fa 100644
--- a/packages/bower-registry-client/package.json
+++ b/packages/bower-registry-client/package.json
@@ -4,7 +4,7 @@
   "description": "Provides easy interaction with the Bower registry",
   "author": "Twitter",
   "license": "MIT",
-  "repository": "bower/registry-client",
+  "repository": "https://github.com/bower/bower/tree/master/packages/bower-registry-client",
   "main": "Client",
   "engines": {
     "node": ">=0.10.0"


Test patch:
diff --git a/test/commands/uninstall.js b/test/commands/uninstall.js
index 5e02b7e0..db3ecbb5 100644
--- a/test/commands/uninstall.js
+++ b/test/commands/uninstall.js
@@ -99,4 +99,21 @@ describe('bower uninstall', function () {
         });
     });
 
+    it('removes a project with url from absolute path', function () {
+        var targetPath = path.resolve(tempDir.path, 'other_directory/underscore');
+        mkdirp.sync(targetPath);
+        fs.writeFileSync(path.join(targetPath, '.bower.json'), '{ "name": "underscore", "_source": "git://github.com/user/repo.git" }');
+
+        return helpers.run(uninstall, [['git://github.com/user/repo.git'], undefined, {
+            cwd: tempDir.path,
+            directory: path.resolve(tempDir.path, 'other_directory'),
+            interactive: true
+        }])
+            .then(function () {
+                expect(function () {
+                    fs.statSync(targetPath);
+                }).to.throwException(/no such file or directory/);
+            });
+    });
+
 });