Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2015-04-07 09:34:55 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-04-09 07:38:41 +0300
commit23a1d5a540e8db27f5cd0245de7c3694e2bddad1 (patch)
treea9457cc296836678584a89a31626bee74ee22e05 /node_modules/hosted-git-info
parent20e90031b847e9f7c7168f3dad8b1e526f9a2586 (diff)
hosted-git-info@2.0.2
Diffstat (limited to 'node_modules/hosted-git-info')
-rw-r--r--node_modules/hosted-git-info/README.md19
-rw-r--r--node_modules/hosted-git-info/README.md~23
-rw-r--r--node_modules/hosted-git-info/index.js225
-rw-r--r--node_modules/hosted-git-info/package.json24
-rw-r--r--node_modules/hosted-git-info/test/basic.js20
-rw-r--r--node_modules/hosted-git-info/test/bitbucket.js31
-rw-r--r--node_modules/hosted-git-info/test/gist.js54
-rw-r--r--node_modules/hosted-git-info/test/github.js56
-rw-r--r--node_modules/hosted-git-info/test/gitlab.js32
-rw-r--r--node_modules/hosted-git-info/test/lib/standard-tests.js43
10 files changed, 285 insertions, 242 deletions
diff --git a/node_modules/hosted-git-info/README.md b/node_modules/hosted-git-info/README.md
index ebf40a2ab..55b5dbcbb 100644
--- a/node_modules/hosted-git-info/README.md
+++ b/node_modules/hosted-git-info/README.md
@@ -61,7 +61,7 @@ eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
* info.https()
-eg, `https://github.com/npm/hosted-git-info.git`
+eg, `git+https://github.com/npm/hosted-git-info.git`
* info.sshurl()
@@ -75,6 +75,23 @@ eg, `git@github.com:npm/hosted-git-info.git`
eg, `npm/hosted-git-info`
+* info.getDefaultRepresentation()
+
+Returns the default output type. The default output type is based on the
+string you passed in to be parsed
+
+* info.toString()
+
+Uses the getDefaultRepresentation to call one of the other methods to get a URL for
+this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
+you a normalized version of the URL that still uses the same protocol.
+
+Shortcuts will still be returned as shortcuts, but the special case github
+form of `org/project` will be normalized to `github:org/project`.
+
+SSH connect strings will be normalized into `git+ssh` URLs.
+
+
## Supported hosts
Currently this supports Github, Bitbucket and Gitlab. Pull requests for
diff --git a/node_modules/hosted-git-info/README.md~ b/node_modules/hosted-git-info/README.md~
index f6f1dcf9e..82ddf605d 100644
--- a/node_modules/hosted-git-info/README.md~
+++ b/node_modules/hosted-git-info/README.md~
@@ -40,13 +40,7 @@ Given the path of a file relative to the repository, returns a URL for
directly fetching it from the githost. If no comittish was set then
`master` will be used as the default.
-<<<<<<< HEAD
For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
-||||||| merged common ancestors
-For example `hostedGitInfo("git@github.com:npm/hosted-git-info.git").file("v1.0.0")`
-=======
-For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git").file("v1.0.0")`
->>>>>>> Another README fix
would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
* info.shortcut()
@@ -81,6 +75,23 @@ eg, `git@github.com:npm/hosted-git-info.git`
eg, `npm/hosted-git-info`
+* info.getDefaultRepresentation()
+
+Returns the default output type. The default output type is based on the
+string you passed in to be parsed
+
+* info.toString()
+
+Uses the getDefaultRepresentation to call one of the other methods to get a URL for
+this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
+you a normalized version of the URL that still uses the same protocol.
+
+Shortcuts will still be returned as shortcuts, but the special case github
+form of `org/project` will be normalized to `github:org/project`.
+
+SSH connect strings will be normalized into `git+ssh` URLs.
+
+
## Supported hosts
Currently this supports Github, Bitbucket and Gitlab. Pull requests for
diff --git a/node_modules/hosted-git-info/index.js b/node_modules/hosted-git-info/index.js
index c2ad10a3b..f15af725c 100644
--- a/node_modules/hosted-git-info/index.js
+++ b/node_modules/hosted-git-info/index.js
@@ -1,49 +1,58 @@
-"use strict"
-var url = require("url")
-
-var GitHost = exports = module.exports = function (type, user, project, comittish) {
- this.type = type
- this.domain = gitHosts[type].domain
- this.filetemplate = gitHosts[type].filetemplate
- this.sshtemplate = gitHosts[type].sshtemplate
- this.sshurltemplate = gitHosts[type].sshurltemplate
- this.browsetemplate = gitHosts[type].browsetemplate
- this.docstemplate = gitHosts[type].docstemplate
- this.bugstemplate = gitHosts[type].bugstemplate
- this.gittemplate = gitHosts[type].gittemplate
- this.httpstemplate = gitHosts[type].httpstemplate
- this.treepath = gitHosts[type].treepath
- this.user = user
- this.project = project
- this.comittish = comittish
+'use strict'
+var url = require('url')
+
+var GitHost = exports = module.exports = function (type, user, project, comittish, defaultType) {
+ var gitHostInfo = this
+ gitHostInfo.type = type
+ Object.keys(gitHosts[type]).forEach(function (key) {
+ gitHostInfo[key] = gitHosts[type][key]
+ })
+ gitHostInfo.user = user
+ gitHostInfo.project = project
+ gitHostInfo.comittish = comittish
+ gitHostInfo.default = defaultType
}
GitHost.prototype = {}
+var protocolMap = {
+ 'git+ssh': 'sshurl',
+ 'git+https': 'https',
+ 'ssh': 'sshurl',
+ 'git': 'git'
+}
+
+function protocolToType (protocol) {
+ if (protocol.substr(-1) === ':') protocol = protocol.slice(0, -1)
+ return protocolMap[protocol] || protocol
+}
+
exports.fromUrl = function (giturl) {
- if (giturl == null || giturl == "") return
- var parsed = parseGitUrl(maybeGitHubShorthand(giturl) ? "github:" + giturl : giturl)
- var matches = Object.keys(gitHosts).map(function(V) {
+ if (giturl == null || giturl === '') return
+ var parsed = parseGitUrl(maybeGitHubShorthand(giturl) ? 'github:' + giturl : giturl)
+ var matches = Object.keys(gitHosts).map(function (V) {
var gitHost = gitHosts[V]
var comittish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null
- if (parsed.protocol == V + ":") {
+ if (parsed.protocol === V + ':') {
return new GitHost(V,
- decodeURIComponent(parsed.host), decodeURIComponent(parsed.path.replace(/^[/](.*?)(?:[.]git)?$/, "$1")), comittish)
+ decodeURIComponent(parsed.host), decodeURIComponent(parsed.path.replace(/^[/](.*?)(?:[.]git)?$/, '$1')), comittish, 'shortcut')
}
- if (parsed.host != gitHost.domain) return
- if (! gitHost.protocols_re.test(parsed.protocol)) return
- var matched = parsed.path.match(gitHost.pathmatch)
- if (! matched) return
+ if (parsed.host !== gitHost.domain) return
+ if (!gitHost.protocols_re.test(parsed.protocol)) return
+ var pathmatch = gitHost.pathmatch || gitHostDefaults.pathmatch
+ var matched = parsed.path.match(pathmatch)
+ if (!matched) return
return new GitHost(
V,
- matched[1]!=null && decodeURIComponent(matched[1]),
- matched[2]!=null && decodeURIComponent(matched[2]),
- comittish)
- }).filter(function(V){ return V })
- if (matches.length != 1) return
+ matched[1] != null && decodeURIComponent(matched[1]),
+ matched[2] != null && decodeURIComponent(matched[2]),
+ comittish,
+ protocolToType(parsed.protocol))
+ }).filter(function (V) { return V })
+ if (matches.length !== 1) return
return matches[0]
}
-function maybeGitHubShorthand(arg) {
+function maybeGitHubShorthand (arg) {
// Note: This does not fully test the git ref format.
// See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
//
@@ -56,11 +65,11 @@ function maybeGitHubShorthand(arg) {
}
var parseGitUrl = function (giturl) {
- if (typeof giturl != "string") giturl = "" + giturl
+ if (typeof giturl !== 'string') giturl = '' + giturl
var matched = giturl.match(/^([^@]+)@([^:]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
- if (! matched) return url.parse(giturl)
+ if (!matched) return url.parse(giturl)
return {
- protocol: "git+ssh:",
+ protocol: 'git+ssh:',
slashes: true,
auth: matched[1],
host: matched[2],
@@ -69,94 +78,88 @@ var parseGitUrl = function (giturl) {
hash: matched[4],
search: null,
query: null,
- pathname: "/" + matched[3],
- path: "/" + matched[3],
- href: "git+ssh://" + matched[1] + "@" + matched[2] + "/" + matched[3] + (matched[4]||"")
+ pathname: '/' + matched[3],
+ path: '/' + matched[3],
+ href: 'git+ssh://' + matched[1] + '@' + matched[2] + '/' + matched[3] + (matched[4] || '')
}
}
var gitHostDefaults = {
- "sshtemplate": "git@{domain}:{user}/{project}.git{#comittish}",
- "sshurltemplate": "git+ssh://git@{domain}/{user}/{project}.git{#comittish}",
- "browsetemplate": "https://{domain}/{user}/{project}{/tree/comittish}",
- "docstemplate": "https://{domain}/{user}/{project}{/tree/comittish}#readme",
- "httpstemplate": "https://{domain}/{user}/{project}.git{#comittish}",
- "filetemplate": "https://{domain}/{user}/{project}/raw/{comittish}/{path}"
+ 'sshtemplate': 'git@{domain}:{user}/{project}.git{#comittish}',
+ 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#comittish}',
+ 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/comittish}',
+ 'docstemplate': 'https://{domain}/{user}/{project}{/tree/comittish}#readme',
+ 'httpstemplate': 'git+https://{domain}/{user}/{project}.git{#comittish}',
+ 'filetemplate': 'https://{domain}/{user}/{project}/raw/{comittish}/{path}',
+ 'shortcuttemplate': '{type}:{user}/{project}{#comittish}',
+ 'pathtemplate': '{user}/{project}{#comittish}',
+ 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/
}
var gitHosts = {
github: {
// First two are insecure and generally shouldn't be used any more, but
// they are still supported.
- "protocols": [ "git", "http", "git+ssh", "git+https", "ssh", "https" ],
- "domain": "github.com",
- "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/,
- "treepath": "tree",
- "filetemplate": "https://raw.githubusercontent.com/{user}/{project}/{comittish}/{path}",
- "bugstemplate": "https://{domain}/{user}/{project}/issues",
- "gittemplate": "git://{domain}/{user}/{project}.git{#comittish}"
+ 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ],
+ 'domain': 'github.com',
+ 'treepath': 'tree',
+ 'filetemplate': 'https://raw.githubusercontent.com/{user}/{project}/{comittish}/{path}',
+ 'bugstemplate': 'https://{domain}/{user}/{project}/issues',
+ 'gittemplate': 'git://{domain}/{user}/{project}.git{#comittish}'
},
bitbucket: {
- "protocols": [ "git+ssh", "git+https", "ssh", "https" ],
- "domain": "bitbucket.org",
- "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/,
- "treepath": "src"
+ 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
+ 'domain': 'bitbucket.org',
+ 'treepath': 'src'
},
gitlab: {
- "protocols": [ "git+ssh", "git+https", "ssh", "https" ],
- "domain": "gitlab.com",
- "pathmatch": /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/,
- "treepath": "tree",
- "docstemplate": "https://{domain}/{user}/{project}{/tree/comittish}#README",
- "bugstemplate": "https://{domain}/{user}/{project}/issues"
+ 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
+ 'domain': 'gitlab.com',
+ 'treepath': 'tree',
+ 'docstemplate': 'https://{domain}/{user}/{project}{/tree/comittish}#README',
+ 'bugstemplate': 'https://{domain}/{user}/{project}/issues'
},
gist: {
- "protocols": [ "git", "git+ssh", "git+https", "ssh", "https" ],
- "domain": "gist.github.com",
- "pathmatch": /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/,
- "filetemplate": "https://gist.githubusercontent.com/{user}/{project}/raw{/comittish}/{path}",
- "bugstemplate": "https://{domain}/{project}",
- "gittemplate": "git://{domain}/{project}.git{#comittish}",
- "sshtemplate": "git@{domain}:/{project}.git{#comittish}",
- "sshurltemplate": "git+ssh://git@{domain}/{project}.git{#comittish}",
- "browsetemplate": "https://{domain}/{project}{/comittish}",
- "docstemplate": "https://{domain}/{project}{/comittish}",
- "httpstemplate": "https://{domain}/{project}.git{#comittish}",
- },
+ 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
+ 'domain': 'gist.github.com',
+ 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/,
+ 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/comittish}/{path}',
+ 'bugstemplate': 'https://{domain}/{project}',
+ 'gittemplate': 'git://{domain}/{project}.git{#comittish}',
+ 'sshtemplate': 'git@{domain}:/{project}.git{#comittish}',
+ 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#comittish}',
+ 'browsetemplate': 'https://{domain}/{project}{/comittish}',
+ 'docstemplate': 'https://{domain}/{project}{/comittish}',
+ 'httpstemplate': 'git+https://{domain}/{project}.git{#comittish}',
+ 'shortcuttemplate': '{type}:{project}{#comittish}',
+ 'pathtemplate': '{project}{#comittish}'
+ }
}
-Object.keys(gitHosts).forEach(function(host) {
- gitHosts[host].protocols_re = RegExp("^(" +
- gitHosts[host].protocols.map(function(P){
- return P.replace(/([\\+*{}()\[\]$^|])/g, "\\$1")
- }).join("|") + "):$")
+Object.keys(gitHosts).forEach(function (host) {
+ gitHosts[host].protocols_re = RegExp('^(' +
+ gitHosts[host].protocols.map(function (P) {
+ return P.replace(/([\\+*{}()\[\]$^|])/g, '\\$1')
+ }).join('|') + '):$')
})
-GitHost.prototype.shortcut = function () {
- return this.type + ":" + this.path()
-}
-
GitHost.prototype.hash = function () {
- return this.comittish ? "#" + this.comittish : ""
-}
-
-GitHost.prototype.path = function () {
- return this.user + "/" + this.project + this.hash()
+ return this.comittish ? '#' + this.comittish : ''
}
GitHost.prototype._fill = function (template, vars) {
- if (!template) throw new Error("Tried to fill without template")
+ if (!template) return
if (!vars) vars = {}
var self = this
- Object.keys(this).forEach(function(K){ if (self[K]!=null && vars[K]==null) vars[K] = self[K] })
+ Object.keys(this).forEach(function (K) { if (self[K] != null && vars[K] == null) vars[K] = self[K] })
var rawComittish = vars.comittish
- Object.keys(vars).forEach(function(K){ (K[0]!='#') && (vars[K] = encodeURIComponent(vars[K])) })
- vars["#comittish"] = rawComittish ? "#" + rawComittish : ""
- vars["/tree/comittish"] = vars.comittish ? "/"+vars.treepath+"/" + vars.comittish : "",
- vars["/comittish"] = vars.comittish ? "/" + vars.comittish : ""
- vars.comittish = vars.comittish || "master"
+ Object.keys(vars).forEach(function (K) { (K[0] !== '#') && (vars[K] = encodeURIComponent(vars[K])) })
+ vars['#comittish'] = rawComittish ? '#' + rawComittish : ''
+ vars['/tree/comittish'] = vars.comittish ? '/' + vars.treepath + '/' + vars.comittish : ''
+ vars['/comittish'] = vars.comittish ? '/' + vars.comittish : ''
+ vars.comittish = vars.comittish || 'master'
var res = template
- Object.keys(vars).forEach(function(K){
- res = res.replace(new RegExp("[{]" + K + "[}]", "g"), vars[K])
+ Object.keys(vars).forEach(function (K) {
+ res = res.replace(new RegExp('[{]' + K + '[}]', 'g'), vars[K])
})
return res
}
@@ -181,9 +184,9 @@ GitHost.prototype.docs = function () {
return this._fill(docstemplate)
}
-GitHost.prototype.bugs = function() {
- if (! this.bugstemplate) return
- return this._fill(this.bugstemplate)
+GitHost.prototype.bugs = function () {
+ var bugstemplate = this.bugstemplate || gitHostDefaults.bugstemplate
+ return this._fill(bugstemplate)
}
GitHost.prototype.https = function () {
@@ -192,17 +195,31 @@ GitHost.prototype.https = function () {
}
GitHost.prototype.git = function () {
- if (! this.gittemplate) return
- return this._fill(this.gittemplate)
+ var gittemplate = this.gittemplate || gitHostDefaults.gittemplate
+ return this._fill(gittemplate)
+}
+
+GitHost.prototype.shortcut = function () {
+ var shortcuttemplate = this.shortcuttemplate || gitHostDefaults.shortcuttemplate
+ return this._fill(shortcuttemplate)
+}
+
+GitHost.prototype.path = function () {
+ var pathtemplate = this.pathtemplate || gitHostDefaults.pathtemplate
+ return this._fill(pathtemplate)
}
GitHost.prototype.file = function (P) {
var filetemplate = this.filetemplate || gitHostDefaults.filetemplate
return this._fill(filetemplate, {
- path: P.replace(/^[/]+/g, "")
+ path: P.replace(/^[/]+/g, '')
})
}
+GitHost.prototype.getDefaultRepresentation = function () {
+ return this.default
+}
+
GitHost.prototype.toString = function () {
- return this[this.default||"sshurl"]()
+ return (this[this.default] || this.sshurl).call(this)
}
diff --git a/node_modules/hosted-git-info/package.json b/node_modules/hosted-git-info/package.json
index 4e38cb439..c3f7df2a4 100644
--- a/node_modules/hosted-git-info/package.json
+++ b/node_modules/hosted-git-info/package.json
@@ -1,6 +1,6 @@
{
"name": "hosted-git-info",
- "version": "1.5.3",
+ "version": "2.0.3",
"description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab",
"main": "index.js",
"repository": {
@@ -24,17 +24,18 @@
},
"homepage": "https://github.com/npm/hosted-git-info",
"scripts": {
- "test": "tap test/*.js"
+ "test": "standard && tap test/*.js"
},
"devDependencies": {
+ "standard": "^3.3.2",
"tap": "^0.4.13"
},
- "gitHead": "153325f997813ebf8a7ae07b322b4fa89aa25f7d",
- "_id": "hosted-git-info@1.5.3",
- "_shasum": "1f46e25e9c0e207852fb7a4b94422ed5f09a03f5",
- "_from": "hosted-git-info@>=1.5.3 <1.6.0",
- "_npmVersion": "2.4.0",
- "_nodeVersion": "0.10.33",
+ "gitHead": "4631ddc33c8aab40bf1ac17165e4e01527a9970b",
+ "_id": "hosted-git-info@2.0.3",
+ "_shasum": "d58835b6accdfc91ac8fa0707c070cde81f1ddff",
+ "_from": "hosted-git-info@2.0.3",
+ "_npmVersion": "2.7.5",
+ "_nodeVersion": "1.6.2",
"_npmUser": {
"name": "iarna",
"email": "me@re-becca.org"
@@ -46,10 +47,9 @@
}
],
"dist": {
- "shasum": "1f46e25e9c0e207852fb7a4b94422ed5f09a03f5",
- "tarball": "http://registry.npmjs.org/hosted-git-info/-/hosted-git-info-1.5.3.tgz"
+ "shasum": "d58835b6accdfc91ac8fa0707c070cde81f1ddff",
+ "tarball": "http://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.0.3.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-1.5.3.tgz",
- "readme": "ERROR: No README data found!"
+ "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.0.3.tgz"
}
diff --git a/node_modules/hosted-git-info/test/basic.js b/node_modules/hosted-git-info/test/basic.js
index e56ef9a05..0b93f50e2 100644
--- a/node_modules/hosted-git-info/test/basic.js
+++ b/node_modules/hosted-git-info/test/basic.js
@@ -1,9 +1,15 @@
-"use strict"
-var HostedGit = require("../index")
-var test = require("tap").test
+'use strict'
+var HostedGit = require('../index')
+var test = require('tap').test
-test("basic", function (t) {
- t.is(HostedGit.fromUrl("https://google.com"), undefined, "null on failure")
-
- t.end()
+test('basic', function (t) {
+ t.is(HostedGit.fromUrl('https://google.com'), undefined, 'null on failure')
+ t.is(HostedGit.fromUrl('https://github.com/abc/def').getDefaultRepresentation(), 'https', 'match https urls')
+ t.is(HostedGit.fromUrl('ssh://git@github.com/abc/def').getDefaultRepresentation(), 'sshurl', 'match ssh urls')
+ t.is(HostedGit.fromUrl('git+ssh://git@github.com/abc/def').getDefaultRepresentation(), 'sshurl', 'match git+ssh urls')
+ t.is(HostedGit.fromUrl('git+https://github.com/abc/def').getDefaultRepresentation(), 'https', 'match git+https urls')
+ t.is(HostedGit.fromUrl('git@github.com:abc/def').getDefaultRepresentation(), 'sshurl', 'match ssh connect strings')
+ t.is(HostedGit.fromUrl('git://github.com/abc/def').getDefaultRepresentation(), 'git', 'match git urls')
+ t.is(HostedGit.fromUrl('github:abc/def').getDefaultRepresentation(), 'shortcut', 'match shortcuts')
+ t.end()
})
diff --git a/node_modules/hosted-git-info/test/bitbucket.js b/node_modules/hosted-git-info/test/bitbucket.js
index 089cb2819..72e4ba113 100644
--- a/node_modules/hosted-git-info/test/bitbucket.js
+++ b/node_modules/hosted-git-info/test/bitbucket.js
@@ -1,24 +1,23 @@
-"use strict"
-var HostedGit = require("../index")
-var test = require("tap").test
+'use strict'
+var HostedGit = require('../index')
+var test = require('tap').test
-test("fromUrl(bitbucket url)", function (t) {
- function verify(host, label, branch) {
+test('fromUrl(bitbucket url)', function (t) {
+ function verify (host, label, branch) {
var hostinfo = HostedGit.fromUrl(host)
- var hash = branch ? "#" + branch : ""
+ var hash = branch ? '#' + branch : ''
t.ok(hostinfo, label)
- if (! hostinfo) return
- t.is( hostinfo.https(), "https://bitbucket.org/111/222.git" + hash, label + " -> https" )
- t.is( hostinfo.browse(), "https://bitbucket.org/111/222" + (branch ? "/src/" + branch : ""), label + " -> browse" )
- t.is( hostinfo.docs(), "https://bitbucket.org/111/222" + (branch ? "/src/" + branch : "") + "#readme", label + " -> docs" )
- t.is( hostinfo.ssh(), "git@bitbucket.org:111/222.git" + hash, label + " -> ssh" )
- t.is( hostinfo.sshurl(), "git+ssh://git@bitbucket.org/111/222.git" + hash, label + " -> sshurl" )
- t.is( (""+hostinfo), "git+ssh://git@bitbucket.org/111/222.git" + hash, label + " -> stringify" )
- t.is( hostinfo.file("C"), "https://bitbucket.org/111/222/raw/"+(branch||"master")+"/C", label + " -> file" )
+ if (!hostinfo) return
+ t.is(hostinfo.https(), 'git+https://bitbucket.org/111/222.git' + hash, label + ' -> https')
+ t.is(hostinfo.browse(), 'https://bitbucket.org/111/222' + (branch ? '/src/' + branch : ''), label + ' -> browse')
+ t.is(hostinfo.docs(), 'https://bitbucket.org/111/222' + (branch ? '/src/' + branch : '') + '#readme', label + ' -> docs')
+ t.is(hostinfo.ssh(), 'git@bitbucket.org:111/222.git' + hash, label + ' -> ssh')
+ t.is(hostinfo.sshurl(), 'git+ssh://git@bitbucket.org/111/222.git' + hash, label + ' -> sshurl')
+ t.is(hostinfo.shortcut(), 'bitbucket:111/222' + hash, label + ' -> shortcut')
+ t.is(hostinfo.file('C'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file')
}
- require('./lib/standard-tests')(verify, "bitbucket.org", "bitbucket")
+ require('./lib/standard-tests')(verify, 'bitbucket.org', 'bitbucket')
t.end()
})
-
diff --git a/node_modules/hosted-git-info/test/gist.js b/node_modules/hosted-git-info/test/gist.js
index a316048cb..e844f04d3 100644
--- a/node_modules/hosted-git-info/test/gist.js
+++ b/node_modules/hosted-git-info/test/gist.js
@@ -1,40 +1,38 @@
-"use strict"
-var HostedGit = require("../index")
-var test = require("tap").test
+'use strict'
+var HostedGit = require('../index')
+var test = require('tap').test
-
-test("fromUrl(gist url)", function (t) {
- function verify(host, label, branch) {
+test('fromUrl(gist url)', function (t) {
+ function verify (host, label, branch) {
var hostinfo = HostedGit.fromUrl(host)
- var hash = branch ? "#" + branch : ""
+ var hash = branch ? '#' + branch : ''
t.ok(hostinfo, label)
- if (! hostinfo) return
- t.is( hostinfo.https(), "https://gist.github.com/222.git" + hash, label + " -> https" )
- t.is( hostinfo.git(), "git://gist.github.com/222.git" + hash, label + " -> git" )
- t.is( hostinfo.browse(), "https://gist.github.com/222" + (branch ? "/" + branch : ""), label + " -> browse" )
- t.is( hostinfo.bugs(), "https://gist.github.com/222", label + " -> bugs" )
- t.is( hostinfo.docs(), "https://gist.github.com/222" + (branch ? "/" + branch : ""), label + " -> docs" )
- t.is( hostinfo.ssh(), "git@gist.github.com:/222.git" + hash, label + " -> ssh" )
- t.is( hostinfo.sshurl(), "git+ssh://git@gist.github.com/222.git" + hash, label + " -> sshurl" )
- t.is( (""+hostinfo), "git+ssh://git@gist.github.com/222.git" + hash, label + " -> stringify" )
+ if (!hostinfo) return
+ t.is(hostinfo.https(), 'git+https://gist.github.com/222.git' + hash, label + ' -> https')
+ t.is(hostinfo.git(), 'git://gist.github.com/222.git' + hash, label + ' -> git')
+ t.is(hostinfo.browse(), 'https://gist.github.com/222' + (branch ? '/' + branch : ''), label + ' -> browse')
+ t.is(hostinfo.bugs(), 'https://gist.github.com/222', label + ' -> bugs')
+ t.is(hostinfo.docs(), 'https://gist.github.com/222' + (branch ? '/' + branch : ''), label + ' -> docs')
+ t.is(hostinfo.ssh(), 'git@gist.github.com:/222.git' + hash, label + ' -> ssh')
+ t.is(hostinfo.sshurl(), 'git+ssh://git@gist.github.com/222.git' + hash, label + ' -> sshurl')
+ t.is(hostinfo.shortcut(), 'gist:222' + hash, label + ' -> shortcut')
if (hostinfo.user) {
- t.is( hostinfo.file("C"), "https://gist.githubusercontent.com/111/222/raw/"+(branch?branch+"/":"")+"C", label + " -> file" )
+ t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/222/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file')
}
}
- verify("git@gist.github.com:222.git", "git@")
- var hostinfo = HostedGit.fromUrl("git@gist.github.com:/ef860c7z5e0de3179341.git")
- if (t.ok(hostinfo, "git@hex")) {
- t.is( hostinfo.https(), "https://gist.github.com/ef860c7z5e0de3179341.git", "git@hex -> https" )
+ verify('git@gist.github.com:222.git', 'git@')
+ var hostinfo = HostedGit.fromUrl('git@gist.github.com:/ef860c7z5e0de3179341.git')
+ if (t.ok(hostinfo, 'git@hex')) {
+ t.is(hostinfo.https(), 'git+https://gist.github.com/ef860c7z5e0de3179341.git', 'git@hex -> https')
}
- verify("git@gist.github.com:/222.git", "git@/")
- verify("git://gist.github.com/222", "git")
- verify("git://gist.github.com/222.git", "git.git")
- verify("git://gist.github.com/222#branch", "git#branch", "branch")
- verify("git://gist.github.com/222.git#branch", "git.git#branch", "branch")
+ verify('git@gist.github.com:/222.git', 'git@/')
+ verify('git://gist.github.com/222', 'git')
+ verify('git://gist.github.com/222.git', 'git.git')
+ verify('git://gist.github.com/222#branch', 'git#branch', 'branch')
+ verify('git://gist.github.com/222.git#branch', 'git.git#branch', 'branch')
- require('./lib/standard-tests')(verify, "gist.github.com", "gist")
+ require('./lib/standard-tests')(verify, 'gist.github.com', 'gist')
t.end()
})
-
diff --git a/node_modules/hosted-git-info/test/github.js b/node_modules/hosted-git-info/test/github.js
index e551c45d7..56098a3e3 100644
--- a/node_modules/hosted-git-info/test/github.js
+++ b/node_modules/hosted-git-info/test/github.js
@@ -1,42 +1,40 @@
-"use strict"
-var HostedGit = require("../index")
-var test = require("tap").test
+'use strict'
+var HostedGit = require('../index')
+var test = require('tap').test
-
-test("fromUrl(github url)", function (t) {
- function verify(host, label, branch) {
+test('fromUrl(github url)', function (t) {
+ function verify (host, label, branch) {
var hostinfo = HostedGit.fromUrl(host)
- var hash = branch ? "#" + branch : ""
+ var hash = branch ? '#' + branch : ''
t.ok(hostinfo, label)
- if (! hostinfo) return
- t.is( hostinfo.https(), "https://github.com/111/222.git" + hash, label + " -> https" )
- t.is( hostinfo.git(), "git://github.com/111/222.git" + hash, label + " -> git" )
- t.is( hostinfo.browse(), "https://github.com/111/222" + (branch ? "/tree/" + branch : ""), label + " -> browse" )
- t.is( hostinfo.bugs(), "https://github.com/111/222/issues", label + " -> bugs" )
- t.is( hostinfo.docs(), "https://github.com/111/222" + (branch ? "/tree/" + branch : "") + "#readme", label + " -> docs" )
- t.is( hostinfo.ssh(), "git@github.com:111/222.git" + hash, label + " -> ssh" )
- t.is( hostinfo.sshurl(), "git+ssh://git@github.com/111/222.git" + hash, label + " -> sshurl" )
- t.is( (""+hostinfo), "git+ssh://git@github.com/111/222.git" + hash, label + " -> stringify" )
- t.is( hostinfo.file("C"), "https://raw.githubusercontent.com/111/222/"+(branch||"master")+"/C", label + " -> file" )
+ if (!hostinfo) return
+ t.is(hostinfo.https(), 'git+https://github.com/111/222.git' + hash, label + ' -> https')
+ t.is(hostinfo.git(), 'git://github.com/111/222.git' + hash, label + ' -> git')
+ t.is(hostinfo.browse(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse')
+ t.is(hostinfo.bugs(), 'https://github.com/111/222/issues', label + ' -> bugs')
+ t.is(hostinfo.docs(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : '') + '#readme', label + ' -> docs')
+ t.is(hostinfo.ssh(), 'git@github.com:111/222.git' + hash, label + ' -> ssh')
+ t.is(hostinfo.sshurl(), 'git+ssh://git@github.com/111/222.git' + hash, label + ' -> sshurl')
+ t.is(hostinfo.shortcut(), 'github:111/222' + hash, label + ' -> shortcut')
+ t.is(hostinfo.file('C'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file')
}
// github shorturls
- verify("111/222", "github-short")
- verify("111/222#branch", "github-short#branch", "branch")
+ verify('111/222', 'github-short')
+ verify('111/222#branch', 'github-short#branch', 'branch')
// insecure protocols
- verify("git://github.com/111/222", "git")
- verify("git://github.com/111/222.git", "git.git")
- verify("git://github.com/111/222#branch", "git#branch", "branch")
- verify("git://github.com/111/222.git#branch", "git.git#branch", "branch")
+ verify('git://github.com/111/222', 'git')
+ verify('git://github.com/111/222.git', 'git.git')
+ verify('git://github.com/111/222#branch', 'git#branch', 'branch')
+ verify('git://github.com/111/222.git#branch', 'git.git#branch', 'branch')
- verify("http://github.com/111/222", "http")
- verify("http://github.com/111/222.git", "http.git")
- verify("http://github.com/111/222#branch", "http#branch", "branch")
- verify("http://github.com/111/222.git#branch", "http.git#branch", "branch")
+ verify('http://github.com/111/222', 'http')
+ verify('http://github.com/111/222.git', 'http.git')
+ verify('http://github.com/111/222#branch', 'http#branch', 'branch')
+ verify('http://github.com/111/222.git#branch', 'http.git#branch', 'branch')
- require('./lib/standard-tests')(verify, "github.com", "github")
+ require('./lib/standard-tests')(verify, 'github.com', 'github')
t.end()
})
-
diff --git a/node_modules/hosted-git-info/test/gitlab.js b/node_modules/hosted-git-info/test/gitlab.js
index 1a4e07096..315c9085b 100644
--- a/node_modules/hosted-git-info/test/gitlab.js
+++ b/node_modules/hosted-git-info/test/gitlab.js
@@ -1,25 +1,23 @@
-"use strict"
-var HostedGit = require("../index")
-var test = require("tap").test
+'use strict'
+var HostedGit = require('../index')
+var test = require('tap').test
-
-test("fromUrl(gitlab url)", function (t) {
- function verify(host, label, branch) {
+test('fromUrl(gitlab url)', function (t) {
+ function verify (host, label, branch) {
var hostinfo = HostedGit.fromUrl(host)
- var hash = branch ? "#" + branch : ""
+ var hash = branch ? '#' + branch : ''
t.ok(hostinfo, label)
- if (! hostinfo) return
- t.is( hostinfo.https(), "https://gitlab.com/111/222.git" + hash, label + " -> https" )
- t.is( hostinfo.browse(), "https://gitlab.com/111/222" + (branch ? "/tree/" + branch : ""), label + " -> browse" )
- t.is( hostinfo.docs(), "https://gitlab.com/111/222" + (branch ? "/tree/" + branch : "") + "#README", label + " -> docs" )
- t.is( hostinfo.ssh(), "git@gitlab.com:111/222.git" + hash, label + " -> ssh" )
- t.is( hostinfo.sshurl(), "git+ssh://git@gitlab.com/111/222.git" + hash, label + " -> sshurl" )
- t.is( (""+hostinfo), "git+ssh://git@gitlab.com/111/222.git" + hash, label + " -> stringify" )
- t.is( hostinfo.file("C"), "https://gitlab.com/111/222/raw/"+(branch||"master")+"/C", label + " -> file" )
+ if (!hostinfo) return
+ t.is(hostinfo.https(), 'git+https://gitlab.com/111/222.git' + hash, label + ' -> https')
+ t.is(hostinfo.browse(), 'https://gitlab.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse')
+ t.is(hostinfo.docs(), 'https://gitlab.com/111/222' + (branch ? '/tree/' + branch : '') + '#README', label + ' -> docs')
+ t.is(hostinfo.ssh(), 'git@gitlab.com:111/222.git' + hash, label + ' -> ssh')
+ t.is(hostinfo.sshurl(), 'git+ssh://git@gitlab.com/111/222.git' + hash, label + ' -> sshurl')
+ t.is(hostinfo.shortcut(), 'gitlab:111/222' + hash, label + ' -> shortcut')
+ t.is(hostinfo.file('C'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file')
}
- require('./lib/standard-tests')(verify, "gitlab.com", "gitlab")
+ require('./lib/standard-tests')(verify, 'gitlab.com', 'gitlab')
t.end()
})
-
diff --git a/node_modules/hosted-git-info/test/lib/standard-tests.js b/node_modules/hosted-git-info/test/lib/standard-tests.js
index c505342fa..929fcca42 100644
--- a/node_modules/hosted-git-info/test/lib/standard-tests.js
+++ b/node_modules/hosted-git-info/test/lib/standard-tests.js
@@ -1,28 +1,27 @@
-"use strict"
+'use strict'
module.exports = function (verify, domain, shortname) {
- verify("https://" + domain + "/111/222", "https")
- verify("https://" + domain + "/111/222.git", "https.git")
- verify("https://" + domain + "/111/222#branch", "https#branch", "branch")
- verify("https://" + domain + "/111/222.git#branch", "https.git#branch", "branch")
+ verify('https://' + domain + '/111/222', 'https')
+ verify('https://' + domain + '/111/222.git', 'https.git')
+ verify('https://' + domain + '/111/222#branch', 'https#branch', 'branch')
+ verify('https://' + domain + '/111/222.git#branch', 'https.git#branch', 'branch')
- verify("git+https://" + domain + "/111/222", "git+https")
- verify("git+https://" + domain + "/111/222.git", "git+https.git")
- verify("git+https://" + domain + "/111/222#branch", "git+https#branch", "branch")
- verify("git+https://" + domain + "/111/222.git#branch", "git+https.git#branch", "branch")
+ verify('git+https://' + domain + '/111/222', 'git+https')
+ verify('git+https://' + domain + '/111/222.git', 'git+https.git')
+ verify('git+https://' + domain + '/111/222#branch', 'git+https#branch', 'branch')
+ verify('git+https://' + domain + '/111/222.git#branch', 'git+https.git#branch', 'branch')
- verify("git@" + domain + ":111/222", "ssh")
- verify("git@" + domain + ":111/222.git", "ssh.git")
- verify("git@" + domain + ":111/222#branch", "ssh", "branch")
- verify("git@" + domain + ":111/222.git#branch", "ssh.git", "branch")
+ verify('git@' + domain + ':111/222', 'ssh')
+ verify('git@' + domain + ':111/222.git', 'ssh.git')
+ verify('git@' + domain + ':111/222#branch', 'ssh', 'branch')
+ verify('git@' + domain + ':111/222.git#branch', 'ssh.git', 'branch')
+ verify('git+ssh://git@' + domain + '/111/222', 'ssh url')
+ verify('git+ssh://git@' + domain + '/111/222.git', 'ssh url.git')
+ verify('git+ssh://git@' + domain + '/111/222#branch', 'ssh url#branch', 'branch')
+ verify('git+ssh://git@' + domain + '/111/222.git#branch', 'ssh url.git#branch', 'branch')
- verify("git+ssh://git@" + domain + "/111/222", "ssh url")
- verify("git+ssh://git@" + domain + "/111/222.git", "ssh url.git")
- verify("git+ssh://git@" + domain + "/111/222#branch", "ssh url#branch", "branch")
- verify("git+ssh://git@" + domain + "/111/222.git#branch", "ssh url.git#branch", "branch")
-
- verify(shortname + ":111/222", "shortcut")
- verify(shortname + ":111/222.git", "shortcut.git")
- verify(shortname + ":111/222#branch", "shortcut#branch", "branch")
- verify(shortname + ":111/222.git#branch", "shortcut.git#branch", "branch")
+ verify(shortname + ':111/222', 'shortcut')
+ verify(shortname + ':111/222.git', 'shortcut.git')
+ verify(shortname + ':111/222#branch', 'shortcut#branch', 'branch')
+ verify(shortname + ':111/222.git#branch', 'shortcut.git#branch', 'branch')
}