File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ function parse(str) {
79
79
80
80
obj . branch = obj . branch || seg [ 2 ] || getBranch ( obj . path , obj ) ;
81
81
var res = { } ;
82
+ res . host = obj . host || 'github.com' ;
82
83
res . owner = obj . owner || null ;
83
84
res . name = obj . name || null ;
84
85
res . repo = obj . repo ;
Original file line number Diff line number Diff line change @@ -176,4 +176,18 @@ describe('parse-github-url', function() {
176
176
assert . equal ( gh ( 'https://github.com/repos/assemble/verb/zipball' ) . name , 'verb' ) ;
177
177
assert . equal ( gh ( 'https://github.com/repos/assemble/dot.repo/zipball' ) . name , 'dot.repo' ) ;
178
178
} ) ;
179
+ it ( 'should get the host:' , function ( ) {
180
+ assert . equal ( gh ( 'git+https://github.com/assemble/verb.git' ) . host , 'github.com' ) ;
181
+ assert . equal ( gh ( 'git+ssh://github.com/assemble/verb.git' ) . host , 'github.com' ) ;
182
+ assert . equal ( gh ( 'git://github.com/assemble/verb' ) . host , 'github.com' ) ;
183
+ assert . equal ( gh ( 'git://github.com/assemble/verb.git' ) . host , 'github.com' ) ;
184
+ assert . equal ( gh ( 'git://github.one.com/assemble/verb.git' ) . host , 'github.one.com' ) ;
185
+ assert . equal ( gh ( 'git://github.one.two.com/assemble/verb.git' ) . host , 'github.one.two.com' ) ;
186
+ assert . equal ( gh ( 'https://github.com/assemble/verb' ) . host , 'github.com' ) ;
187
+ assert . equal ( gh ( 'https://github.one.com/assemble/verb' ) . host , 'github.one.com' ) ;
188
+ assert . equal ( gh ( 'https://github.one.two.com/assemble/verb' ) . host , 'github.one.two.com' ) ;
189
+ } ) ;
190
+ it ( 'should assume github.com is the host when not provided:' , function ( ) {
191
+ assert . equal ( gh ( 'assemble/verb' ) . host , 'github.com' ) ;
192
+ } ) ;
179
193
} ) ;
You can’t perform that action at this time.
0 commit comments