Commit 6091ea45 authored by Marius Rackwitz's avatar Marius Rackwitz

Refactoring: Replaced Installer::Analyzer's getter and setter update_mode by…

Refactoring: Replaced Installer::Analyzer's getter and setter update_mode by #update, #update= and #update_mode?
parent cb8a748f
...@@ -170,7 +170,7 @@ module Pod ...@@ -170,7 +170,7 @@ module Pod
end end
analyzer = Analyzer.new(sandbox, podfile, lockfile) analyzer = Analyzer.new(sandbox, podfile, lockfile)
analyzer.update_mode = update analyzer.update = update
@analysis_result = analyzer.analyze @analysis_result = analyzer.analyze
@aggregate_targets = analyzer.result.targets @aggregate_targets = analyzer.result.targets
end end
......
...@@ -33,7 +33,7 @@ module Pod ...@@ -33,7 +33,7 @@ module Pod
@podfile = podfile @podfile = podfile
@lockfile = lockfile @lockfile = lockfile
@update_mode = false @update = false
@allow_pre_downloads = true @allow_pre_downloads = true
@archs_by_target_def = {} @archs_by_target_def = {}
end end
...@@ -91,11 +91,17 @@ module Pod ...@@ -91,11 +91,17 @@ module Pod
# @!group Configuration # @!group Configuration
# @return [Hash, Boolean, nil] Pods that have been requested to be
# updated or true if all Pods should be updated
#
attr_accessor :update
# @return [Bool] Whether the version of the dependencies which did non # @return [Bool] Whether the version of the dependencies which did non
# change in the Podfile should be locked. # change in the Podfile should be locked.
# #
attr_accessor :update_mode def update_mode?
alias_method :update_mode?, :update_mode !!update
end
# @return [Bool] Whether the analysis allows pre-downloads and thus # @return [Bool] Whether the analysis allows pre-downloads and thus
# modifications to the sandbox. # modifications to the sandbox.
...@@ -316,7 +322,7 @@ module Pod ...@@ -316,7 +322,7 @@ module Pod
def generate_sandbox_state def generate_sandbox_state
sandbox_state = nil sandbox_state = nil
UI.section "Comparing resolved specification to the sandbox manifest" do UI.section "Comparing resolved specification to the sandbox manifest" do
sandbox_analyzer = SandboxAnalyzer.new(sandbox, result.specifications, update_mode, lockfile) sandbox_analyzer = SandboxAnalyzer.new(sandbox, result.specifications, update_mode?, lockfile)
sandbox_state = sandbox_analyzer.analyze sandbox_state = sandbox_analyzer.analyze
sandbox_state.print sandbox_state.print
end end
......
...@@ -95,14 +95,14 @@ module Pod ...@@ -95,14 +95,14 @@ module Pod
it "considers changed a Pod whose specification is in head mode if in update mode" do it "considers changed a Pod whose specification is in head mode if in update mode" do
@sandbox.stubs(:head_pod?).returns(true) @sandbox.stubs(:head_pod?).returns(true)
@analyzer.stubs(:update_mode).returns(true) @analyzer.stubs(:update_mode?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true @analyzer.send(:pod_changed?, 'BananaLib').should == true
end end
it "doesn't consider changed a Pod whose specification is in head mode if not in update mode" do it "doesn't consider changed a Pod whose specification is in head mode if not in update mode" do
@sandbox.stubs(:head_pod?).returns(true) @sandbox.stubs(:head_pod?).returns(true)
@analyzer.stubs(:sandbox_head_version?).returns(true) @analyzer.stubs(:sandbox_head_version?).returns(true)
@analyzer.stubs(:update_mode).returns(false) @analyzer.stubs(:update_mode?).returns(false)
@analyzer.send(:pod_changed?, 'BananaLib').should == false @analyzer.send(:pod_changed?, 'BananaLib').should == false
end end
......
...@@ -117,7 +117,7 @@ module Pod ...@@ -117,7 +117,7 @@ module Pod
end end
it "does not lock the dependencies in update mode" do it "does not lock the dependencies in update mode" do
@analyzer.update_mode = true @analyzer.update = true
@analyzer.analyze @analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:to_s).should == [] @analyzer.send(:locked_dependencies).map(&:to_s).should == []
end end
......
...@@ -114,7 +114,7 @@ module Pod ...@@ -114,7 +114,7 @@ module Pod
it "configures the analyzer to use update mode if appropriate" do it "configures the analyzer to use update mode if appropriate" do
@installer.update = true @installer.update = true
Installer::Analyzer.any_instance.expects(:update_mode=).with(true) Installer::Analyzer.any_instance.expects(:update=).with(true)
@installer.send(:analyze) @installer.send(:analyze)
@installer.aggregate_targets.map(&:name).sort.should == ['Pods'] @installer.aggregate_targets.map(&:name).sort.should == ['Pods']
@installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit'] @installer.pod_targets.map(&:name).sort.should == ['Pods-JSONKit']
......
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