diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-07-23 05:43:49 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-07-23 05:43:49 +0400 |
commit | 2e768216de226a6be211acc8a489adaba2f5916e (patch) | |
tree | d18213ac9e180f81d2854bee2db80e1287ff3d2f | |
parent | cd422c9de510766797c65720d70f085000f50543 (diff) |
github-url-from-git@1.2.0
-rw-r--r-- | node_modules/github-url-from-git/LICENSE | 22 | ||||
-rw-r--r-- | node_modules/github-url-from-git/Readme.md | 26 | ||||
-rw-r--r-- | node_modules/github-url-from-git/index.js | 28 | ||||
-rw-r--r-- | node_modules/github-url-from-git/package.json | 44 | ||||
-rw-r--r-- | node_modules/github-url-from-git/test.js | 27 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore | 1 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/History.md (renamed from node_modules/github-url-from-git/History.md) | 0 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile | 5 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md | 41 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/index.js | 12 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/package.json | 43 | ||||
-rw-r--r-- | node_modules/normalize-package-data/node_modules/github-url-from-git/test.js | 40 | ||||
-rw-r--r-- | package.json | 2 |
13 files changed, 276 insertions, 15 deletions
diff --git a/node_modules/github-url-from-git/LICENSE b/node_modules/github-url-from-git/LICENSE new file mode 100644 index 000000000..b7409302c --- /dev/null +++ b/node_modules/github-url-from-git/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/github-url-from-git/Readme.md b/node_modules/github-url-from-git/Readme.md index d027e8ec6..27e7f7d74 100644 --- a/node_modules/github-url-from-git/Readme.md +++ b/node_modules/github-url-from-git/Readme.md @@ -28,6 +28,8 @@ describe('parse(url)', function(){ assert(null == parse(url)); }) + // gist urls. + it('should parse git@gist urls', function() { var url = 'git@gist.github.com:3135914.git'; parse(url).should.equal('https://gist.github.com/3135914') @@ -37,5 +39,29 @@ describe('parse(url)', function(){ var url = 'https://gist.github.com/3135914.git'; parse(url).should.equal('https://gist.github.com/3135914') }) + + // Handle arbitrary GitHub Enterprise domains. + + it('should parse parse extra GHE urls provided', function() { + var url = 'git://github.example.com/treygriffith/cellar.git'; + parse( + url, {extraBaseUrls: ['github.example.com']} + ).should.equal('https://github.example.com/treygriffith/cellar'); + }); + + it('should parse GHE urls with multiple subdomains', function() { + var url = 'git://github.internal.example.com/treygriffith/cellar.git'; + parse( + url, {extraBaseUrls: ['github.internal.example.com']} + ).should.equal('https://github.internal.example.com/treygriffith/cellar'); + }); +}) + +describe('re', function() { + it('should expose GitHub url parsing regex', function() { + parse.re.source.should.equal( + /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source + ) + }); }) ``` diff --git a/node_modules/github-url-from-git/index.js b/node_modules/github-url-from-git/index.js index 9ccc215f0..45cee530d 100644 --- a/node_modules/github-url-from-git/index.js +++ b/node_modules/github-url-from-git/index.js @@ -1,8 +1,9 @@ -var re = /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/ - -module.exports = function(url){ +// convert git:// form url to github URL, e.g., +// git://github.com/bcoe/foo.git +// https://github.com/bcoe/foo. +function githubUrlFromGit(url, opts){ try { - var m = re.exec(url.replace(/\.git$/, '')); + var m = re(opts).exec(url.replace(/\.git$/, '')); var host = m[1]; var path = m[2]; return 'https://' + host + '/' + path; @@ -10,3 +11,22 @@ module.exports = function(url){ // ignore } }; + +// generate the git:// parsing regex +// with options, e.g., the ability +// to specify multiple GHE domains. +function re(opts) { + opts = opts || {}; + // whitelist of URLs that should be treated as GitHub repos. + var baseUrls = ['gist.github.com', 'github.com'].concat(opts.extraBaseUrls || []); + // build regex from whitelist. + return new RegExp( + /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?/.source + + '(' + baseUrls.join('|') + ')' + + /[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source + ); +} + +githubUrlFromGit.re = re(); + +module.exports = githubUrlFromGit; diff --git a/node_modules/github-url-from-git/package.json b/node_modules/github-url-from-git/package.json index 5673fb989..84135ea9e 100644 --- a/node_modules/github-url-from-git/package.json +++ b/node_modules/github-url-from-git/package.json @@ -1,31 +1,57 @@ { "name": "github-url-from-git", - "version": "1.1.1", + "version": "1.2.0", "description": "Parse a github git url and return the github repo url", "main": "index.js", "scripts": { "test": "mocha test.js --reporter spec --require should" }, - "repository": "", + "repository": { + "type": "git", + "url": "http://github.com/visionmedia/node-github-url-from-git" + }, "keywords": [ "github", "git", "url", "parser" ], - "author": "", + "author": { + "name": "TJ Holowaychuk" + }, "license": "MIT", "devDependencies": { "better-assert": "~1.0.0", "mocha": "~1.9.0", "should": "~1.2.2" }, - "readme": "\n# github-url-from-git\n\n```js\ndescribe('parse(url)', function(){\n it('should support git://*', function(){\n var url = 'git://github.com/jamesor/mongoose-versioner';\n parse(url).should.equal('https://github.com/jamesor/mongoose-versioner');\n })\n\n it('should support git://*.git', function(){\n var url = 'git://github.com/treygriffith/cellar.git';\n parse(url).should.equal('https://github.com/treygriffith/cellar');\n })\n\n it('should support https://*', function(){\n var url = 'https://github.com/Empeeric/i18n-node';\n parse(url).should.equal('https://github.com/Empeeric/i18n-node');\n })\n\n it('should support https://*.git', function(){\n var url = 'https://jpillora@github.com/banchee/tranquil.git';\n parse(url).should.equal('https://github.com/banchee/tranquil');\n })\n\n it('should return undefined on failure', function(){\n var url = 'git://github.com/justgord/.git';\n assert(null == parse(url));\n })\n\n it('should parse git@gist urls', function() {\n var url = 'git@gist.github.com:3135914.git';\n parse(url).should.equal('https://gist.github.com/3135914')\n })\n\n it('should parse https://gist urls', function() {\n var url = 'https://gist.github.com/3135914.git';\n parse(url).should.equal('https://gist.github.com/3135914')\n })\n})\n```\n", - "readmeFilename": "Readme.md", - "_id": "github-url-from-git@1.1.1", + "gitHead": "9df854a2060868c374c32a6be4c10e12e5b41152", + "bugs": { + "url": "https://github.com/visionmedia/node-github-url-from-git/issues" + }, + "homepage": "https://github.com/visionmedia/node-github-url-from-git", + "_id": "github-url-from-git@1.2.0", + "_shasum": "7ace1fc6920f790d2967faed61688902320c37d2", + "_from": "github-url-from-git@1.2.0", + "_npmVersion": "1.5.0-alpha-1", + "_npmUser": { + "name": "bcoe", + "email": "bencoe@gmail.com" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "bcoe", + "email": "bencoe@gmail.com" + } + ], "dist": { - "shasum": "a14903bccbd30c91ea41765ae68ba1b27a53c4d1" + "shasum": "7ace1fc6920f790d2967faed61688902320c37d2", + "tarball": "http://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.2.0.tgz" }, - "_from": "github-url-from-git@1.1.1", - "_resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.1.1.tgz" + "directories": {}, + "_resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.2.0.tgz" } diff --git a/node_modules/github-url-from-git/test.js b/node_modules/github-url-from-git/test.js index e472302a0..79c911ba1 100644 --- a/node_modules/github-url-from-git/test.js +++ b/node_modules/github-url-from-git/test.js @@ -1,4 +1,3 @@ - var parse = require('./'); var assert = require('better-assert'); @@ -28,6 +27,8 @@ describe('parse(url)', function(){ assert(null == parse(url)); }) + // gist urls. + it('should parse git@gist urls', function() { var url = 'git@gist.github.com:3135914.git'; parse(url).should.equal('https://gist.github.com/3135914') @@ -37,4 +38,28 @@ describe('parse(url)', function(){ var url = 'https://gist.github.com/3135914.git'; parse(url).should.equal('https://gist.github.com/3135914') }) + + // Handle arbitrary GitHub Enterprise domains. + + it('should parse parse extra GHE urls provided', function() { + var url = 'git://github.example.com/treygriffith/cellar.git'; + parse( + url, {extraBaseUrls: ['github.example.com']} + ).should.equal('https://github.example.com/treygriffith/cellar'); + }); + + it('should parse GHE urls with multiple subdomains', function() { + var url = 'git://github.internal.example.com/treygriffith/cellar.git'; + parse( + url, {extraBaseUrls: ['github.internal.example.com']} + ).should.equal('https://github.internal.example.com/treygriffith/cellar'); + }); +}) + +describe('re', function() { + it('should expose GitHub url parsing regex', function() { + parse.re.source.should.equal( + /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source + ) + }); }) diff --git a/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore b/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/github-url-from-git/History.md b/node_modules/normalize-package-data/node_modules/github-url-from-git/History.md index fcb296bc6..fcb296bc6 100644 --- a/node_modules/github-url-from-git/History.md +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/History.md diff --git a/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile b/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile new file mode 100644 index 000000000..37f330e81 --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/Makefile @@ -0,0 +1,5 @@ + +test: + @./node_modules/.bin/mocha test.js --reporter spec --require should + +.PHONY: test diff --git a/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md b/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md new file mode 100644 index 000000000..d027e8ec6 --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/Readme.md @@ -0,0 +1,41 @@ + +# github-url-from-git + +```js +describe('parse(url)', function(){ + it('should support git://*', function(){ + var url = 'git://github.com/jamesor/mongoose-versioner'; + parse(url).should.equal('https://github.com/jamesor/mongoose-versioner'); + }) + + it('should support git://*.git', function(){ + var url = 'git://github.com/treygriffith/cellar.git'; + parse(url).should.equal('https://github.com/treygriffith/cellar'); + }) + + it('should support https://*', function(){ + var url = 'https://github.com/Empeeric/i18n-node'; + parse(url).should.equal('https://github.com/Empeeric/i18n-node'); + }) + + it('should support https://*.git', function(){ + var url = 'https://jpillora@github.com/banchee/tranquil.git'; + parse(url).should.equal('https://github.com/banchee/tranquil'); + }) + + it('should return undefined on failure', function(){ + var url = 'git://github.com/justgord/.git'; + assert(null == parse(url)); + }) + + it('should parse git@gist urls', function() { + var url = 'git@gist.github.com:3135914.git'; + parse(url).should.equal('https://gist.github.com/3135914') + }) + + it('should parse https://gist urls', function() { + var url = 'https://gist.github.com/3135914.git'; + parse(url).should.equal('https://gist.github.com/3135914') + }) +}) +``` diff --git a/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js b/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js new file mode 100644 index 000000000..9ccc215f0 --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/index.js @@ -0,0 +1,12 @@ +var re = /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/ + +module.exports = function(url){ + try { + var m = re.exec(url.replace(/\.git$/, '')); + var host = m[1]; + var path = m[2]; + return 'https://' + host + '/' + path; + } catch (err) { + // ignore + } +}; diff --git a/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json b/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json new file mode 100644 index 000000000..593508212 --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/package.json @@ -0,0 +1,43 @@ +{ + "name": "github-url-from-git", + "version": "1.1.1", + "description": "Parse a github git url and return the github repo url", + "main": "index.js", + "scripts": { + "test": "mocha test.js --reporter spec --require should" + }, + "repository": "", + "keywords": [ + "github", + "git", + "url", + "parser" + ], + "author": "", + "license": "MIT", + "devDependencies": { + "better-assert": "~1.0.0", + "mocha": "~1.9.0", + "should": "~1.2.2" + }, + "_id": "github-url-from-git@1.1.1", + "dist": { + "shasum": "1f89623453123ef9623956e264c60bf4c3cf5ccf", + "tarball": "http://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.1.1.tgz" + }, + "_from": "github-url-from-git@>=1.1.1-0 <1.2.0-0", + "_npmVersion": "1.2.14", + "_npmUser": { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + } + ], + "directories": {}, + "_shasum": "1f89623453123ef9623956e264c60bf4c3cf5ccf", + "_resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.1.1.tgz" +} diff --git a/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js b/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js new file mode 100644 index 000000000..e472302a0 --- /dev/null +++ b/node_modules/normalize-package-data/node_modules/github-url-from-git/test.js @@ -0,0 +1,40 @@ + +var parse = require('./'); +var assert = require('better-assert'); + +describe('parse(url)', function(){ + it('should support git://*', function(){ + var url = 'git://github.com/jamesor/mongoose-versioner'; + parse(url).should.equal('https://github.com/jamesor/mongoose-versioner'); + }) + + it('should support git://*.git', function(){ + var url = 'git://github.com/treygriffith/cellar.git'; + parse(url).should.equal('https://github.com/treygriffith/cellar'); + }) + + it('should support https://*', function(){ + var url = 'https://github.com/Empeeric/i18n-node'; + parse(url).should.equal('https://github.com/Empeeric/i18n-node'); + }) + + it('should support https://*.git', function(){ + var url = 'https://jpillora@github.com/banchee/tranquil.git'; + parse(url).should.equal('https://github.com/banchee/tranquil'); + }) + + it('should return undefined on failure', function(){ + var url = 'git://github.com/justgord/.git'; + assert(null == parse(url)); + }) + + it('should parse git@gist urls', function() { + var url = 'git@gist.github.com:3135914.git'; + parse(url).should.equal('https://gist.github.com/3135914') + }) + + it('should parse https://gist urls', function() { + var url = 'https://gist.github.com/3135914.git'; + parse(url).should.equal('https://gist.github.com/3135914') + }) +}) diff --git a/package.json b/package.json index 4f29bf763..6625144d2 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "fs-vacuum": "~1.2.1", "fstream": "~0.1.29", "fstream-npm": "~0.1.7", - "github-url-from-git": "1.1.1", + "github-url-from-git": "~1.2.0", "github-url-from-username-repo": "~0.2.0", "glob": "~4.0.3", "graceful-fs": "~3.0.0", |