Skip to content

Commit

Permalink
Run git submodule update after initial clone
Browse files Browse the repository at this point in the history
Some repositories require that submodules be initialized and updated to
be properly built.  This is now done during the download phase for every
repository.
  • Loading branch information
btaylor authored and alloy committed Jul 17, 2012
1 parent 7fc60b5 commit b364272
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/cocoapods/downloader/git.rb
Expand Up @@ -76,6 +76,7 @@ def update_cache
git "reset --hard HEAD"
git "clean -d -x -f"
git "pull"
git "submodule update"
end
end

Expand Down Expand Up @@ -111,6 +112,7 @@ def download_tag
git "fetch origin tags/#{options[:tag]}"
git "reset --hard FETCH_HEAD"
git "checkout -b activated-pod-commit"
git "submodule update --init"
end
end

Expand All @@ -135,6 +137,9 @@ def download_branch

def clone(from, to)
git "clone \"#{from}\" \"#{to}\""
Dir.chdir(to) do
git "submodule update --init"
end
end
end

Expand Down
Binary file modified spec/fixtures/banana-lib.tar.gz
Binary file not shown.
22 changes: 22 additions & 0 deletions spec/functional/downloader_spec.rb
Expand Up @@ -39,6 +39,28 @@ module Pod
(@pod.root + 'README').read.strip.should == 'v1.0'
end

it "initializes submodules when checking out a specific commit" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => '6cc9afc'
)
downloader = Downloader.for_pod(@pod)
downloader.download

(@pod.root + 'README').read.strip.should == 'post v1.0'
(@pod.root + 'libPusher/README.md').read.strip.should.match /^libPusher/
end

it "initializes submodules when checking out a specific tag" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :tag => 'v1.1'
)
downloader = Downloader.for_pod(@pod)
downloader.download

(@pod.root + 'README').read.strip.should == 'post v1.0'
(@pod.root + 'libPusher/README.md').read.strip.should.match /^libPusher/
end

it "prepares the cache if it does not exits" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :commit => 'fd56054'
Expand Down

0 comments on commit b364272

Please sign in to comment.