Unverified Commit 11072aee authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #7464 from dnkoutso/change_sources_message

Display a message when a pods source has changed during installation
parents 3edf0f3f 2acb073e
...@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz) [Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[#7473](https://github.com/CocoaPods/CocoaPods/pull/7473) [#7473](https://github.com/CocoaPods/CocoaPods/pull/7473)
* Display a message when a pods source has changed during installation
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7464](https://github.com/CocoaPods/CocoaPods/pull/7464)
* Add support for modular header search paths, include "legacy" support. * Add support for modular header search paths, include "legacy" support.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7412](https://github.com/CocoaPods/CocoaPods/pull/7412) [#7412](https://github.com/CocoaPods/CocoaPods/pull/7412)
......
...@@ -7,7 +7,7 @@ GIT ...@@ -7,7 +7,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: e0c6884b37ab6a44095a2bbdbfe9032627a90388 revision: 1a92ff1b5aa2bd21b9694d0941406aff328fdd2a
branch: master branch: master
specs: specs:
cocoapods-core (1.4.0) cocoapods-core (1.4.0)
......
...@@ -321,8 +321,17 @@ module Pod ...@@ -321,8 +321,17 @@ module Pod
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)
if sandbox_state.changed.include?(spec.name) && sandbox.manifest if sandbox_state.changed.include?(spec.name) && sandbox.manifest
previous = sandbox.manifest.version(spec.name) current_version = spec.version
title = "Installing #{spec.name} #{spec.version} (was #{previous})" previous_version = sandbox.manifest.version(spec.name)
has_changed_version = current_version != previous_version
current_repo = analysis_result.specs_by_source.detect { |key, values| break key if values.map(&:name).include?(spec.name) }
current_repo &&= current_repo.url || current_repo.name
previous_spec_repo = sandbox.manifest.spec_repo(spec.name)
has_changed_repo = !previous_spec_repo.nil? && current_repo && (current_repo != previous_spec_repo)
title = "Installing #{spec.name} #{spec.version}"
title << " (was #{previous_version} and source changed to `#{current_repo}` from `#{previous_spec_repo}`)" if has_changed_version && has_changed_repo
title << " (was #{previous_version})" if has_changed_version && !has_changed_repo
title << " (source changed to `#{current_repo}` from `#{previous_spec_repo}`)" if !has_changed_version && has_changed_repo
else else
title = "Installing #{spec}" title = "Installing #{spec}"
end end
......
Subproject commit f7fe19aff17a09075bdba1afcde1d4ffb5fff8ab Subproject commit 94fd69236ef1f5c92eca020bd7eb4bd5b34138ce
...@@ -492,9 +492,13 @@ module Pod ...@@ -492,9 +492,13 @@ module Pod
it 'prints the previous version of a pod while updating the spec' do it 'prints the previous version of a pod while updating the spec' do
spec = Spec.new spec = Spec.new
spec.name = 'RestKit' spec.name = 'RestKit'
spec.version = '2.0' spec.version = Version.new('2.0')
manifest = Lockfile.new({}) manifest = Lockfile.new('SPEC REPOS' => { 'source1' => ['RestKit'] })
manifest.stubs(:version).with('RestKit').returns('1.0') manifest.stubs(:version).with('RestKit').returns(Version.new('1.0'))
analysis_result = Installer::Analyzer::AnalysisResult.new
analysis_result.specifications = [spec]
analysis_result.specs_by_source = { Source.new('source1') => [spec] }
@installer.stubs(:analysis_result).returns(analysis_result)
@installer.sandbox.stubs(:manifest).returns(manifest) @installer.sandbox.stubs(:manifest).returns(manifest)
@installer.stubs(:root_specs).returns([spec]) @installer.stubs(:root_specs).returns([spec])
sandbox_state = Installer::Analyzer::SpecsState.new sandbox_state = Installer::Analyzer::SpecsState.new
...@@ -502,9 +506,51 @@ module Pod ...@@ -502,9 +506,51 @@ module Pod
@installer.stubs(:sandbox_state).returns(sandbox_state) @installer.stubs(:sandbox_state).returns(sandbox_state)
@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)
UI.output.should.not.include 'source changed'
UI.output.should.include 'was 1.0' UI.output.should.include 'was 1.0'
end end
it 'prints the spec repo of a pod while updating the spec' do
spec = Spec.new
spec.name = 'RestKit'
spec.version = Version.new('1.0')
manifest = Lockfile.new('SPEC REPOS' => { 'source1' => ['RestKit'] })
manifest.stubs(:version).with('RestKit').returns(Version.new('1.0'))
analysis_result = Installer::Analyzer::AnalysisResult.new
analysis_result.specifications = [spec]
analysis_result.specs_by_source = { Source.new('source2') => [spec] }
@installer.stubs(:analysis_result).returns(analysis_result)
@installer.sandbox.stubs(:manifest).returns(manifest)
@installer.stubs(:root_specs).returns([spec])
sandbox_state = Installer::Analyzer::SpecsState.new
sandbox_state.changed << 'RestKit'
@installer.stubs(:sandbox_state).returns(sandbox_state)
@installer.expects(:install_source_of_pod).with('RestKit')
@installer.send(:install_pod_sources)
UI.output.should.not.include 'was 1.0'
UI.output.should.include 'source changed to `source2` from `source1`'
end
it 'prints the version and spec repo of a pod while updating the spec' do
spec = Spec.new
spec.name = 'RestKit'
spec.version = Version.new('3.0')
manifest = Lockfile.new('SPEC REPOS' => { 'source1' => ['RestKit'] })
manifest.stubs(:version).with('RestKit').returns(Version.new('2.0'))
analysis_result = Installer::Analyzer::AnalysisResult.new
analysis_result.specifications = [spec]
analysis_result.specs_by_source = { Source.new('source2') => [spec] }
@installer.stubs(:analysis_result).returns(analysis_result)
@installer.sandbox.stubs(:manifest).returns(manifest)
@installer.stubs(:root_specs).returns([spec])
sandbox_state = Installer::Analyzer::SpecsState.new
sandbox_state.changed << 'RestKit'
@installer.stubs(:sandbox_state).returns(sandbox_state)
@installer.expects(:install_source_of_pod).with('RestKit')
@installer.send(:install_pod_sources)
UI.output.should.include 'was 2.0 and source changed to `source2` from `source1`'
end
it 'raises when it attempts to install pod source with no target supporting it' do it 'raises when it attempts to install pod source with no target supporting it' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
pod_target = PodTarget.new([spec], [fixture_target_definition], config.sandbox) pod_target = PodTarget.new([spec], [fixture_target_definition], config.sandbox)
......
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