@@ -198,29 +198,56 @@ module Pod
198198 @sources_manager . send ( :name_for_url , url ) . should == 'trunk'
199199 end
200200
201- it 'uses the organization name for github.com URLs' do
201+ it 'uses the organization and repo name for github.com URLs' do
202202 url = 'https://github.com/segiddins/banana.git'
203+ @sources_manager . send ( :name_for_url , url ) . should == 'segiddins-banana'
204+ end
205+
206+ it 'uses the organization name only for github.com specs URLs' do
207+ url = 'https://github.com/segiddins/Specs.git'
203208 @sources_manager . send ( :name_for_url , url ) . should == 'segiddins'
204209 end
205210
206211 it 'uses a combination of host and path for other URLs' do
207212 url = 'https://sourceforge.org/Artsy/Specs.git'
208213 @sources_manager . send ( :name_for_url , url ) .
209- should == 'sourceforge-artsy-specs'
214+ should == 'sourceforge-artsy'
215+ url = 'https://sourceforge.org.au/Artsy/Specs.git'
216+ @sources_manager . send ( :name_for_url , url ) .
217+ should == 'sourceforge-artsy'
218+ url = 'https://pvt.sourceforge.org.au/Artsy/Specs.git'
219+ @sources_manager . send ( :name_for_url , url ) .
220+ should == 'sourceforge-artsy'
221+ end
222+
223+ it 'can understand arbitrary URI schemes' do
224+ url = 'banana://website.org/Artsy/Specs.git'
225+ @sources_manager . send ( :name_for_url , url ) .
226+ should == 'website-artsy'
227+ end
228+
229+ it 'should raise on completely ridiculous non-URL input' do
230+ url = ' '
231+ should . raise Informative do
232+ @sources_manager . send ( :name_for_url , url )
233+ end . message . should . == "Couldn't determine repo name for URL: #{ url } "
210234 end
211235
212236 it 'supports scp-style URLs' do
213237 url = 'git@git-host.com:specs.git'
214238 @sources_manager . send ( :name_for_url , url ) .
215- should == 'git-host-specs '
239+ should == 'git-host'
216240
217241 url = 'git@git-host.com/specs.git'
218242 @sources_manager . send ( :name_for_url , url ) .
219- should == 'git-host-specs '
243+ should == 'git-host'
220244
221245 url = 'git@git-host.com:/specs.git'
222246 @sources_manager . send ( :name_for_url , url ) .
223- should == 'git-host-specs'
247+ should == 'git-host'
248+ url = 'git@github.com/segiddins/Specs'
249+ @sources_manager . send ( :name_for_url , url ) .
250+ should == 'segiddins'
224251 end
225252
226253 it 'supports ssh URLs with an aliased hostname' do
@@ -230,9 +257,12 @@ module Pod
230257 end
231258
232259 it 'supports file URLs' do
233- url = 'file:///Users/kurrytran/pod-specs'
260+ url = 'file:///Users/kurrytran/etc'
261+ @sources_manager . send ( :name_for_url , url ) .
262+ should == 'users-kurrytran-etc'
263+ url = 'file:///Users/kurrytran/specs'
234264 @sources_manager . send ( :name_for_url , url ) .
235- should == 'users-kurrytran-pod-specs '
265+ should == 'users-kurrytran'
236266 end
237267
238268 it 'uses the repo name if no parent directory' do
@@ -244,20 +274,20 @@ module Pod
244274 it 'supports ssh URLs with no user component' do
245275 url = 'ssh://company.com/pods/specs.git'
246276 @sources_manager . send ( :name_for_url , url ) .
247- should == 'company-pods-specs '
277+ should == 'company-pods'
248278 end
249279
250280 it 'appends a number to the name if the base name dir exists' do
251281 url = 'https://github.com/segiddins/banana.git'
252282 Pathname . any_instance . stubs ( :exist? ) .
253283 returns ( true ) . then . returns ( false )
254- @sources_manager . send ( :name_for_url , url ) . should == 'segiddins-1'
284+ @sources_manager . send ( :name_for_url , url ) . should == 'segiddins-banana- 1'
255285
256286 url = 'https://sourceforge.org/Artsy/Specs.git'
257287 Pathname . any_instance . stubs ( :exist? ) .
258288 returns ( true ) . then . returns ( false )
259289 @sources_manager . send ( :name_for_url , url ) .
260- should == 'sourceforge-artsy-specs- 1'
290+ should == 'sourceforge-artsy-1'
261291 end
262292 end
263293
0 commit comments