Commit 3dc86c87 authored by Eloy Durán's avatar Eloy Durán

For some unknown reason, the Pods group was created twice sometimes.

Fixes: https://secure.travis-ci.org/#!/CocoaPods/CocoaPods/jobs/2236387
parent adb053f1
...@@ -31,12 +31,12 @@ module Pod ...@@ -31,12 +31,12 @@ module Pod
# Shortcut access to the `Pods' PBXGroup. # Shortcut access to the `Pods' PBXGroup.
def pods def pods
groups.find { |g| g.name == 'Pods' } || groups.new({ 'name' => 'Pods' }) @pods ||= groups.where(:name => 'Pods') || groups.new('name' => 'Pods')
end end
# Shortcut access to the `Local Pods' PBXGroup. # Shortcut access to the `Local Pods' PBXGroup.
def local_pods def local_pods
groups.find { |g| g.name == 'Local Pods' } || groups.new({ 'name' => 'Local Pods' }) @local_pods ||= groups.where(:name => 'Local Pods') || groups.new('name' => 'Local Pods')
end end
# Adds a group as child to the `Pods' group namespacing subspecs. # Adds a group as child to the `Pods' group namespacing subspecs.
...@@ -44,7 +44,7 @@ module Pod ...@@ -44,7 +44,7 @@ module Pod
groups = parent_group.groups groups = parent_group.groups
group = nil group = nil
name.split('/').each do |name| name.split('/').each do |name|
group = groups.find { |g| g.name == name } || groups.new('name' => name) group = groups.where(:name => name) || groups.new('name' => name)
groups = group.groups groups = group.groups
end end
group group
......
...@@ -71,12 +71,12 @@ module Pod ...@@ -71,12 +71,12 @@ module Pod
it "adds the files of the pod to the Pods project only once" do it "adds the files of the pod to the Pods project only once" do
@installer.install! @installer.install!
group = @installer.project.pods.groups.find{|g| g.name == 'Reachability'} group = @installer.project.pods.groups.where(:name => 'Reachability')
group.files.map(&:name).should == ["Reachability.h", "Reachability.m"] group.files.map(&:name).should == ["Reachability.h", "Reachability.m"]
end end
it "lists a pod only once" do it "lists a pod only once" do
reachability_pods = @installer.pods.map(&:to_s).select{|s| s.include?('Reachability') } reachability_pods = @installer.pods.map(&:to_s).select { |s| s.include?('Reachability') }
reachability_pods.count.should == 1 reachability_pods.count.should == 1
end end
......
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