Commit 940f7019 authored by Samuel Giddins's avatar Samuel Giddins

[Installer] Fully deintegrate on major version change

parent 0ffb7a6b
...@@ -40,6 +40,7 @@ module Pod ...@@ -40,6 +40,7 @@ module Pod
autoload :AggregateTarget, 'cocoapods/target/aggregate_target' autoload :AggregateTarget, 'cocoapods/target/aggregate_target'
autoload :Command, 'cocoapods/command' autoload :Command, 'cocoapods/command'
autoload :Deintegrator, 'cocoapods_deintegrate'
autoload :Executable, 'cocoapods/executable' autoload :Executable, 'cocoapods/executable'
autoload :ExternalSources, 'cocoapods/external_sources' autoload :ExternalSources, 'cocoapods/external_sources'
autoload :Installer, 'cocoapods/installer' autoload :Installer, 'cocoapods/installer'
......
...@@ -121,6 +121,7 @@ module Pod ...@@ -121,6 +121,7 @@ module Pod
raise Informative, message raise Informative, message
end end
UI.message 'Preparing' do UI.message 'Preparing' do
deintegrate_if_different_major_version
sandbox.prepare sandbox.prepare
ensure_plugins_are_installed! ensure_plugins_are_installed!
Migrator.migrate(sandbox) Migrator.migrate(sandbox)
...@@ -486,6 +487,25 @@ module Pod ...@@ -486,6 +487,25 @@ module Pod
context.sources context.sources
end end
# Run the deintegrator against all projects in the installation root if the
# current CocoaPods major version part is different than the one in the
# lockfile.
#
# @return [void]
#
def deintegrate_if_different_major_version
return unless config.lockfile
return if config.lockfile.cocoapods_version.major == Version.new(VERSION).major
UI.section('Fully deintegrating due to major version update') do
projects = Pathname.glob(config.installation_root + '*.xcodeproj').map { |path| Xcodeproj::Project.open(path) }
deintegrator = Deintegrator.new
projects.sort.each do |project|
deintegrator.deintegrate_project(project)
project.save if project.dirty?
end
end
end
# Ensures that all plugins specified in the {#podfile} are loaded. # Ensures that all plugins specified in the {#podfile} are loaded.
# #
# @return [void] # @return [void]
......
...@@ -5,8 +5,6 @@ require 'active_support/core_ext/string/inflections' ...@@ -5,8 +5,6 @@ require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/array/conversions' require 'active_support/core_ext/array/conversions'
module Pod module Pod
autoload :Deintegrator, 'cocoapods_deintegrate'
class Installer class Installer
# The {UserProjectIntegrator} integrates the libraries generated by # The {UserProjectIntegrator} integrates the libraries generated by
# TargetDefinitions of the {Podfile} with their correspondent user # TargetDefinitions of the {Podfile} with their correspondent user
......
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