Commit 4429b063 authored by Eloy Durán's avatar Eloy Durán

Merge pull request #426 from farcaller/patch-1

Fixed a bug with :head download and no prior clone
parents 5549e5f1 5adce292
...@@ -100,7 +100,11 @@ module Pod ...@@ -100,7 +100,11 @@ module Pod
end end
def download_head def download_head
update_cache if cache_exist?
update_cache
else
create_cache
end
clone(clone_url, target_path) clone(clone_url, target_path)
end end
......
...@@ -61,7 +61,7 @@ module Pod ...@@ -61,7 +61,7 @@ module Pod
(@pod.root + 'libPusher/README.md').read.strip.should.match /^libPusher/ (@pod.root + 'libPusher/README.md').read.strip.should.match /^libPusher/
end end
it "prepares the cache if it does not exits" do it "prepares the cache if it does not exist" do
@pod.top_specification.stubs(:source).returns( @pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054' :git => fixture('banana-lib'), :commit => 'fd56054'
) )
...@@ -72,6 +72,17 @@ module Pod ...@@ -72,6 +72,17 @@ module Pod
downloader.download downloader.download
end end
it "prepares the cache if it does not exist when the HEAD is requested explicitly" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib')
)
downloader = Downloader.for_pod(@pod)
downloader.cache_path.rmtree if downloader.cache_path.exist?
downloader.expects(:create_cache).once
downloader.stubs(:clone)
downloader.download_head
end
it "removes the oldest repo if the caches is too big" do it "removes the oldest repo if the caches is too big" do
@pod.top_specification.stubs(:source).returns( @pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054' :git => fixture('banana-lib'), :commit => 'fd56054'
......
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