pax_global_header00006660000000000000000000000064121355443320014514gustar00rootroot0000000000000052 comment=f0f66a3112a3c25651a328cad96cab4fce4b3e88 node-github-url-from-git-1.1.1/000077500000000000000000000000001213554433200162435ustar00rootroot00000000000000node-github-url-from-git-1.1.1/.gitignore000066400000000000000000000000151213554433200202270ustar00rootroot00000000000000node_modules node-github-url-from-git-1.1.1/Makefile000066400000000000000000000001321213554433200176770ustar00rootroot00000000000000 test: @./node_modules/.bin/mocha test.js --reporter spec --require should .PHONY: test node-github-url-from-git-1.1.1/Readme.md000066400000000000000000000024071213554433200177650ustar00rootroot00000000000000 # 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') }) }) ``` node-github-url-from-git-1.1.1/index.js000066400000000000000000000005001213554433200177030ustar00rootroot00000000000000var 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 } }; node-github-url-from-git-1.1.1/package.json000066400000000000000000000007221213554433200205320ustar00rootroot00000000000000{ "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" } } node-github-url-from-git-1.1.1/test.js000066400000000000000000000024511213554433200175620ustar00rootroot00000000000000 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') }) })