Commit 4c6ecd43 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4544 from CocoaPods/seg-properly-integrate-all-targets

Ensure all user projects are properly integrated
parents 08bd4c95 d14f40f5
......@@ -89,6 +89,18 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins)
[#3347](https://github.com/CocoaPods/CocoaPods/issues/3347)
* Targets that are no longer integrated with CocoaPods will be properly
de-integrated when installation occurs.
[Samuel Giddins](https://github.com/segiddins)
* Targets that are integrated will be ensured that they have all
CocoaPods-related settings and phases properly installed.
[Samuel Giddins](https://github.com/segiddins)
* Total de-integration will happen whenever the major version of CocoaPods
changes, ensuring backwards-incompatible changes are properly applied.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes
* Fix compiling of asset catalog files inside resource bundles.
......@@ -158,6 +170,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Samuel Giddins](https://github.com/segiddins)
[#4521](https://github.com/CocoaPods/CocoaPods/issues/4521)
* Changing the name of a target in a Podfile will no longer cause warnings about
being unable to set the base configuration XCConfig.
[Samuel Giddins](https://github.com/segiddins)
## 0.39.0 (2015-10-09)
......
......@@ -16,16 +16,17 @@ gemspec
gem 'json', :git => 'https://github.com/segiddins/json.git', :branch => 'seg-1.7.7-ruby-2.2'
group :development do
cp_gem 'claide', 'CLAide'
cp_gem 'cocoapods-core', 'Core'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
cp_gem 'cocoapods-search', 'cocoapods-search'
cp_gem 'cocoapods-stats', 'cocoapods-stats'
cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'molinillo', 'Molinillo'
cp_gem 'xcodeproj', 'Xcodeproj'
cp_gem 'claide', 'CLAide'
cp_gem 'cocoapods-core', 'Core'
cp_gem 'cocoapods-deintegrate', 'cocoapods-deintegrate'
cp_gem 'cocoapods-downloader', 'cocoapods-downloader'
cp_gem 'cocoapods-plugins', 'cocoapods-plugins'
cp_gem 'cocoapods-search', 'cocoapods-search'
cp_gem 'cocoapods-stats', 'cocoapods-stats'
cp_gem 'cocoapods-trunk', 'cocoapods-trunk'
cp_gem 'cocoapods-try', 'cocoapods-try'
cp_gem 'molinillo', 'Molinillo'
cp_gem 'xcodeproj', 'Xcodeproj'
gem 'cocoapods-dependencies'
......
GIT
remote: https://github.com/CocoaPods/CLAide.git
revision: b44534d04023fbe82182a8be33d5c728f74c1b9c
revision: 4ded02e52c34d5bbe5f6f031d917394286445aa6
branch: master
specs:
claide (0.9.1)
......@@ -24,7 +24,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: ad8f6b78e424c274b63ff42ff6ad72840cb307a6
revision: eea8f8d58eef635f2cc9121ee1af6a5478a2841c
branch: master
specs:
xcodeproj (0.28.2)
......@@ -32,6 +32,13 @@ GIT
claide (~> 0.9.1)
colored (~> 1.2)
GIT
remote: https://github.com/CocoaPods/cocoapods-deintegrate.git
revision: 7fa96ce9ccd9bda7e289a485111649f842189df6
branch: master
specs:
cocoapods-deintegrate (0.2.1)
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: b35c7514683d8a5e3118d5333c15f941d40004fd
......@@ -91,6 +98,7 @@ PATH
activesupport (>= 4.0.2)
claide (~> 0.9.1)
cocoapods-core (= 0.39.0)
cocoapods-deintegrate (~> 0.2.1)
cocoapods-downloader (~> 0.9.3)
cocoapods-plugins (~> 0.4.2)
cocoapods-search (~> 0.1.0)
......@@ -146,7 +154,7 @@ GEM
rb-kqueue (>= 0.2)
metaclass (0.0.4)
method_source (0.8.2)
minitest (5.8.2)
minitest (5.8.3)
mocha (1.1.0)
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.2)
......@@ -204,6 +212,7 @@ DEPENDENCIES
clintegracon
cocoapods!
cocoapods-core!
cocoapods-deintegrate!
cocoapods-dependencies
cocoapods-downloader!
cocoapods-plugins!
......
......@@ -27,16 +27,18 @@ Gem::Specification.new do |s|
s.require_paths = %w{ lib }
# Link with the version of CocoaPods-Core
s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}"
s.add_runtime_dependency 'claide', '~> 0.9.1'
s.add_runtime_dependency 'xcodeproj', '~> 0.28.2'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.9.3'
s.add_runtime_dependency 'cocoapods-plugins', '~> 0.4.2'
s.add_runtime_dependency 'cocoapods-search', '~> 0.1.0'
s.add_runtime_dependency 'cocoapods-stats', '~> 0.6.2'
s.add_runtime_dependency 'cocoapods-try', '~> 0.5.1'
s.add_runtime_dependency 'cocoapods-trunk', '~> 0.6.4'
s.add_runtime_dependency 'molinillo', '~> 0.4.0'
s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}"
s.add_runtime_dependency 'claide', '~> 0.9.1'
s.add_runtime_dependency 'cocoapods-deintegrate', '~> 0.2.1'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.9.3'
s.add_runtime_dependency 'cocoapods-plugins', '~> 0.4.2'
s.add_runtime_dependency 'cocoapods-search', '~> 0.1.0'
s.add_runtime_dependency 'cocoapods-stats', '~> 0.6.2'
s.add_runtime_dependency 'cocoapods-trunk', '~> 0.6.4'
s.add_runtime_dependency 'cocoapods-try', '~> 0.5.1'
s.add_runtime_dependency 'molinillo', '~> 0.4.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.28.2'
s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4'
......
......@@ -40,6 +40,7 @@ module Pod
autoload :AggregateTarget, 'cocoapods/target/aggregate_target'
autoload :Command, 'cocoapods/command'
autoload :Deintegrator, 'cocoapods_deintegrate'
autoload :Executable, 'cocoapods/executable'
autoload :ExternalSources, 'cocoapods/external_sources'
autoload :Installer, 'cocoapods/installer'
......
......@@ -121,6 +121,7 @@ module Pod
raise Informative, message
end
UI.message 'Preparing' do
deintegrate_if_different_major_version
sandbox.prepare
ensure_plugins_are_installed!
Migrator.migrate(sandbox)
......@@ -486,6 +487,25 @@ module Pod
context.sources
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 lockfile
return if lockfile.cocoapods_version.major == Version.create(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.
#
# @return [void]
......
......@@ -63,6 +63,7 @@ module Pod
integrate_user_targets
warn_about_empty_podfile
warn_about_xcconfig_overrides
save_projects
end
#-----------------------------------------------------------------------#
......@@ -112,8 +113,42 @@ module Pod
# @return [void]
#
def integrate_user_targets
targets_to_integrate.sort_by(&:name).each do |target|
TargetIntegrator.new(target).integrate!
target_integrators = targets_to_integrate.sort_by(&:name).map do |target|
TargetIntegrator.new(target)
end
Config.instance.with_changes(:silent => true) do
deintegrator = Deintegrator.new
all_project_targets = user_projects.flat_map(&:native_targets).uniq
all_native_targets = targets_to_integrate.flat_map(&:user_targets).uniq
targets_to_deintegrate = all_project_targets - all_native_targets
targets_to_deintegrate.each do |target|
deintegrator.deintegrate_target(target)
end
end
target_integrators.each(&:integrate!)
end
# Save all user projects.
#
# @return [void]
#
def save_projects
user_projects.each do |project|
if project.dirty?
project.save
else
# There is a bug in Xcode where the process of deleting and
# re-creating the xcconfig files used in the build
# configuration cause building the user project to fail until
# Xcode is relaunched.
#
# Touching/saving the project causes Xcode to reload these.
#
# https://github.com/CocoaPods/CocoaPods/issues/2665
FileUtils.touch(project.path + 'project.pbxproj')
end
end
end
......@@ -194,6 +229,10 @@ module Pod
targets.map(&:user_project_path).compact.uniq
end
def user_projects
targets.map(&:user_project).compact.uniq
end
def targets_to_integrate
targets.reject { |target| target.target_definition.empty? }
end
......
......@@ -38,34 +38,15 @@ module Pod
#
def integrate!
UI.section(integration_message) do
# TODO: refactor into Xcodeproj https://github.com/CocoaPods/Xcodeproj/issues/202
project_is_dirty = [
XCConfigIntegrator.integrate(target, native_targets),
update_to_cocoapods_0_34,
update_to_cocoapods_0_37_1,
update_to_cocoapods_0_39,
unless native_targets_to_integrate.empty?
add_pods_library
add_embed_frameworks_script_phase
add_copy_resources_script_phase
add_check_manifest_lock_script_phase
true
end,
].any?
if project_is_dirty
user_project.save
else
# There is a bug in Xcode where the process of deleting and
# re-creating the xcconfig files used in the build
# configuration cause building the user project to fail until
# Xcode is relaunched.
#
# Touching/saving the project causes Xcode to reload these.
#
# https://github.com/CocoaPods/CocoaPods/issues/2665
FileUtils.touch(user_project.path + 'project.pbxproj')
end
XCConfigIntegrator.integrate(target, native_targets)
update_to_cocoapods_0_34
update_to_cocoapods_0_37_1
update_to_cocoapods_0_39
add_pods_library
add_embed_frameworks_script_phase
add_copy_resources_script_phase
add_check_manifest_lock_script_phase
end
end
......@@ -95,14 +76,11 @@ module Pod
script_path = target.copy_resources_script_relative_path
shell_script = %("#{script_path}"\n)
changes = false
phases.each do |phase|
unless phase.shell_script == shell_script
phase.shell_script = shell_script
changes = true
end
end
changes
end
# Removes the embed frameworks phase for target types.
......@@ -122,21 +100,15 @@ module Pod
# Adds the embed frameworks script when integrating as a static library.
#
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_39
targets_to_embed = native_targets.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
requires_update = targets_to_embed.any? do |target|
!target.shell_script_build_phases.find { |bp| bp.name == EMBED_FRAMEWORK_PHASE_NAME }
end
if requires_update
targets_to_embed.each do |native_target|
add_embed_frameworks_script_phase_to_target(native_target)
end
targets_to_embed.each do |native_target|
add_embed_frameworks_script_phase_to_target(native_target)
end
frameworks = user_project.frameworks_group
......@@ -151,12 +123,9 @@ module Pod
build_file.settings['ATTRIBUTES'].is_a?(Array) &&
build_file.settings['ATTRIBUTES'].include?('Weak')
build_file.settings = nil
requires_update = true
end
end
end
requires_update
end
# Adds spec product reference to the frameworks build phase of the
......@@ -168,7 +137,7 @@ module Pod
#
def add_pods_library
frameworks = user_project.frameworks_group
native_targets_to_integrate.each do |native_target|
native_targets.each do |native_target|
build_phase = native_target.frameworks_build_phase
# Find and delete possible reference for the other product type
......@@ -209,13 +178,10 @@ module Pod
#
# @param [PBXNativeTarget] native_target
#
# @return [Bool] whether any changes to the project were made.
#
def remove_embed_frameworks_script_phase(native_target)
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name == EMBED_FRAMEWORK_PHASE_NAME }
return false unless embed_build_phase.present?
return unless embed_build_phase.present?
native_target.build_phases.delete(embed_build_phase)
true
end
# Adds a shell script build phase responsible to copy the resources
......@@ -226,7 +192,7 @@ module Pod
#
def add_copy_resources_script_phase
phase_name = 'Copy Pods Resources'
native_targets_to_integrate.each do |native_target|
native_targets.each do |native_target|
phase = create_or_update_build_phase(native_target, phase_name)
script_path = target.copy_resources_script_relative_path
phase.shell_script = %("#{script_path}"\n)
......@@ -244,9 +210,9 @@ module Pod
#
def add_check_manifest_lock_script_phase
phase_name = 'Check Pods Manifest.lock'
native_targets_to_integrate.each do |native_target|
native_targets.each do |native_target|
phase = create_or_update_build_phase(native_target, phase_name)
native_target.build_phases.unshift(phase).uniq!
native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase
phase.shell_script = <<-SH.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
......@@ -261,7 +227,7 @@ module Pod
private
# @!group Private helpers
# @!group Private Helpers
#---------------------------------------------------------------------#
# @return [Array<PBXNativeTarget>] The list of all the targets that
......@@ -276,29 +242,11 @@ module Pod
# directory / product bundle.
#
def native_targets_to_embed_in
native_targets_to_integrate.select do |target|
native_targets.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
end
# @return [Array<PBXNativeTarget>] The list of the targets
# that have not been integrated by past installations
# of
#
def native_targets_to_integrate
unless @native_targets_to_integrate
@native_targets_to_integrate = native_targets.reject do |native_target|
native_target.frameworks_build_phase.files.any? do |build_file|
file_ref = build_file.file_ref
file_ref &&
file_ref.isa == 'PBXFileReference' &&
file_ref.display_name == target.product_name
end
end
end
@native_targets_to_integrate
end
# Read the project from the disk to ensure that it is up to date as
# other TargetIntegrators might have modified it.
#
......
......@@ -15,17 +15,13 @@ module Pod
# The native targets associated which should be integrated
# with the Pod bundle.
#
# @return [Bool] whether any changes to the project were made.
#
def self.integrate(pod_bundle, targets)
changes = false
targets.each do |target|
target.build_configurations.each do |config|
changes = true if update_to_cocoapods_0_34(pod_bundle, targets)
changes = true if set_target_xcconfig(pod_bundle, target, config)
update_to_cocoapods_0_34(pod_bundle, targets)
set_target_xcconfig(pod_bundle, target, config)
end
end
changes
end
private
......@@ -42,13 +38,10 @@ module Pod
# @param [Array<XcodeProj::PBXNativeTarget>] targets
# The native targets.
#
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0
#
def self.update_to_cocoapods_0_34(pod_bundle, targets)
sandbox = pod_bundle.sandbox
changes = false
targets.map(&:project).uniq.each do |project|
file_refs = project.files.select do |file_ref|
path = file_ref.path.to_s
......@@ -64,10 +57,7 @@ module Pod
file_ref.remove_from_project
end
end
changes = true unless file_refs.empty?
end
changes
end
# Creates a file reference to the xcconfig generated by
......@@ -83,15 +73,21 @@ module Pod
# @param [Xcodeproj::XCBuildConfiguration] config
# The build configuration.
#
# @return [Boolean] Indicates whether or not any changes were made.
#
def self.set_target_xcconfig(pod_bundle, target, config)
path = pod_bundle.xcconfig_relative_path(config.name)
group = config.project['Pods'] || config.project.new_group('Pods')
file_ref = group.files.find { |f| f.path == path }
if config.base_configuration_reference &&
config.base_configuration_reference != file_ref
unless xcconfig_includes_target_xcconfig?(config.base_configuration_reference, path)
existing = config.base_configuration_reference
set_base_configuration_reference = ->() do
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref
end
if existing && existing != file_ref
if existing.real_path.to_path.start_with?(pod_bundle.support_files_dir.to_path)
set_base_configuration_reference.call
elsif !xcconfig_includes_target_xcconfig?(config.base_configuration_reference, path)
UI.warn 'CocoaPods did not set the base configuration of your ' \
'project because your project already has a custom ' \
'config set. In order for CocoaPods integration to work at ' \
......@@ -100,11 +96,8 @@ module Pod
'build configuration.'
end
elsif config.base_configuration_reference.nil? || file_ref.nil?
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref
return true
set_base_configuration_reference.call
end
false
end
private
......
Subproject commit 071e796206f4908dd57d06db496560d667c4020f
Subproject commit 1ff4805c0df0187dd08ad1c61dfcbeee46631cd7
......@@ -5,7 +5,7 @@ module Pod
before do
project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
@project = Xcodeproj::Project.open(project_path)
Xcodeproj::Project.new(config.sandbox.project_path).save
Project.new(config.sandbox.project_path).save
@target = @project.targets.first
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target_definition.link_with_first_target = true
......@@ -105,5 +105,20 @@ module Pod
UI.warnings.should.not.match /not set.*base configuration/
end
it 'handles when xcconfig is set to another sandbox xcconfig' do
group = @project.new_group('Pods')
old_config = group.new_file('../Pods/Target Support Files/Pods/SampleConfig.xcconfig')
@target.build_configurations.each do |config|
config.base_configuration_reference = old_config
end
XCConfigIntegrator.integrate(@pod_bundle, [@target])
@target.build_configurations.each do |config|
config.base_configuration_reference.should.not == old_config
config.base_configuration_reference.path.should == @pod_bundle.xcconfig_relative_path(config.name)
end
UI.warnings.should.be.empty
end
end
end
......@@ -36,7 +36,6 @@ module Pod
end
it 'allows the xcconfig integrator to edit already integrated targets if needed' do
@target_integrator.stubs(:native_targets_to_integrate).returns([])
TargetIntegrator::XCConfigIntegrator.expects(:integrate).with(@pod_bundle, [@target])
@target_integrator.integrate!
end
......@@ -123,11 +122,10 @@ module Pod
it 'does not perform the integration if there are no targets to integrate' do
Installer::UserProjectIntegrator::TargetIntegrator::XCConfigIntegrator.
integrate(@pod_bundle, @target_integrator.send(:native_targets))
@target_integrator.stubs(:native_targets_to_integrate).returns([])
@target_integrator.expects(:add_pods_library).never
@target_integrator.expects(:add_copy_resources_script_phase).never
@target_integrator.send(:user_project).expects(:save).never
@target_integrator.stubs(:native_targets).returns([])
frameworks = @target_integrator.send(:user_project).frameworks_group.children
@target_integrator.integrate!
@target_integrator.send(:user_project).frameworks_group.children.should == frameworks
end
it 'adds an embed frameworks build phase if frameworks are used' do
......@@ -204,14 +202,7 @@ module Pod
describe 'Private helpers' do
it 'returns the native targets associated with the Pod bundle' do
@target_integrator.send(:native_targets).map(&:name).should == %w( SampleProject )
end
it 'returns the targets that need to be integrated' do
pods_library = @project.frameworks_group.new_product_ref_for_target('Pods', :static_library)
@target.frameworks_build_phase.add_file_reference(pods_library)
@project.save
@target_integrator.send(:native_targets_to_integrate).map(&:name).should.be.empty
@target_integrator.send(:native_targets).map(&:name).should == %w( SampleProject )
end
it 'is robust against other types of references in the build files of the frameworks build phase' do
......
......@@ -14,10 +14,10 @@ module Pod
end
end
config.sandbox.project = Project.new(config.sandbox.project_path)
Xcodeproj::Project.new(config.sandbox.project_path).save
config.sandbox.project.save
@target = AggregateTarget.new(@podfile.target_definitions['Pods'], config.sandbox)
@target.client_root = sample_project_path.dirname
@target.user_project = Xcodeproj::Project.open(@sample_project_path)
@target.user_project = Xcodeproj::Project.open(@sample_project_path)
@target.user_target_uuids = ['A346496C14F9BE9A0080D870']
empty_library = AggregateTarget.new(@podfile.target_definitions[:empty], config.sandbox)
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target, empty_library])
......@@ -52,6 +52,19 @@ module Pod
UI.warnings.should.include?('The Podfile does not contain any dependencies')
end
it 'deintegrates targets that are not associated with the podfile' do
additional_project = Xcodeproj::Project.new('Project.xcodeproj')
Deintegrator.any_instance.expects(:deintegrate_target).with additional_project.new_target(:application, 'Other App', :ios)
user_project = @target.user_project
user_project.native_targets.each do |target|
next if target.name == 'SampleProject'
Deintegrator.any_instance.expects(:deintegrate_target).with(target)
end
@integrator.stubs(:user_projects).returns([additional_project, user_project])
@integrator.send(:integrate_user_targets)
end
describe '#warn_about_xcconfig_overrides' do
shared 'warn_about_xcconfig_overrides' do
target_config = stub(:name => 'Release', :build_settings => @user_target_build_settings)
......@@ -192,6 +205,30 @@ module Pod
@integrator.targets.map(&:name).should == ['Pods', 'Pods-empty']
@integrator.send(:targets_to_integrate).map(&:name).should == ['Pods']
end
it 'skips saving projects that are not dirtied (but touches them instead)' do
project = mock('Project')
project.stubs(:path).returns(Pathname('project.xcodeproj'))
project.expects(:dirty?).returns(false)
project.expects(:save).never
@integrator.stubs(:user_projects).returns([project])
FileUtils.expects(:touch).with(project.path + 'project.pbxproj')
@integrator.send(:save_projects)
end
it 'saves projects that are dirty' do
project = mock('Project')
project.stubs(:path).returns(Pathname('project.xcodeproj'))
project.expects(:dirty?).returns(true)
project.expects(:save).once
@integrator.stubs(:user_projects).returns([project])
FileUtils.expects(:touch).never
@integrator.send(:save_projects)
end
end
#-----------------------------------------------------------------------#
......
......@@ -4,12 +4,12 @@ require 'cocoapods_stats/sender'
# @return [Lockfile]
#
def generate_lockfile
def generate_lockfile(lockfile_version: Pod::VERSION)
hash = {}
hash['PODS'] = []
hash['DEPENDENCIES'] = []
hash['SPEC CHECKSUMS'] = []
hash['COCOAPODS'] = Pod::VERSION
hash['COCOAPODS'] = lockfile_version
Pod::Lockfile.new(hash)
end
......@@ -177,6 +177,38 @@ module Pod
end.message.should.match /should.*run.*outside.*Pods directory.*Current directory.*\./m
end
end
describe 'handling CocoaPods version updates' do
it 'does not deintegrate when there is no lockfile' do
installer = Pod::Installer.new(config.sandbox, generate_podfile, nil)
UI.expects(:section).never
installer.send(:deintegrate_if_different_major_version)
end
it 'does not deintegrate when the major version is the same' do
VERSION.stubs(:to_s).returns('1.1.0')
should_not_deintegrate = %w(1.0.0 1.0.1 1.1.0 1.2.2)
should_not_deintegrate.each do |version|
lockfile = generate_lockfile(:lockfile_version => version)
installer = Pod::Installer.new(config.sandbox, generate_podfile, lockfile)
Pathname.expects(:glob).never
installer.send(:deintegrate_if_different_major_version)
end
end
it 'does deintegrate when the major version is different' do
VERSION.stubs(:to_s).returns('1.1.0')
should_not_deintegrate = %w(0.39.0 2.0.0 10.0-beta)
should_not_deintegrate.each do |version|
lockfile = generate_lockfile(:lockfile_version => version)
installer = Pod::Installer.new(config.sandbox, generate_podfile, lockfile)
project = fixture('SampleProject/SampleProject.xcodeproj')
Pathname.expects(:glob).with(config.installation_root + '*.xcodeproj').returns([project])
Deintegrator.any_instance.expects(:deintegrate_project)
installer.send(:deintegrate_if_different_major_version)
end
end
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