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:
authorForrest L Norvell <forrest@npmjs.com>2015-04-10 06:24:49 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-04-10 06:24:49 +0300
commit33d1420bf2f629332fceb2ac7e174e63ac48f96a (patch)
treeff08f37fb621c835e07d2437fd0e24c82ba080e6 /node_modules/hosted-git-info/git-host-info.js
parent28ce62e3c2f887162c7fd36bd417b46033148980 (diff)
hosted-git-info@2.1.0
Add support for auth embedded directly in Git URLs.
Diffstat (limited to 'node_modules/hosted-git-info/git-host-info.js')
-rw-r--r--node_modules/hosted-git-info/git-host-info.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/node_modules/hosted-git-info/git-host-info.js b/node_modules/hosted-git-info/git-host-info.js
new file mode 100644
index 000000000..354d9fc0d
--- /dev/null
+++ b/node_modules/hosted-git-info/git-host-info.js
@@ -0,0 +1,64 @@
+'use strict'
+
+var gitHosts = module.exports = {
+ 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',
+ 'treepath': 'tree',
+ 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{comittish}/{path}',
+ 'bugstemplate': 'https://{domain}/{user}/{project}/issues',
+ 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#comittish}'
+ },
+ bitbucket: {
+ 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
+ 'domain': 'bitbucket.org',
+ 'treepath': 'src'
+ },
+ gitlab: {
+ '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': 'git+https://{domain}/{project}.git{#comittish}',
+ 'shortcuttemplate': '{type}:{project}{#comittish}',
+ 'pathtemplate': '{project}{#comittish}'
+ }
+}
+
+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': 'git+https://{auth@}{domain}/{user}/{project}.git{#comittish}',
+ 'filetemplate': 'https://{domain}/{user}/{project}/raw/{comittish}/{path}',
+ 'shortcuttemplate': '{type}:{user}/{project}{#comittish}',
+ 'pathtemplate': '{user}/{project}{#comittish}',
+ 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/
+}
+
+Object.keys(gitHosts).forEach(function (name) {
+ Object.keys(gitHostDefaults).forEach(function (key) {
+ if (gitHosts[name][key]) return
+ gitHosts[name][key] = gitHostDefaults[key]
+ })
+ gitHosts[name].protocols_re = RegExp('^(' +
+ gitHosts[name].protocols.map(function (protocol) {
+ return protocol.replace(/([\\+*{}()\[\]$^|])/g, '\\$1')
+ }).join('|') + '):$')
+})