From 2f294634bb858eae2aa668e8d5507a3b8d15f3ef Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Sat, 26 Nov 2011 14:38:36 +0100 Subject: [PATCH] Remove Specification#install! and perform that work from Installer. --- lib/cocoapods/installer.rb | 13 +++++++++++- lib/cocoapods/specification.rb | 38 +++++++--------------------------- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/lib/cocoapods/installer.rb b/lib/cocoapods/installer.rb index 8e2d7000ea..05d5123b4e 100644 --- a/lib/cocoapods/installer.rb +++ b/lib/cocoapods/installer.rb @@ -182,9 +182,20 @@ def target_installers end.compact end + def install_dependencies! + build_specifications.each do |spec| + if spec.pod_destroot.exist? + puts "Using #{spec}" unless config.silent? + else + puts "Installing #{spec}" unless config.silent? + spec.download! + end + end + end + def install! puts "Installing dependencies of: #{@podfile.defined_in_file}" unless config.silent? - build_specifications.each(&:install!) + install_dependencies! root = config.project_pods_root puts "==> Generating support files" unless config.silent? diff --git a/lib/cocoapods/specification.rb b/lib/cocoapods/specification.rb index ca7f3091b6..c8d4fef12e 100644 --- a/lib/cocoapods/specification.rb +++ b/lib/cocoapods/specification.rb @@ -333,34 +333,6 @@ def validate! # Install and download hooks - # Override this if you need to perform work before or after activating the - # pod. Eg: - # - # Pod::Spec.new do |s| - # def s.install! - # # pre-install - # super - # # post-install - # end - # end - # - # TODO Do we really need this now that we don’t install the podspec files anymore? - def install! - puts "==> Installing: #{self}" unless config.silent? - # In case this spec is part of another pod's source, we need to dowload - # the other pod's source. - (part_of_specification || self).download_if_necessary! - end - - def download_if_necessary! - if pod_destroot.exist? - puts " * Skipping download of #{self}, pod already downloaded" unless config.silent? - else - puts " * Downloading: #{self}" unless config.silent? - download! - end - end - # Downloads the source of the pod and places it in the project's pods # directory. # @@ -375,9 +347,13 @@ def download_if_necessary! # end # end def download! - downloader = Downloader.for_source(pod_destroot, source) - downloader.download - downloader.clean(expanded_clean_paths) if config.clean + if spec = part_of_specification + spec.download! + else + downloader = Downloader.for_source(pod_destroot, source) + downloader.download + downloader.clean(expanded_clean_paths) if config.clean + end end # This is a convenience method which gets called after all pods have been