Commit f6df6216 authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Minor clean-up

parent d08b7f95
...@@ -80,14 +80,14 @@ module Pod ...@@ -80,14 +80,14 @@ module Pod
# @return [void] # @return [void]
# #
def install! def install!
resolve_dependencies analyze_dependencies
download_dependencies download_sources
generate_pods_project generate_pods_project
write_lockfiles write_lockfiles
integrate_user_project if config.integrate_targets? integrate_user_project if config.integrate_targets?
end end
def resolve_dependencies def analyze_dependencies
UI.section "Analyzing dependencies" do UI.section "Analyzing dependencies" do
analyze analyze
prepare_for_legacy_compatibility prepare_for_legacy_compatibility
...@@ -95,7 +95,7 @@ module Pod ...@@ -95,7 +95,7 @@ module Pod
end end
end end
def download_dependencies def download_sources
UI.section "Downloading dependencies" do UI.section "Downloading dependencies" do
create_file_accessors create_file_accessors
install_pod_sources install_pod_sources
...@@ -193,9 +193,9 @@ module Pod ...@@ -193,9 +193,9 @@ module Pod
pod_target.build_headers.implode! pod_target.build_headers.implode!
end end
unless sandbox_state.deleted.empty? unless sandbox.state.deleted.empty?
title_options = { :verbose_prefix => "-> ".red } title_options = { :verbose_prefix => "-> ".red }
sandbox_state.deleted.each do |pod_name| sandbox.state.deleted.each do |pod_name|
UI.titled_section("Removing #{pod_name}".red, title_options) do UI.titled_section("Removing #{pod_name}".red, title_options) do
sandbox.clean_pod(pod_name) sandbox.clean_pod(pod_name)
end end
...@@ -227,7 +227,7 @@ module Pod ...@@ -227,7 +227,7 @@ module Pod
# #
def install_pod_sources def install_pod_sources
@installed_specs = [] @installed_specs = []
pods_to_install = sandbox_state.added | sandbox_state.changed pods_to_install = sandbox.state.added | sandbox.state.changed
title_options = { :verbose_prefix => "-> ".green } title_options = { :verbose_prefix => "-> ".green }
root_specs.sort_by(&:name).each do |spec| root_specs.sort_by(&:name).each do |spec|
if pods_to_install.include?(spec.name) if pods_to_install.include?(spec.name)
...@@ -570,12 +570,6 @@ module Pod ...@@ -570,12 +570,6 @@ module Pod
analysis_result.specifications.map { |spec| spec.root }.uniq analysis_result.specifications.map { |spec| spec.root }.uniq
end end
# @return [SpecsState] The state of the sandbox returned by the analyzer.
#
def sandbox_state
analysis_result.sandbox_state
end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
end end
......
...@@ -38,15 +38,15 @@ module Pod ...@@ -38,15 +38,15 @@ module Pod
describe "In general" do describe "In general" do
before do before do
@installer.stubs(:resolve_dependencies) @installer.stubs(:analyze_dependencies)
@installer.stubs(:download_dependencies) @installer.stubs(:download_sources)
@installer.stubs(:generate_pods_project) @installer.stubs(:generate_pods_project)
@installer.stubs(:write_lockfiles) @installer.stubs(:write_lockfiles)
@installer.stubs(:integrate_user_project) @installer.stubs(:integrate_user_project)
end end
it "in runs the pre-install hooks before cleaning the Pod sources" do it "in runs the pre-install hooks before cleaning the Pod sources" do
@installer.unstub(:download_dependencies) @installer.unstub(:download_sources)
@installer.stubs(:create_file_accessors) @installer.stubs(:create_file_accessors)
@installer.stubs(:install_pod_sources) @installer.stubs(:install_pod_sources)
@installer.stubs(:link_headers) @installer.stubs(:link_headers)
...@@ -75,7 +75,7 @@ module Pod ...@@ -75,7 +75,7 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "#resolve_dependencies" do describe "#analyze_dependencies" do
describe "#analyze" do describe "#analyze" do
...@@ -87,7 +87,7 @@ module Pod ...@@ -87,7 +87,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"] config.sandbox.state.added.should == ["JSONKit"]
end end
it "stores the targets created by the analyzer" do it "stores the targets created by the analyzer" do
...@@ -113,7 +113,7 @@ module Pod ...@@ -113,7 +113,7 @@ module Pod
before do before do
@analysis_result = Installer::Analyzer::AnalysisResult.new @analysis_result = Installer::Analyzer::AnalysisResult.new
@analysis_result.specifications = [] @analysis_result.specifications = []
@analysis_result.sandbox_state = Installer::Analyzer::SpecsState.new() config.sandbox.state = Installer::Analyzer::SpecsState.new()
@pod_targets = [PodTarget.new([], nil, config.sandbox)] @pod_targets = [PodTarget.new([], nil, config.sandbox)]
@installer.stubs(:analysis_result).returns(@analysis_result) @installer.stubs(:analysis_result).returns(@analysis_result)
@installer.stubs(:pod_targets).returns(@pod_targets) @installer.stubs(:pod_targets).returns(@pod_targets)
...@@ -128,7 +128,7 @@ module Pod ...@@ -128,7 +128,7 @@ module Pod
end end
it "deletes the sources of the removed Pods" do it "deletes the sources of the removed Pods" do
@analysis_result.sandbox_state.add_name('Deleted-Pod', :deleted) config.sandbox.state.add_name('Deleted-Pod', :deleted)
config.sandbox.expects(:clean_pod).with('Deleted-Pod') config.sandbox.expects(:clean_pod).with('Deleted-Pod')
@installer.send(:clean_sandbox) @installer.send(:clean_sandbox)
end end
...@@ -139,7 +139,7 @@ module Pod ...@@ -139,7 +139,7 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "#download_dependencies" do describe "#download_sources" do
describe "#install_pod_sources" do describe "#install_pod_sources" do
...@@ -148,10 +148,9 @@ module Pod ...@@ -148,10 +148,9 @@ module Pod
spec_2 = Spec.new spec_2 = Spec.new
spec_2.name = 'RestKit' spec_2.name = 'RestKit'
@installer.stubs(:root_specs).returns([spec, spec_2]) @installer.stubs(:root_specs).returns([spec, spec_2])
sandbox_state = Installer::Analyzer::SpecsState.new config.sandbox.state = Installer::Analyzer::SpecsState.new
sandbox_state.added << 'BananaLib' config.sandbox.state.added << 'BananaLib'
sandbox_state.changed << 'RestKit' config.sandbox.state.changed << 'RestKit'
@installer.stubs(:sandbox_state).returns(sandbox_state)
@installer.expects(:install_source_of_pod).with('BananaLib') @installer.expects(:install_source_of_pod).with('BananaLib')
@installer.expects(:install_source_of_pod).with('RestKit') @installer.expects(:install_source_of_pod).with('RestKit')
@installer.send(:install_pod_sources) @installer.send(:install_pod_sources)
......
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