Comparing version 1.0.1 to 1.0.2
var path = require('path'); | ||
function parseRemoteUri(remoteUri) { | ||
var gitRemote = /^git@([^:]+):([^\.]+)(\.git)?$/, | ||
httpRemote = /^(https?):\/\/([^@]+@)?([^\/]+)\/([^\.]+)(\.git)?$/; | ||
var gitRemote = /^git@([^:]+):(.+\/.+)$/, | ||
httpRemote = /^(https?):\/\/([^@]+@)?([^\/]+)\/(.+)$/; | ||
@@ -10,3 +10,3 @@ var matches = null; | ||
if (matches = gitRemote.exec(remoteUri)) { | ||
var repository = matches[2], | ||
var repository = matches[2].replace(/\.git$/, ''), | ||
splitRepo = repository.split('/'); | ||
@@ -25,3 +25,3 @@ | ||
if (matches = httpRemote.exec(remoteUri)) { | ||
var repository = matches[4], | ||
var repository = matches[4].replace(/\.git$/, ''), | ||
splitRepo = repository.split('/'); | ||
@@ -28,0 +28,0 @@ |
{ | ||
"name": "parse-repo", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Extract repository info from a git remote URI", | ||
@@ -5,0 +5,0 @@ "author": "Diego Guerra <dgoguerra.or@gmail.com>", |
18
test.js
@@ -32,2 +32,20 @@ var tape = require('tape'), | ||
t.deepEqual(parseRepo('git@github.com:simshanith/pi.simloovoo.com.git'), { | ||
remote: 'git@github.com:simshanith/pi.simloovoo.com.git', | ||
protocol: 'git', | ||
host: 'github.com', | ||
repository: 'simshanith/pi.simloovoo.com', | ||
owner: 'simshanith', | ||
project: 'pi.simloovoo.com' | ||
}); | ||
t.deepEqual(parseRepo('https://github.com/simshanith/pi.simloovoo.com'), { | ||
remote: 'https://github.com/simshanith/pi.simloovoo.com', | ||
protocol: 'https', | ||
host: 'github.com', | ||
repository: 'simshanith/pi.simloovoo.com', | ||
owner: 'simshanith', | ||
project: 'pi.simloovoo.com' | ||
}); | ||
t.end(); | ||
@@ -34,0 +52,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6882
153