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
end
analyzer = Analyzer.new(sandbox, podfile, lockfile)
analyzer.update_mode = update
analyzer.update = update
@analysis_result = analyzer.analyze
@aggregate_targets = analyzer.result.targets
end
......
......@@ -33,7 +33,7 @@ module Pod
@podfile = podfile
@lockfile = lockfile
@update_mode = false
@update = false
@allow_pre_downloads = true
@archs_by_target_def = {}
end
......@@ -91,11 +91,17 @@ module Pod
# @!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
# change in the Podfile should be locked.
#
attr_accessor :update_mode
alias_method :update_mode?, :update_mode
def update_mode?
!!update
end
# @return [Bool] Whether the analysis allows pre-downloads and thus
# modifications to the sandbox.
......@@ -316,7 +322,7 @@ module Pod
def generate_sandbox_state
sandbox_state = nil
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.print
end
......
......@@ -95,14 +95,14 @@ module Pod
it "considers changed a Pod whose specification is in head mode if in update mode" do
@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
end
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)
@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
end
......
......@@ -117,7 +117,7 @@ module Pod
end
it "does not lock the dependencies in update mode" do
@analyzer.update_mode = true
@analyzer.update = true
@analyzer.analyze
@analyzer.send(:locked_dependencies).map(&:to_s).should == []
end
......
......@@ -114,7 +114,7 @@ module Pod
it "configures the analyzer to use update mode if appropriate" do
@installer.update = true
Installer::Analyzer.any_instance.expects(:update_mode=).with(true)
Installer::Analyzer.any_instance.expects(:update=).with(true)
@installer.send(:analyze)
@installer.aggregate_targets.map(&:name).sort.should == ['Pods']
@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