Fix source validation for local URLs and SSH repos

parent 161ac76b
......@@ -123,7 +123,9 @@ module Pod
source = if !root_spec.source[:http].nil?
URI(root_spec.source[:http].to_s)
elsif !root_spec.source[:git].nil?
URI(root_spec.source[:git].to_s)
git_source = root_spec.source[:git].to_s
return unless git_source =~ /^#{URI.regexp}$/
URI(git_source)
end
if UNENCRYPTED_PROTOCOLS.include?(source.scheme)
UI.warn "'#{root_spec.name}' uses the unencrypted '#{source.scheme}' protocol to transfer the Pod. " \
......
......@@ -62,6 +62,30 @@ module Pod
UI.warnings.should.include 'uses the unencrypted \'git\' protocol'
end
it 'does not warn for local repositories with spaces' do
@spec.source = { :git => '/Users/kylef/Projects X', :tag => '1.0' }
dummy_response = Pod::Downloader::Response.new
Downloader.stubs(:download).returns(dummy_response)
@installer.install!
UI.warnings.length.should.equal(0)
end
it 'does not warn for SSH repositories' do
@spec.source = { :git => 'git@bitbucket.org:kylef/test.git', :tag => '1.0' }
dummy_response = Pod::Downloader::Response.new
Downloader.stubs(:download).returns(dummy_response)
@installer.install!
UI.warnings.length.should.equal(0)
end
it 'does not warn for SSH repositories on Github' do
@spec.source = { :git => 'git@github.com:kylef/test.git', :tag => '1.0' }
dummy_response = Pod::Downloader::Response.new
Downloader.stubs(:download).returns(dummy_response)
@installer.install!
UI.warnings.length.should.equal(0)
end
#--------------------------------------#
describe 'Prepare command' do
......
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