Commit 29e01725 authored by Samuel Giddins's avatar Samuel Giddins

[SpecsState] Track pods in a Set

parent 30d814c1
......@@ -202,7 +202,7 @@ module Pod
pods_state
else
state = SpecsState.new
state.added.concat(podfile.dependencies.map(&:name).uniq)
state.added.merge(podfile.dependencies.map(&:root_name))
state
end
end
......
......@@ -78,7 +78,7 @@ module Pod
state.add_name(name, pod_state(name))
end
else
state.added.concat(resolved_pods)
state.added.merge(resolved_pods)
end
state
end
......
require 'set'
module Pod
class Installer
class Analyzer
......@@ -17,10 +19,10 @@ module Pod
# (`:added`, `:removed`, `:changed` or `:unchanged`).
#
def initialize(pods_by_state = nil)
@added = []
@deleted = []
@changed = []
@unchanged = []
@added = Set.new
@deleted = Set.new
@changed = Set.new
@unchanged = Set.new
if pods_by_state
{
......@@ -36,19 +38,19 @@ module Pod
end
end
# @return [Array<String>] the names of the pods that were added.
# @return [Set<String>] the names of the pods that were added.
#
attr_accessor :added
# @return [Array<String>] the names of the pods that were changed.
# @return [Set<String>] the names of the pods that were changed.
#
attr_accessor :changed
# @return [Array<String>] the names of the pods that were deleted.
# @return [Set<String>] the names of the pods that were deleted.
#
attr_accessor :deleted
# @return [Array<String>] the names of the pods that were unchanged.
# @return [Set<String>] the names of the pods that were unchanged.
#
attr_accessor :unchanged
......
......@@ -22,12 +22,12 @@ module Pod
@analyzer.stubs(:sandbox_checksum).returns(@spec.checksum)
state = @analyzer.analyze
state.class.should == Installer::Analyzer::SpecsState
state.unchanged.should == ['BananaLib']
state.unchanged.should == Set.new(%w(BananaLib))
end
it 'marks all the pods as added if no sandbox manifest is available' do
@sandbox.stubs(:manifest)
@analyzer.analyze.added.should == ['BananaLib']
@analyzer.analyze.added.should == Set.new(%w(BananaLib))
end
end
......
......@@ -52,10 +52,10 @@ module Pod
it 'computes the state of the Podfile respect to the Lockfile' do
state = @analyzer.analyze.podfile_state
state.added.should == %w(AFNetworking libextobjc libextobjc)
state.changed.should == %w()
state.unchanged.should == %w(JSONKit SVPullToRefresh)
state.deleted.should == %w(NUI)
state.added.should == Set.new(%w(AFNetworking libextobjc libextobjc))
state.changed.should == Set.new(%w())
state.unchanged.should == Set.new(%w(JSONKit SVPullToRefresh))
state.deleted.should == Set.new(%w(NUI))
end
#--------------------------------------#
......
......@@ -396,7 +396,7 @@ module Pod
it 'analyzes the Podfile, the Lockfile and the Sandbox' do
@installer.send(:analyze)
@installer.analysis_result.sandbox_state.added.should == ['JSONKit']
@installer.analysis_result.sandbox_state.added.should == Set.new(%w(JSONKit))
end
it 'stores the targets created by the analyzer' 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