Commit a5b8aca1 authored by Eloy Durán's avatar Eloy Durán

[Analizer] Fix needs_install?

parent 371f7bae
...@@ -65,21 +65,22 @@ module Pod ...@@ -65,21 +65,22 @@ module Pod
# CocoaPods project is already up to date. # CocoaPods project is already up to date.
# #
def needs_install? def needs_install?
podfile_needs_install? || sandbox_needs_install? analysis_result = analyze(false)
podfile_needs_install?(analysis_result) || sandbox_needs_install?(analysis_result)
end end
# @return [Bool] Whether the podfile has changes respect to the lockfile. # @return [Bool] Whether the podfile has changes respect to the lockfile.
# #
def podfile_needs_install? def podfile_needs_install?(analysis_result)
state = generate_podfile_state state = analysis_result.podfile_state
needing_install = state.added + state.changed + state.deleted needing_install = state.added + state.changed + state.deleted
!needing_install.empty? !needing_install.empty?
end end
# @return [Bool] Whether the sandbox is in synch with the lockfile. # @return [Bool] Whether the sandbox is in synch with the lockfile.
# #
def sandbox_needs_install? def sandbox_needs_install?(analysis_result)
state = generate_sandbox_state state = analysis_result.sandbox_state
needing_install = state.added + state.changed + state.deleted needing_install = state.added + state.changed + state.deleted
!needing_install.empty? !needing_install.empty?
end end
......
...@@ -39,11 +39,13 @@ module Pod ...@@ -39,11 +39,13 @@ module Pod
end end
it "returns whether the Podfile has changes" do it "returns whether the Podfile has changes" do
@analyzer.podfile_needs_install?.should.be.true analysis_result = @analyzer.analyze(false)
@analyzer.podfile_needs_install?(analysis_result).should.be.true
end end
it "returns whether the sandbox is not in sync with the lockfile" do it "returns whether the sandbox is not in sync with the lockfile" do
@analyzer.sandbox_needs_install?.should.be.true analysis_result = @analyzer.analyze(false)
@analyzer.sandbox_needs_install?(analysis_result).should.be.true
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