Commit 28b95e88 authored by Eloy Durán's avatar Eloy Durán

[SourcesManager] Do not try to clone spec-repos in `/`.

Fixes #2723.
parent 0f76555d
...@@ -15,6 +15,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -15,6 +15,12 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Marius Rackwitz](https://github.com/mrackwitz) [Marius Rackwitz](https://github.com/mrackwitz)
[#2461](https://github.com/CocoaPods/CocoaPods/issues/2461) [#2461](https://github.com/CocoaPods/CocoaPods/issues/2461)
##### Bug Fixes
* Do not try to clone spec-repos in `/`.
[Eloy Durán](https://github.com/alloy)
[#2723](https://github.com/CocoaPods/CocoaPods/issues/2723)
## 0.34.4 ## 0.34.4
......
...@@ -433,16 +433,16 @@ module Pod ...@@ -433,16 +433,16 @@ module Pod
end end
case url.to_s.downcase case url.to_s.downcase
when %r{github.com(:|/)cocoapods/specs} when %r{github.com[:/]+cocoapods/specs}
base = 'master' base = 'master'
when %r{github.com(:|/)(.+)/(.+)} when %r{github.com[:/]+(.+)/(.+)}
base = Regexp.last_match[2] base = Regexp.last_match[1]
when %r{^\S+@(\S+)[:/]+(.+)$}
host, path = Regexp.last_match.captures
base = base_from_host_and_path[host, path]
when URI.regexp when URI.regexp
url = URI(url.downcase) url = URI(url.downcase)
base = base_from_host_and_path[url.host, url.path] base = base_from_host_and_path[url.host, url.path]
when %r{^\S+@(\S+)[:/](.+)$}
host, path = Regexp.last_match.captures
base = base_from_host_and_path[host, path]
else else
base = url.to_s.downcase base = url.to_s.downcase
end end
......
...@@ -114,6 +114,11 @@ module Pod ...@@ -114,6 +114,11 @@ module Pod
Pathname.any_instance.stubs(:exist?). Pathname.any_instance.stubs(:exist?).
returns(false).then.returns(true) returns(false).then.returns(true)
SourcesManager.send(:name_for_url, url).should == 'master' SourcesManager.send(:name_for_url, url).should == 'master'
url = 'git@github.com:/CocoaPods/Specs.git'
Pathname.any_instance.stubs(:exist?).
returns(false).then.returns(true)
SourcesManager.send(:name_for_url, url).should == 'master'
end end
it 'uses the organization name for github.com URLs' do it 'uses the organization name for github.com URLs' do
...@@ -128,9 +133,17 @@ module Pod ...@@ -128,9 +133,17 @@ module Pod
end end
it 'supports scp-style URLs' do it 'supports scp-style URLs' do
url = 'git@git-host.com:specs.git'
SourcesManager.send(:name_for_url, url).
should == 'git-host-specs'
url = 'git@git-host.com/specs.git' url = 'git@git-host.com/specs.git'
SourcesManager.send(:name_for_url, url). SourcesManager.send(:name_for_url, url).
should == 'git-host-specs' should == 'git-host-specs'
url = 'git@git-host.com:/specs.git'
SourcesManager.send(:name_for_url, url).
should == 'git-host-specs'
end end
it 'supports ssh URLs with an aliased hostname' do it 'supports ssh URLs with an aliased hostname' do
...@@ -138,13 +151,13 @@ module Pod ...@@ -138,13 +151,13 @@ module Pod
SourcesManager.send(:name_for_url, url). SourcesManager.send(:name_for_url, url).
should == 'companyalias-pod-specs' should == 'companyalias-pod-specs'
end end
it 'supports file URLs' do it 'supports file URLs' do
url = 'file:///Users/kurrytran/pod-specs' url = 'file:///Users/kurrytran/pod-specs'
SourcesManager.send(:name_for_url, url). SourcesManager.send(:name_for_url, url).
should == 'users-kurrytran-pod-specs' should == 'users-kurrytran-pod-specs'
end end
it 'uses the repo name if no parent directory' do it 'uses the repo name if no parent directory' do
url = 'file:///pod-specs' url = 'file:///pod-specs'
SourcesManager.send(:name_for_url, url). SourcesManager.send(:name_for_url, url).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment