cocoapods 0.36.4 → 0.37.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95984b64c13cb23f477eff2906659dbd76d1d522
4
- data.tar.gz: 2f1c29bfb21e2a5d921a88891da091b02084bb97
3
+ metadata.gz: ab74bb5d0f584952ffd9115c2e61a0b624b9fb03
4
+ data.tar.gz: a935b3bff32b56d454932f95bff73eb4b6b780b5
5
5
  SHA512:
6
- metadata.gz: ddb355e60588c50b120453daf9a67fb2280f20e45dd1eb853c6f55945fffde882b4126211c8b00358ed7a2c34fa67f56a3ec8fba51526a5f5e5569ebefedaaa1
7
- data.tar.gz: a41f06c36dd9c75ac731b7f9cc8672fd99625c363bffcd73fa444ad518da23ac897511c157772744a180430a132072701f3d3d3b7e841a39f17c1e7282885018
6
+ metadata.gz: b4c2c341908e2cceb3ee3ad114c21296648f583a19e1f11f31c062540727b3647c64e4fcab70ac8d3d32c3903fd0c611bd638eee052ce527a1fccfe2494e6921
7
+ data.tar.gz: d0161a847678e8d4d35efdf85dbf95e03dfc477af4348849c2230c84864b40096f5aeb287b9d9fbbf36473ee939527bfce4440b341e4839cda943bd99cd8d41b
@@ -4,6 +4,60 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
4
4
 
5
5
  To install release candidates run `[sudo] gem install cocoapods --pre`
6
6
 
7
+ ## 0.37.0.beta.1
8
+
9
+ ##### Enhancements
10
+
11
+ * Allow the specification of custom module map files.
12
+ [Samuel Giddins](https://github.com/segiddins)
13
+ [Marius Rackwitz](https://github.com/mrackwitz)
14
+ [#3145](https://github.com/CocoaPods/CocoaPods/issues/3145)
15
+
16
+ * Show the source URI for local Pod specification repositories in
17
+ `pod repo list`.
18
+ [Kyle Fuller](https://github.com/kylef)
19
+
20
+ * Only show a warning when there is a minimum deployment target mismatch
21
+ between target and spec, instead of throwing a hard error.
22
+ [Samuel Giddins](https://github.com/segiddins)
23
+ [#1241](https://github.com/CocoaPods/CocoaPods/issues/1241)
24
+
25
+ * Add download caching for pods, which speeds up `pod install` and linting,
26
+ potentially by several orders of magnitude.
27
+ [Samuel Giddins](https://github.com/segiddins)
28
+ [#2863](https://github.com/CocoaPods/CocoaPods/issues/2863)
29
+ [#3172](https://github.com/CocoaPods/CocoaPods/issues/3172)
30
+
31
+ * Add a `--fail-fast` option to both `pod spec lint` and `pod lib lint` that
32
+ causes the linter to exit as soon as a single subspec or platform fails
33
+ linting.
34
+ [Marius Rackwitz](https://github.com/mrackwitz)
35
+
36
+ * Naïvely prevent base xcconfig warnings for targets that have custom
37
+ config files set.
38
+ [Chris Brauchli](https://github.com/cbrauchli)
39
+ [#2633](https://github.com/CocoaPods/CocoaPods/issues/2633)
40
+
41
+ * Ensure private headers are declared as such in a framework's generated module
42
+ map.
43
+ [Samuel Giddins](https://github.com/segiddins)
44
+ [#2974](https://github.com/CocoaPods/CocoaPods/issues/2974)
45
+
46
+ ##### Bug Fixes
47
+
48
+ * Do not pass code-sign arguments to xcodebuild when linting OS X targets.
49
+ [Boris Bügling](https://github.com/neonichu)
50
+ [#3310](https://github.com/CocoaPods/CocoaPods/issues/3310)
51
+
52
+ * Fixes an issue showing the URL to remote resources in `pod repo list`.
53
+ [Kyle Fuller](https://github.com/kylef)
54
+
55
+ * Fixes a problem with code signing when integrating CocoaPods
56
+ into a Today Widget extension.
57
+ [Christian Sampaio](https://github.com/chrisfsampaio)
58
+ [#3390](https://github.com/CocoaPods/CocoaPods/pull/3390)
59
+
60
+
7
61
  ## 0.36.4
8
62
 
9
63
  ##### Bug Fixes
data/LICENSE CHANGED
@@ -1,7 +1,13 @@
1
1
  This project is licensed under the MIT license.
2
2
 
3
- Copyright (c) 2011 - 2014 Eloy Durán <eloy.de.enige@gmail.com>
4
- Copyright (c) 2012 - 2014 Fabio Pelosin <fabiopelosin@gmail.com>
3
+ Copyright (c) 2011 - 2015 Eloy Durán <eloy.de.enige@gmail.com>,
4
+ Fabio Pelosin <fabiopelosin@gmail.com>,
5
+ Samuel Giddins <segiddins@segiddins.me>,
6
+ Marius Rackwitz <git@mariusrackwitz.de>,
7
+ Kyle Fuller <kyle@fuller.li>,
8
+ Boris Bügling <boris@buegling.com>,
9
+ Orta Therox <orta.therox@gmail.com>, and
10
+ Olivier Halligon <olivier@halligon.net>.
5
11
 
6
12
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
13
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -8,39 +8,60 @@
8
8
 
9
9
  CocoaPods manages dependencies for your Xcode projects.
10
10
 
11
- You specify the dependencies for your project in one easy text file. CocoaPods
12
- resolves dependencies between libraries, fetches source code for the
13
- dependencies, and creates and maintains an Xcode workspace to build your
14
- project.
15
-
16
- Ultimately, the goal is to improve discoverability of, and engagement in, third
17
- party open-source libraries, by creating a more centralized ecosystem.
11
+ You specify the dependencies for your project in a simple text file: your `Podfile`.
12
+ CocoaPods recursively resolves dependencies between libraries, fetches
13
+ source code for all dependencies, and creates and maintains an Xcode
14
+ workspace to build your project.
18
15
 
19
16
  Installing and updating CocoaPods is very easy. Don't miss the [Installation
20
17
  guide](http://guides.cocoapods.org/using/getting-started.html#installation) and the
21
- [Getting started guide](http://guides.cocoapods.org/using/getting-started.html).
18
+ [Getting started guide](https://guides.cocoapods.org/using/getting-started.html).
19
+
20
+ ## Project Goals
21
+
22
+ CocoaPods aims to improve the engagement with, and discoverability
23
+ of, third party open-source Cocoa libraries. These
24
+ project goals influence and drive the design of CocoaPods:
25
+
26
+ - Create and share libraries, and use them in your own projects,
27
+ without creating extra work for library authors. Integrate
28
+ non-CocoaPods libraries and hack on your own fork of any
29
+ CocoaPods library with a simple transparent `Podspec` standard.
30
+ - Allow library authors to structure their libraries however they like.
31
+ - Save time for library authors by automating a lot of Xcode work not
32
+ related to their libraries' functionality.
33
+ - Support any source management system. (Currently supported are git,
34
+ svn, mercurial, bazaar, and various types of archives downloaded over HTTP.)
35
+ - Promote a culture of distributed collaboration on pods, but also provide
36
+ features only possible with a centralised solution to foster a community.
37
+ - Build tools on top of the core Cocoa development system, including those
38
+ typically deployed to other operating systems, such as web-services.
39
+ - Provide opinionated and automated integration, but make it completely
40
+ optional. You may manually integrate your CocoaPods dependencies
41
+ into your Xcode project as you see fit, with or without a workspace.
42
+ - Solve everyday problems for Cocoa and Xcode developers.
22
43
 
23
44
  ## Sponsors
24
45
 
25
- Lovingly sponsored by a collection of companies, see the footer of [CocoaPods.org](http://cocoapods.org) for an up-to-date list.
46
+ Lovingly sponsored by a collection of companies, see the footer of [CocoaPods.org](https://cocoapods.org) for an up-to-date list.
26
47
 
27
48
  ## Collaborate
28
49
 
29
50
  All CocoaPods development happens on GitHub. Contributions make for good karma and
30
- we [welcome new](http://blog.cocoapods.org/starting-open-source/) contributors with joy. We take contributors seriously, and thus have a
51
+ we [welcome new](https://blog.cocoapods.org/starting-open-source/) contributors with joy. We take contributors seriously, and thus have a
31
52
  contributor [code of conduct](CODE_OF_CONDUCT.md).
32
53
 
33
54
  ## Links
34
55
 
35
56
  | Link | Description |
36
57
  | :----- | :------ |
37
- [CocoaPods.org](http://cocoapods.org/) | Homepage and search for Pods.
38
- [@CocoaPods](http://twitter.com/CocoaPods) | Follow CocoaPods on Twitter to stay up to date.
39
- [Blog](http://blog.cocoapods.org) | The CocoaPods blog.
58
+ [CocoaPods.org](https://cocoapods.org/) | Homepage and search for Pods.
59
+ [@CocoaPods](https://twitter.com/CocoaPods) | Follow CocoaPods on Twitter to stay up to date.
60
+ [Blog](https://blog.cocoapods.org) | The CocoaPods blog.
40
61
  [Mailing List](http://groups.google.com/group/cocoapods) | Feel free to ask any kind of question.
41
- [Guides](http://guides.cocoapods.org) | Everything you want to know about CocoaPods.
62
+ [Guides](https://guides.cocoapods.org) | Everything you want to know about CocoaPods.
42
63
  [Changelog](https://github.com/CocoaPods/CocoaPods/blob/master/CHANGELOG.md) | See the changes introduced in each CocoaPods version.
43
- [New Pods RSS](http://feeds.cocoapods.org/new-pods.rss) | Don't miss any new Pods.
64
+ [New Pods RSS](https://feeds.cocoapods.org/new-pods.rss) | Don't miss any new Pods.
44
65
  [Code of Conduct](CODE_OF_CONDUCT.md) | Find out the standards we hold ourselves to.
45
66
 
46
67
  ## Projects
@@ -49,7 +70,7 @@ CocoaPods is composed of the following projects:
49
70
 
50
71
  | Status | Project | Description | Info |
51
72
  | :----- | :------ | :--- | :--- |
52
- | [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg?style=flat)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [guides](http://guides.cocoapods.org)
73
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg?style=flat)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [guides](https://guides.cocoapods.org)
53
74
  | [![Build Status](http://img.shields.io/travis/CocoaPods/Core/master.svg?style=flat)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core)
54
75
  | [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-downloader/master.svg?style=flat)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html)
55
76
  | [![Build Status](http://img.shields.io/travis/CocoaPods/Xcodeproj/master.svg?style=flat)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html)
@@ -113,6 +113,7 @@ module Pod
113
113
  ['--subspec=NAME', 'Lint validates only the given subspec'],
114
114
  ['--no-subspecs', 'Lint skips validation of subspecs'],
115
115
  ['--no-clean', 'Lint leaves the build directory intact for inspection'],
116
+ ['--fail-fast', 'Lint stops on the first failing platform or subspec'],
116
117
  ['--use-libraries', 'Lint uses static libraries to install the spec'],
117
118
  ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \
118
119
  '(defaults to https://github.com/CocoaPods/Specs.git). '\
@@ -123,6 +124,7 @@ module Pod
123
124
  @quick = argv.flag?('quick')
124
125
  @allow_warnings = argv.flag?('allow-warnings')
125
126
  @clean = argv.flag?('clean', true)
127
+ @fail_fast = argv.flag?('fail-fast', false)
126
128
  @subspecs = argv.flag?('subspecs', true)
127
129
  @only_subspec = argv.option('subspec')
128
130
  @use_frameworks = !argv.flag?('use-libraries')
@@ -142,6 +144,7 @@ module Pod
142
144
  validator.local = true
143
145
  validator.quick = @quick
144
146
  validator.no_clean = !@clean
147
+ validator.fail_fast = @fail_fast
145
148
  validator.allow_warnings = @allow_warnings
146
149
  validator.no_subspecs = !@subspecs || @only_subspec
147
150
  validator.only_subspec = @only_subspec
@@ -24,37 +24,6 @@ module Pod
24
24
  def dir
25
25
  config.repos_dir + @name
26
26
  end
27
-
28
- # Returns the branch name (i.e. master).
29
- #
30
- # @return [String] The name of the current branch.
31
- #
32
- def branch_name
33
- `git name-rev --name-only HEAD`.strip
34
- end
35
-
36
- # Returns the branch remote name (i.e. origin).
37
- #
38
- # @param [#to_s] branch_name
39
- # The branch name to look for the remote name.
40
- #
41
- # @return [String] The given branch's remote name.
42
- #
43
- def branch_remote_name(branch_name)
44
- `git config branch.#{branch_name}.remote`.strip
45
- end
46
-
47
- # Returns the url of the given remote name
48
- # (i.e. git@github.com:CocoaPods/Specs.git).
49
- #
50
- # @param [#to_s] remote_name
51
- # The branch remote name to look for the url.
52
- #
53
- # @return [String] The URL of the given remote.
54
- #
55
- def url_of_git_repo(remote_name)
56
- `git config remote.#{remote_name}.url`.strip
57
- end
58
27
  end
59
28
  end
60
29
  end
@@ -20,12 +20,13 @@ module Pod
20
20
  # @output Examples:
21
21
  #
22
22
  # master
23
- # - type: git (origin)
23
+ # - type: git (master)
24
24
  # - URL: https://github.com/CocoaPods/Specs.git
25
25
  # - path: /Users/lascorbe/.cocoapods/repos/master
26
26
  #
27
27
  # test
28
28
  # - type: local copy
29
+ # - URL: file:///Users/lascorbe/.cocoapods/repos/test
29
30
  # - path: /Users/lascorbe/.cocoapods/repos/test
30
31
  #
31
32
  def run
@@ -38,27 +39,24 @@ module Pod
38
39
 
39
40
  # Pretty-prints the source at the given path.
40
41
  #
41
- # @param [String,Pathname] path
42
- # The path of the source to be printed.
42
+ # @param [Source] source
43
+ # The source repository to be printed.
43
44
  #
44
45
  # @return [void]
45
46
  #
46
- def print_source_at_path(path)
47
- Dir.chdir(path) do
48
- if SourcesManager.git_repo?(path)
49
- remote_name = branch_remote_name(branch_name)
50
- if remote_name
51
- UI.puts "- Type: git (#{remote_name})"
52
- url = url_of_git_repo(remote_name)
53
- UI.puts "- URL: #{url}"
54
- else
55
- UI.puts '- Type: git (no remote information available)'
56
- end
57
- else
58
- UI.puts '- Type: local copy'
47
+ def print_source(source)
48
+ if SourcesManager.git_repo?(source.repo)
49
+ Dir.chdir(source.repo) do
50
+ branch_name = `git name-rev --name-only HEAD 2>/dev/null`.strip
51
+ branch_name = 'unknown' if branch_name.empty?
52
+ UI.puts "- Type: git (#{branch_name})"
59
53
  end
60
- UI.puts "- Path: #{path}"
54
+ else
55
+ UI.puts '- Type: local'
61
56
  end
57
+
58
+ UI.puts "- URL: #{source.url}"
59
+ UI.puts "- Path: #{source.repo}"
62
60
  end
63
61
 
64
62
  # Pretty-prints the given sources.
@@ -71,7 +69,7 @@ module Pod
71
69
  def print_sources(sources)
72
70
  sources.each do |source|
73
71
  UI.title source.name do
74
- print_source_at_path source.repo
72
+ print_source(source)
75
73
  end
76
74
  end
77
75
  UI.puts "\n"
@@ -20,6 +20,7 @@ module Pod
20
20
  ['--subspec=NAME', 'Lint validates only the given subspec'],
21
21
  ['--no-subspecs', 'Lint skips validation of subspecs'],
22
22
  ['--no-clean', 'Lint leaves the build directory intact for inspection'],
23
+ ['--fail-fast', 'Lint stops on the first failing platform or subspec'],
23
24
  ['--use-libraries', 'Lint uses static libraries to install the spec'],
24
25
  ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \
25
26
  '(defaults to https://github.com/CocoaPods/Specs.git). '\
@@ -30,6 +31,7 @@ module Pod
30
31
  @quick = argv.flag?('quick')
31
32
  @allow_warnings = argv.flag?('allow-warnings')
32
33
  @clean = argv.flag?('clean', true)
34
+ @fail_fast = argv.flag?('fail-fast', false)
33
35
  @subspecs = argv.flag?('subspecs', true)
34
36
  @only_subspec = argv.option('subspec')
35
37
  @use_frameworks = !argv.flag?('use-libraries')
@@ -45,6 +47,7 @@ module Pod
45
47
  validator = Validator.new(podspec, @source_urls)
46
48
  validator.quick = @quick
47
49
  validator.no_clean = !@clean
50
+ validator.fail_fast = @fail_fast
48
51
  validator.allow_warnings = @allow_warnings
49
52
  validator.no_subspecs = !@subspecs || @only_subspec
50
53
  validator.only_subspec = @only_subspec
@@ -15,6 +15,7 @@ module Pod
15
15
  :verbose => false,
16
16
  :silent => false,
17
17
  :skip_repo_update => false,
18
+ :skip_download_cache => !ENV['COCOAPODS_SKIP_CACHE'].nil?,
18
19
 
19
20
  :clean => true,
20
21
  :integrate_targets => true,
@@ -66,6 +67,11 @@ module Pod
66
67
  attr_accessor :skip_repo_update
67
68
  alias_method :skip_repo_update?, :skip_repo_update
68
69
 
70
+ # @return [Bool] Whether the installer should skip the download cache.
71
+ #
72
+ attr_accessor :skip_download_cache
73
+ alias_method :skip_download_cache?, :skip_download_cache
74
+
69
75
  public
70
76
 
71
77
  #-------------------------------------------------------------------------#
@@ -1,8 +1,48 @@
1
1
  require 'cocoapods-downloader'
2
2
  require 'claide/informative_error'
3
+ require 'fileutils'
4
+ require 'tmpdir'
3
5
 
4
6
  module Pod
5
7
  module Downloader
8
+ require 'cocoapods/downloader/cache'
9
+ require 'cocoapods/downloader/request'
10
+ require 'cocoapods/downloader/response'
11
+
12
+ # Downloads a pod from the given `request` to the given `target` location.
13
+ #
14
+ # @return [Response] The download response for this download.
15
+ #
16
+ # @param [Request] request
17
+ # the request that describes this pod download.
18
+ #
19
+ # @param [Pathname,Nil] target
20
+ # the location to which this pod should be downloaded. If `nil`,
21
+ # then the pod will only be cached.
22
+ #
23
+ # @param [Pathname,Nil] cache_path
24
+ # the path used to cache pod downloads. If `nil`, then no caching
25
+ # will be done.
26
+ #
27
+ def self.download(
28
+ request,
29
+ target,
30
+ cache_path: !Config.instance.skip_download_cache && Config.instance.cache_root + 'Pods'
31
+ )
32
+ cache_path, tmp_cache = Pathname(Dir.mktmpdir), true unless cache_path
33
+ cache = Cache.new(cache_path)
34
+ result = cache.download_pod(request)
35
+ if target
36
+ UI.message "Copying #{request.name} from `#{result.location}` to #{UI.path target}", '> ' do
37
+ FileUtils.rm_rf target
38
+ FileUtils.cp_r(result.location, target)
39
+ end
40
+ end
41
+ result
42
+ ensure
43
+ FileUtils.rm_r cache_path if tmp_cache
44
+ end
45
+
6
46
  class DownloaderError; include CLAide::InformativeError; end
7
47
 
8
48
  class Base
@@ -0,0 +1,210 @@
1
+ require 'fileutils'
2
+ require 'tmpdir'
3
+
4
+ module Pod
5
+ module Downloader
6
+ # The class responsible for managing Pod downloads, transparently caching
7
+ # them in a cache directory.
8
+ #
9
+ class Cache
10
+ # @return [Pathname] The root directory where this cache store its
11
+ # downloads.
12
+ #
13
+ attr_reader :root
14
+
15
+ # @param [Pathname,String] root
16
+ # see {#root}
17
+ #
18
+ def initialize(root)
19
+ @root = Pathname(root)
20
+ @root.mkpath
21
+ end
22
+
23
+ # Downloads the Pod from the given `request`
24
+ #
25
+ # @param [Request] request
26
+ # the request to be downloaded.
27
+ #
28
+ # @return [Response] the response from downloading `request`
29
+ #
30
+ def download_pod(request)
31
+ cached_pod(request) || uncached_pod(request)
32
+ rescue Informative
33
+ raise
34
+ rescue
35
+ UI.notice("Error installing #{request.name}")
36
+ raise
37
+ end
38
+
39
+ private
40
+
41
+ # @param [Request] request
42
+ # the request to be downloaded.
43
+ #
44
+ # @param [Hash<Symbol,String>] slug_opts
45
+ # the download options that should be used in constructing the
46
+ # cache slug for this request.
47
+ #
48
+ # @return [Pathname] The path for the Pod downloaded from the given
49
+ # `request`.
50
+ #
51
+ def path_for_pod(request, slug_opts = {})
52
+ root + request.slug(slug_opts)
53
+ end
54
+
55
+ # @param [Request] request
56
+ # the request to be downloaded.
57
+ #
58
+ # @param [Hash<Symbol,String>] slug_opts
59
+ # the download options that should be used in constructing the
60
+ # cache slug for this request.
61
+ #
62
+ # @return [Pathname] The path for the podspec downloaded from the given
63
+ # `request`.
64
+ #
65
+ def path_for_spec(request, slug_opts = {})
66
+ path = root + 'Specs' + request.slug(slug_opts)
67
+ path.sub_ext('.podspec.json')
68
+ end
69
+
70
+ # @param [Request] request
71
+ # the request to be downloaded.
72
+ #
73
+ # @return [Response] The download response for the given `request` that
74
+ # was found in the download cache.
75
+ #
76
+ def cached_pod(request)
77
+ path = path_for_pod(request)
78
+ spec = request.spec || cached_spec(request)
79
+ return unless spec && path.directory?
80
+ Response.new(path, spec, request.params)
81
+ end
82
+
83
+ # @param [Request] request
84
+ # the request to be downloaded.
85
+ #
86
+ # @return [Specification] The cached specification for the given
87
+ # `request`.
88
+ #
89
+ def cached_spec(request)
90
+ path = path_for_spec(request)
91
+ path.file? && Specification.from_file(path)
92
+ end
93
+
94
+ # @param [Request] request
95
+ # the request to be downloaded.
96
+ #
97
+ # @return [Response] The download response for the given `request` that
98
+ # was not found in the download cache.
99
+ #
100
+ def uncached_pod(request)
101
+ in_tmpdir do |target|
102
+ result = Response.new
103
+ result.checkout_options = download(request.name, target, request.params, request.head?)
104
+
105
+ if request.released_pod?
106
+ result.spec = request.spec
107
+ result.location = destination = path_for_pod(request, :params => result.checkout_options)
108
+ copy_and_clean(target, destination, request.spec)
109
+ write_spec(request.spec, path_for_spec(request, :params => result.checkout_options))
110
+ else
111
+ podspecs = Sandbox::PodspecFinder.new(target).podspecs
112
+ podspecs[request.name] = request.spec if request.spec
113
+ podspecs.each do |name, spec|
114
+ destination = path_for_pod(request, :name => name, :params => result.checkout_options)
115
+ copy_and_clean(target, destination, spec)
116
+ write_spec(spec, path_for_spec(request, :name => name, :params => result.checkout_options))
117
+ if request.name == name
118
+ result.location = destination
119
+ result.spec = spec
120
+ end
121
+ end
122
+ end
123
+
124
+ result
125
+ end
126
+ end
127
+
128
+ # Downloads a pod with the given `name` and `params` to `target`.
129
+ #
130
+ # @param [String] name
131
+ #
132
+ # @param [Pathname] target
133
+ #
134
+ # @param [Hash<Symbol,String>] params
135
+ #
136
+ # @param [Boolean] head
137
+ #
138
+ # @return [Hash] The checkout options required to re-download this exact
139
+ # same source.
140
+ #
141
+ def download(name, target, params, head)
142
+ downloader = Downloader.for_target(target, params)
143
+ if head
144
+ unless downloader.head_supported?
145
+ raise Informative, "The pod '#{name}' does not " \
146
+ "support the :head option, as it uses a #{downloader.name} " \
147
+ 'source. Remove that option to use this pod.'
148
+ end
149
+ downloader.download_head
150
+ else
151
+ downloader.download
152
+ end
153
+
154
+ if downloader.options_specific? && !head
155
+ params
156
+ else
157
+ downloader.checkout_options
158
+ end
159
+ end
160
+
161
+ # Performs the given block inside a temporary directory,
162
+ # which is removed at the end of the block's scope.
163
+ #
164
+ # @return [Object] The return value of the given block
165
+ #
166
+ def in_tmpdir(&blk)
167
+ tmpdir = Pathname(Dir.mktmpdir)
168
+ blk.call(tmpdir)
169
+ ensure
170
+ FileUtils.remove_entry(tmpdir) if tmpdir.exist?
171
+ end
172
+
173
+ # Copies the `source` directory to `destination`, cleaning the directory
174
+ # of any files unused by `spec`.
175
+ #
176
+ # @param [Pathname] source
177
+ #
178
+ # @param [Pathname] destination
179
+ #
180
+ # @param [Specification] spec
181
+ #
182
+ # @return [Void]
183
+ #
184
+ def copy_and_clean(source, destination, spec)
185
+ specs_by_platform = {}
186
+ spec.available_platforms.each do |platform|
187
+ specs_by_platform[platform] = [spec, *spec.recursive_subspecs].select { |ss| ss.supported_on_platform?(platform) }
188
+ end
189
+ destination.parent.mkpath
190
+ FileUtils.cp_r(source, destination)
191
+ Sandbox::PodDirCleaner.new(destination, specs_by_platform).clean!
192
+ end
193
+
194
+ # Writes the given `spec` to the given `path`.
195
+ #
196
+ # @param [Specification] spec
197
+ # the specification to be written.
198
+ #
199
+ # @param [Pathname] path
200
+ # the path the specification is to be written to.
201
+ #
202
+ # @return [Void]
203
+ #
204
+ def write_spec(spec, path)
205
+ path.dirname.mkpath
206
+ path.open('w') { |f| f.write spec.to_pretty_json }
207
+ end
208
+ end
209
+ end
210
+ end