Commit a2213b04 authored by Samuel Giddins's avatar Samuel Giddins

Remove head dependencies

parent e3aa45df
...@@ -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: e5b64946f634fec8c99ed82a4da198f9ba1031fc revision: bfcccd59d90bdc322df272af7b62e162f768905b
branch: seg-podfile-refactor branch: seg-podfile-refactor
specs: specs:
cocoapods-core (0.39.0) cocoapods-core (0.39.0)
......
...@@ -14,7 +14,7 @@ module Pod ...@@ -14,7 +14,7 @@ module Pod
# - The version of the Pod changed. # - The version of the Pod changed.
# - The SHA of the specification file changed. # - The SHA of the specification file changed.
# - The specific installed (sub)specs of the same Pod changed. # - The specific installed (sub)specs of the same Pod changed.
# - The specification is in head mode or from an external source and the # - The specification is from an external source and the
# installation process is in update mode. # installation process is in update mode.
# - The directory of the Pod is empty. # - The directory of the Pod is empty.
# - The Pod has been pre-downloaded. # - The Pod has been pre-downloaded.
...@@ -135,7 +135,7 @@ module Pod ...@@ -135,7 +135,7 @@ module Pod
# changed and thus should be reinstalled. # changed and thus should be reinstalled.
# #
# @note In update mode, as there is no way to know if a remote source # @note In update mode, as there is no way to know if a remote source
# hash changed the Pods in head mode and the ones from external # hash changed the Pods from external
# sources are always marked as changed. # sources are always marked as changed.
# #
# @note A Pod whose folder is empty is considered changed. # @note A Pod whose folder is empty is considered changed.
...@@ -152,10 +152,6 @@ module Pod ...@@ -152,10 +152,6 @@ module Pod
return true if resolved_spec_names(pod) != sandbox_spec_names(pod) return true if resolved_spec_names(pod) != sandbox_spec_names(pod)
return true if sandbox.predownloaded?(pod) return true if sandbox.predownloaded?(pod)
return true if folder_empty?(pod) return true if folder_empty?(pod)
return true if sandbox.head_pod?(pod) != sandbox_head_version?(pod)
if update_mode
return true if sandbox.head_pod?(pod)
end
false false
end end
...@@ -238,13 +234,6 @@ module Pod ...@@ -238,13 +234,6 @@ module Pod
sandbox_manifest.checksum(pod) sandbox_manifest.checksum(pod)
end end
# @return [Bool] Wether the Pod is installed in the sandbox is in head
# mode.
#
def sandbox_head_version?(pod)
sandbox_version(pod).head? == true
end
#--------------------------------------# #--------------------------------------#
def folder_exist?(pod) def folder_exist?(pod)
......
...@@ -128,7 +128,6 @@ module Pod ...@@ -128,7 +128,6 @@ module Pod
Downloader::Request.new( Downloader::Request.new(
:spec => root_spec, :spec => root_spec,
:released => released?, :released => released?,
:head => head_pod?,
) )
end end
...@@ -181,12 +180,8 @@ module Pod ...@@ -181,12 +180,8 @@ module Pod
sandbox.local?(root_spec.name) sandbox.local?(root_spec.name)
end end
def head_pod?
sandbox.head_pod?(root_spec.name)
end
def released? def released?
!local? && !head_pod? && !predownloaded? && sandbox.specification(root_spec.name) != root_spec !local? && !predownloaded? && sandbox.specification(root_spec.name) != root_spec
end end
def each_source_file(file_accessors, &blk) def each_source_file(file_accessors, &blk)
......
...@@ -60,11 +60,7 @@ module Pod ...@@ -60,11 +60,7 @@ module Pod
end end
end end
@activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies) @activated = Molinillo::Resolver.new(self, self).resolve(dependencies, locked_dependencies)
specs_by_target.tap do |specs_by_target| specs_by_target
specs_by_target.values.flatten.each do |spec|
sandbox.store_head_pod(spec.name) if spec.version.head?
end
end
rescue Molinillo::ResolverError => e rescue Molinillo::ResolverError => e
handle_resolver_error(e) handle_resolver_error(e)
end end
...@@ -185,7 +181,7 @@ module Pod ...@@ -185,7 +181,7 @@ module Pod
end end
requirement_satisfied && !( requirement_satisfied && !(
spec.version.prerelease? && spec.version.prerelease? &&
existing_vertices.flat_map(&:requirements).none? { |r| r.prerelease? || r.external_source || r.head? } existing_vertices.flat_map(&:requirements).none? { |r| r.prerelease? || r.external_source }
) && spec_is_platform_compatible?(activated, requirement, spec) ) && spec_is_platform_compatible?(activated, requirement, spec)
end end
...@@ -304,9 +300,6 @@ module Pod ...@@ -304,9 +300,6 @@ module Pod
else else
set = create_set_from_sources(dependency) set = create_set_from_sources(dependency)
end end
if set && dependency.head?
set = Specification::Set::Head.new(set.specification)
end
cached_sets[name] = set cached_sets[name] = set
unless set unless set
raise Molinillo::NoSuchDependencyError.new(dependency) # rubocop:disable Style/RaiseArgs raise Molinillo::NoSuchDependencyError.new(dependency) # rubocop:disable Style/RaiseArgs
...@@ -390,8 +383,7 @@ module Pod ...@@ -390,8 +383,7 @@ module Pod
elsif (conflict.possibility && conflict.possibility.version.prerelease?) && elsif (conflict.possibility && conflict.possibility.version.prerelease?) &&
(conflict.requirement && !( (conflict.requirement && !(
conflict.requirement.prerelease? || conflict.requirement.prerelease? ||
conflict.requirement.external_source || conflict.requirement.external_source)
conflict.requirement.head?)
) )
# Conflict was caused by not specifying an explicit version for the requirement #[name], # Conflict was caused by not specifying an explicit version for the requirement #[name],
# and there is no available stable version satisfying constraints for the requirement. # and there is no available stable version satisfying constraints for the requirement.
......
...@@ -59,7 +59,6 @@ module Pod ...@@ -59,7 +59,6 @@ module Pod
@root = Pathname.new(root).realpath @root = Pathname.new(root).realpath
@public_headers = HeadersStore.new(self, 'Public') @public_headers = HeadersStore.new(self, 'Public')
@predownloaded_pods = [] @predownloaded_pods = []
@head_pods = []
@checkout_sources = {} @checkout_sources = {}
@development_pods = {} @development_pods = {}
@pods_with_absolute_path = [] @pods_with_absolute_path = []
...@@ -313,37 +312,6 @@ module Pod ...@@ -313,37 +312,6 @@ module Pod
#--------------------------------------# #--------------------------------------#
# Marks a Pod as head.
#
# @param [String] name
# The name of the Pod.
#
# @return [void]
#
def store_head_pod(name)
root_name = Specification.root_name(name)
head_pods << root_name
end
# @return [Array<String>] The names of the pods that have been
# marked as head.
#
attr_reader :head_pods
# Checks if a Pod should attempt to use the head source of the git repo.
#
# @param [String] name
# The name of the Pod.
#
# @return [Bool] Whether the Pod has been marked as head.
#
def head_pod?(name)
root_name = Specification.root_name(name)
head_pods.include?(root_name)
end
#--------------------------------------#
# Stores the local path of a Pod. # Stores the local path of a Pod.
# #
# @param [String] name # @param [String] name
......
...@@ -16,13 +16,6 @@ module Pod ...@@ -16,13 +16,6 @@ module Pod
@generator = Generator::InfoPlistFile.new(pod_target) @generator = Generator::InfoPlistFile.new(pod_target)
end end
it 'handles when the version is HEAD' do
version = Version.new('0.2.0')
version.head = true
@root_spec.stubs(:version).returns(version)
@generator.target_version.should == '0.2.0'
end
it 'handles when the version is more than 3 numeric parts' do it 'handles when the version is more than 3 numeric parts' do
version = Version.new('0.2.0.1') version = Version.new('0.2.0.1')
@root_spec.stubs(:version).returns(version) @root_spec.stubs(:version).returns(version)
......
...@@ -83,24 +83,6 @@ module Pod ...@@ -83,24 +83,6 @@ module Pod
@sandbox.stubs(:predownloaded?).returns(true) @sandbox.stubs(:predownloaded?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true @analyzer.send(:pod_changed?, 'BananaLib').should == true
end end
it "considers a changed Pod whose head state doesn't match" do
@sandbox.stubs(:head_pod?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it 'considers changed a Pod whose specification is in head mode if in update mode' do
@sandbox.stubs(:head_pod?).returns(true)
@analyzer.stubs(:update_mode?).returns(true)
@analyzer.send(:pod_changed?, 'BananaLib').should == true
end
it "doesn't consider a changed Pod whose specification is in head mode if not in update mode" do
@sandbox.stubs(:head_pod?).returns(true)
@analyzer.stubs(:sandbox_head_version?).returns(true)
@analyzer.stubs(:update_mode?).returns(false)
@analyzer.send(:pod_changed?, 'BananaLib').should == false
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -23,15 +23,6 @@ module Pod ...@@ -23,15 +23,6 @@ module Pod
pod_folder.should.exist pod_folder.should.exist
end end
it 'downloads the head source even if a specific source is present specified source' do
config.sandbox.store_head_pod('BananaLib')
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
@installer.specific_source[:commit].should == FIXTURE_HEAD
pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist
end
it 'returns the checkout options of the downloader if any' do it 'returns the checkout options of the downloader if any' do
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' }
@installer.install! @installer.install!
...@@ -39,27 +30,6 @@ module Pod ...@@ -39,27 +30,6 @@ module Pod
pod_folder = config.sandbox.pod_dir('BananaLib') pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
it 'stores the checkout options in the sandbox' do
config.sandbox.store_head_pod('BananaLib')
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
sources = @installer.sandbox.checkout_sources
sources.should == { 'BananaLib' => {
:git => SpecHelper.fixture('banana-lib'),
:commit => FIXTURE_HEAD },
}
end
it 'fails when using :head for http source' do
config.sandbox.store_head_pod('BananaLib')
@spec.source = { :http => 'http://dl.google.com/googleadmobadssdk/googleadmobsearchadssdkios.zip' }
@spec.source_files = 'GoogleAdMobSearchAdsSDK/*.h'
Pod::Downloader::Http.any_instance.stubs(:download_head)
should.raise Informative do
@installer.install!
end.message.should.match /does not support the :head option, as it uses a Http source./
end
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -468,25 +468,6 @@ module Pod ...@@ -468,25 +468,6 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe 'Downloading dependencies' do describe 'Downloading dependencies' do
it 'installs head pods' do
podfile = Podfile.new do
platform :osx, '10.10'
pod 'CargoBay', '2.1.0'
pod 'AFNetworking/NSURLSession', :head
abstract!(false)
end
@installer.stubs(:podfile).returns(podfile)
@installer.stubs(:lockfile).returns(nil)
Downloader::Git.any_instance.expects(:download).once
Downloader::Git.any_instance.expects(:download_head).once
Downloader::Git.any_instance.stubs(:checkout_options).returns({})
@installer.prepare
@installer.resolve_dependencies
@installer.send(:root_specs).sort_by(&:name).map(&:version).map(&:head?).should == [true, nil]
@installer.download_dependencies
UI.output.should.include 'HEAD based on 2.4.1'
end
describe '#install_pod_sources' do describe '#install_pod_sources' do
it 'installs all the Pods which are marked as needing installation' do it 'installs all the Pods which are marked as needing installation' do
spec = fixture_spec('banana-lib/BananaLib.podspec') spec = fixture_spec('banana-lib/BananaLib.podspec')
......
...@@ -326,50 +326,6 @@ module Pod ...@@ -326,50 +326,6 @@ module Pod
] ]
end end
it 'allows pre-release spec versions when a requirement has a ' \
'HEAD source' do
@podfile = Podfile.new do
platform :ios
pod 'MainSpec', :head
end
spec = Spec.new do |s|
s.name = 'MainSpec'
s.version = '1.2.3-pre'
s.platform = :ios
end
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
resolver.expects(:find_cached_set).returns(Specification::Set::Head.new(spec))
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should == [
'MainSpec (HEAD based on 1.2.3-pre)',
]
end
it "marks a specification's version to be a HEAD version" do
podfile = Podfile.new do
platform :ios
pod 'FileMD5Hash'
pod 'JSONKit', :head
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, SourcesManager.all)
filemd5hash, jsonkit = resolver.resolve.values.first.sort_by(&:name)
filemd5hash.version.should.not.be.head
jsonkit.version.should.be.head
config.sandbox.head_pod?('FileMD5Hash').should.be.false
config.sandbox.head_pod?('JSONKit').should.be.true
end
it 'raises when unable to find a base spec for a HEAD dependency' do
podfile = Podfile.new do
platform :ios, '7.0'
pod 'ALEKit', :head
end
resolver = Resolver.new(config.sandbox, podfile, empty_graph, SourcesManager.all)
Source::Aggregate.any_instance.stubs(:search).with(Dependency.new('ALEKit', :head)).returns(nil)
e = should.raise(Informative) { resolver.resolve.values.flatten.map(&:to_s) }
e.message.should.match /Unable to find a specification for `ALEKit \(HEAD\)`/
end
it 'raises if it finds two conflicting explicit dependencies' do it 'raises if it finds two conflicting explicit dependencies' do
podfile = Podfile.new do podfile = Podfile.new do
platform :ios platform :ios
......
...@@ -156,20 +156,6 @@ module Pod ...@@ -156,20 +156,6 @@ module Pod
#--------------------------------------# #--------------------------------------#
it 'stores the list of the names of the pre-downloaded pods' do
@sandbox.store_head_pod('BananaLib')
@sandbox.head_pods.should == ['BananaLib']
end
it 'returns whether a Pod has been pre-downloaded' do
@sandbox.head_pods << 'BananaLib'
@sandbox.head_pod?('BananaLib').should.be.true
@sandbox.head_pod?('BananaLib/Subspec').should.be.true
@sandbox.head_pod?('Monkey').should.be.false
end
#--------------------------------------#
it 'returns the checkout sources of the Pods' do it 'returns the checkout sources of the Pods' do
@sandbox.store_pre_downloaded_pod('BananaLib/Subspec') @sandbox.store_pre_downloaded_pod('BananaLib/Subspec')
@sandbox.predownloaded_pods.should == ['BananaLib'] @sandbox.predownloaded_pods.should == ['BananaLib']
......
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