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

[SpecsState] Track pods in a Set

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