Commit 7595d668 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Cache] Remove cache when CocoaPods version changes

parent 91f1aee8
...@@ -6,13 +6,21 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -6,13 +6,21 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
## Master ## Master
### Bug Fixes ##### Enhancements
* The download cache will automatically be reset when changing CocoaPods
versions.
[Samuel Giddins](https://github.com/segiddins)
[#3542](https://github.com/CocoaPods/CocoaPods/issues/3542)
##### Bug Fixes
* Public headers of vendored frameworks are now automatically linked in * Public headers of vendored frameworks are now automatically linked in
the sandbox. That allows transitive inclusion of headers from other pods. the sandbox. That allows transitive inclusion of headers from other pods.
[Vincent Isambart](https://github.com/vincentisambart) [Vincent Isambart](https://github.com/vincentisambart)
[#3161](https://github.com/CocoaPods/CocoaPods/issues/3161) [#3161](https://github.com/CocoaPods/CocoaPods/issues/3161)
## 0.37.2 ## 0.37.2
##### Enhancements ##### Enhancements
......
...@@ -200,4 +200,4 @@ DEPENDENCIES ...@@ -200,4 +200,4 @@ DEPENDENCIES
xcodeproj! xcodeproj!
BUNDLED WITH BUNDLED WITH
1.10.0 1.10.2
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
# #
def initialize(root) def initialize(root)
@root = Pathname(root) @root = Pathname(root)
@root.mkpath ensure_matching_version
end end
# Downloads the Pod from the given `request` # Downloads the Pod from the given `request`
...@@ -40,6 +40,21 @@ module Pod ...@@ -40,6 +40,21 @@ module Pod
private private
# Ensures the cache on disk was created with the same CocoaPods version as
# is currently running.
#
# @return [Void]
#
def ensure_matching_version
version_file = root + 'VERSION'
version = version_file.read.strip if version_file.file?
root.rmtree if version != Pod::VERSION && root.exist?
root.mkpath
version_file.open('w') { |f| f << Pod::VERSION }
end
# @param [Request] request # @param [Request] request
# the request to be downloaded. # the request to be downloaded.
# #
......
...@@ -30,6 +30,15 @@ module Pod ...@@ -30,6 +30,15 @@ module Pod
@cache.root.should.be.directory? @cache.root.should.be.directory?
end end
it 'implodes when the cache is from a different CocoaPods version' do
root = Pathname(Dir.mktmpdir)
root.+('VERSION').open('w') { |f| f << '0.0.0' }
root.+('FILE').open('w') { |f| f << '0.0.0' }
@cache = Downloader::Cache.new(root)
root.+('VERSION').read.should == Pod::VERSION
root.+('FILE').should.not.exist?
end
it 'groups subspecs by platform' do it 'groups subspecs by platform' do
@spec = Specification.new do |s| @spec = Specification.new do |s|
s.ios.deployment_target = '6.0' s.ios.deployment_target = '6.0'
......
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