cocoapods 0.33.1 → 0.34.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +171 -46
- data/README.md +9 -9
- data/bin/pod +5 -5
- data/bin/sandbox-pod +2 -6
- data/lib/cocoapods.rb +4 -4
- data/lib/cocoapods/command.rb +12 -10
- data/lib/cocoapods/command/init.rb +12 -13
- data/lib/cocoapods/command/inter_process_communication.rb +6 -17
- data/lib/cocoapods/command/lib.rb +27 -24
- data/lib/cocoapods/command/list.rb +9 -9
- data/lib/cocoapods/command/outdated.rb +4 -9
- data/lib/cocoapods/command/project.rb +57 -19
- data/lib/cocoapods/command/push.rb +0 -1
- data/lib/cocoapods/command/repo.rb +14 -15
- data/lib/cocoapods/command/repo/push.rb +24 -19
- data/lib/cocoapods/command/search.rb +12 -13
- data/lib/cocoapods/command/setup.rb +10 -9
- data/lib/cocoapods/command/spec.rb +67 -63
- data/lib/cocoapods/config.rb +21 -54
- data/lib/cocoapods/downloader.rb +0 -1
- data/lib/cocoapods/executable.rb +3 -8
- data/lib/cocoapods/external_sources.rb +2 -4
- data/lib/cocoapods/external_sources/abstract_external_source.rb +15 -10
- data/lib/cocoapods/external_sources/downloader_source.rb +0 -2
- data/lib/cocoapods/external_sources/path_source.rb +1 -4
- data/lib/cocoapods/external_sources/podspec_source.rb +1 -3
- data/lib/cocoapods/gem_version.rb +1 -2
- data/lib/cocoapods/generator/acknowledgements.rb +5 -8
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +5 -7
- data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -10
- data/lib/cocoapods/generator/bridge_support.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +10 -14
- data/lib/cocoapods/generator/dummy_source.rb +3 -3
- data/lib/cocoapods/generator/prefix_header.rb +15 -16
- data/lib/cocoapods/generator/target_environment_header.rb +122 -36
- data/lib/cocoapods/generator/xcconfig.rb +0 -4
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +74 -65
- data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +92 -95
- data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +48 -51
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +10 -10
- data/lib/cocoapods/hooks/installer_representation.rb +15 -18
- data/lib/cocoapods/hooks/library_representation.rb +4 -8
- data/lib/cocoapods/hooks/pod_representation.rb +1 -5
- data/lib/cocoapods/hooks_manager.rb +63 -0
- data/lib/cocoapods/installer.rb +60 -47
- data/lib/cocoapods/installer/analyzer.rb +60 -62
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +5 -8
- data/lib/cocoapods/installer/file_references_installer.rb +7 -10
- data/lib/cocoapods/installer/hooks_context.rb +74 -0
- data/lib/cocoapods/installer/migrator.rb +99 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +9 -29
- data/lib/cocoapods/installer/target_installer.rb +7 -17
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +40 -41
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +43 -54
- data/lib/cocoapods/installer/user_project_integrator.rb +54 -10
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +66 -117
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +116 -0
- data/lib/cocoapods/open_uri.rb +1 -2
- data/lib/cocoapods/project.rb +34 -8
- data/lib/cocoapods/resolver.rb +43 -21
- data/lib/cocoapods/sandbox.rb +80 -75
- data/lib/cocoapods/sandbox/file_accessor.rb +3 -8
- data/lib/cocoapods/sandbox/headers_store.rb +6 -7
- data/lib/cocoapods/sandbox/path_list.rb +7 -10
- data/lib/cocoapods/sources_manager.rb +81 -49
- data/lib/cocoapods/target.rb +18 -12
- data/lib/cocoapods/target/aggregate_target.rb +43 -18
- data/lib/cocoapods/target/pod_target.rb +37 -4
- data/lib/cocoapods/user_interface.rb +19 -18
- data/lib/cocoapods/user_interface/error_report.rb +23 -4
- data/lib/cocoapods/validator.rb +30 -33
- metadata +100 -73
- data/lib/cocoapods/command/help.rb +0 -25
@@ -0,0 +1,116 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class UserProjectIntegrator
|
4
|
+
class TargetIntegrator
|
5
|
+
# Configures an user target to use the CocoaPods xcconfigs which allow
|
6
|
+
# lo link against the Pods.
|
7
|
+
#
|
8
|
+
class XCConfigIntegrator
|
9
|
+
# Integrates the user target.
|
10
|
+
#
|
11
|
+
# @param [Target::AggregateTarget] pod_bundle
|
12
|
+
# The Pods bundle.
|
13
|
+
#
|
14
|
+
# @param [Array<PBXNativeTarget>] targets
|
15
|
+
# The native targets associated which should be integrated
|
16
|
+
# with the Pod bundle.
|
17
|
+
#
|
18
|
+
def self.integrate(pod_bundle, targets)
|
19
|
+
targets.each do |target|
|
20
|
+
target.build_configurations.each do |config|
|
21
|
+
update_to_cocoapods_0_34(pod_bundle, targets)
|
22
|
+
set_target_xcconfig(pod_bundle, config)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# @!group Integration steps
|
30
|
+
#-------------------------------------------------------------------#
|
31
|
+
|
32
|
+
# Removes the xcconfig used up to CocoaPods 0.33 from the project and
|
33
|
+
# deletes the file if it exists.
|
34
|
+
#
|
35
|
+
# @param [Target::AggregateTarget] pod_bundle
|
36
|
+
# The Pods bundle.
|
37
|
+
#
|
38
|
+
# @param [XcodeProj::PBXNativeTarget] target
|
39
|
+
# The native targets.
|
40
|
+
#
|
41
|
+
# @todo This can be removed for CocoaPods 1.0
|
42
|
+
#
|
43
|
+
def self.update_to_cocoapods_0_34(pod_bundle, targets)
|
44
|
+
sandbox = pod_bundle.sandbox
|
45
|
+
targets.map(&:project).uniq.each do |project|
|
46
|
+
file_refs = project.files.select do |file_ref|
|
47
|
+
path = file_ref.path.to_s
|
48
|
+
if File.extname(path) == '.xcconfig'
|
49
|
+
absolute_path = file_ref.real_path.to_s
|
50
|
+
absolute_path.start_with?(sandbox.root.to_s) &&
|
51
|
+
!absolute_path.start_with?(sandbox.target_support_files_root.to_s)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
file_refs.uniq.each do |file_ref|
|
56
|
+
UI.message "- Removing (#{file_ref.path})" do
|
57
|
+
file_ref.remove_from_project
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Creates a file reference to the xcconfig generated by
|
64
|
+
# CocoaPods (if needed) and sets it as the base configuration of
|
65
|
+
# build configuration of the user target.
|
66
|
+
#
|
67
|
+
# @param [Target::AggregateTarget] pod_bundle
|
68
|
+
# The Pods bundle.
|
69
|
+
#
|
70
|
+
# @param [[Xcodeproj::XCBuildConfiguration] config
|
71
|
+
# The build configuration.
|
72
|
+
#
|
73
|
+
def self.set_target_xcconfig(pod_bundle, config)
|
74
|
+
path = pod_bundle.xcconfig_relative_path(config.name)
|
75
|
+
group = config.project['Pods'] || config.project.new_group('Pods')
|
76
|
+
file_ref = group.files.find { |f| f.path == path }
|
77
|
+
file_ref ||= group.new_file(path)
|
78
|
+
config.base_configuration_reference = file_ref
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
# @!group Private helpers
|
84
|
+
#-------------------------------------------------------------------#
|
85
|
+
|
86
|
+
# Prints a warning informing the user that a build configuration of
|
87
|
+
# the integrated target is overriding the CocoaPods build settings.
|
88
|
+
#
|
89
|
+
# @param [Target::AggregateTarget] pod_bundle
|
90
|
+
# The Pods bundle.
|
91
|
+
#
|
92
|
+
# @param [XcodeProj::PBXNativeTarget] target
|
93
|
+
# The native target.
|
94
|
+
#
|
95
|
+
# @param [Xcodeproj::XCBuildConfiguration] config
|
96
|
+
# The build configuration.
|
97
|
+
#
|
98
|
+
# @param [String] key
|
99
|
+
# The key of the overridden build setting.
|
100
|
+
#
|
101
|
+
def self.print_override_warning(pod_bundle, target, config, key)
|
102
|
+
actions = [
|
103
|
+
'Use the `$(inherited)` flag, or',
|
104
|
+
'Remove the build settings from the target.',
|
105
|
+
]
|
106
|
+
message = "The `#{target.name} [#{config.name}]` " \
|
107
|
+
"target overrides the `#{key}` build setting defined in " \
|
108
|
+
"`#{pod_bundle.xcconfig_relative_path(config.name)}'. " \
|
109
|
+
'This can lead to problems with the CocoaPods installation'
|
110
|
+
UI.warn(message, actions)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/lib/cocoapods/open_uri.rb
CHANGED
@@ -3,7 +3,6 @@ require 'open-uri'
|
|
3
3
|
# Allow OpenURI to follow http to https redirects.
|
4
4
|
#
|
5
5
|
module OpenURI
|
6
|
-
|
7
6
|
# Whether {#open} should follow a redirect.
|
8
7
|
#
|
9
8
|
# Inspiration from: https://gist.github.com/1271420
|
@@ -17,7 +16,7 @@ module OpenURI
|
|
17
16
|
# (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3)
|
18
17
|
# However this is ad hoc. It should be extensible/configurable.
|
19
18
|
#
|
20
|
-
def
|
19
|
+
def self.redirectable?(uri1, uri2)
|
21
20
|
uri1.scheme.downcase == uri2.scheme.downcase ||
|
22
21
|
(/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:https?|ftp)\z/i =~ uri2.scheme)
|
23
22
|
end
|
data/lib/cocoapods/project.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'xcodeproj'
|
2
2
|
|
3
3
|
module Pod
|
4
|
-
|
5
4
|
# The Pods project.
|
6
5
|
#
|
7
6
|
# Model class which provides helpers for working with the Pods project
|
8
7
|
# through the installation process.
|
9
8
|
#
|
10
9
|
class Project < Xcodeproj::Project
|
11
|
-
|
12
10
|
# @param [Pathname, String] path @see path
|
13
11
|
# @param [Bool] skip_initialization
|
14
12
|
# Wether the project should be initialized from scratch.
|
@@ -34,7 +32,6 @@ module Pod
|
|
34
32
|
#
|
35
33
|
attr_reader :development_pods
|
36
34
|
|
37
|
-
|
38
35
|
public
|
39
36
|
|
40
37
|
# @!group Pod Groups
|
@@ -58,7 +55,7 @@ module Pod
|
|
58
55
|
# @return [PBXGroup] The new group.
|
59
56
|
#
|
60
57
|
def add_pod_group(pod_name, path, development = false, absolute = false)
|
61
|
-
raise
|
58
|
+
raise '[BUG]' if pod_group(pod_name)
|
62
59
|
|
63
60
|
parent_group = development ? development_pods : pods
|
64
61
|
source_tree = absolute ? :absolute : :group
|
@@ -125,12 +122,11 @@ module Pod
|
|
125
122
|
#
|
126
123
|
# @return [PBXGroup] The group.
|
127
124
|
#
|
128
|
-
def pod_support_files_group(pod_name)
|
125
|
+
def pod_support_files_group(pod_name, dir)
|
129
126
|
group = pod_group(pod_name)
|
130
127
|
support_files_group = group['Support Files']
|
131
128
|
unless support_files_group
|
132
|
-
support_files_group = group.new_group('Support Files')
|
133
|
-
support_files_group.source_tree = 'SOURCE_ROOT'
|
129
|
+
support_files_group = group.new_group('Support Files', dir)
|
134
130
|
end
|
135
131
|
support_files_group
|
136
132
|
end
|
@@ -193,6 +189,37 @@ module Pod
|
|
193
189
|
podfile_ref
|
194
190
|
end
|
195
191
|
|
192
|
+
# Adds a new build configuration to the project and populates it with
|
193
|
+
# default settings according to the provided type.
|
194
|
+
#
|
195
|
+
# @note This method extends the original Xcodeproj implementation to
|
196
|
+
# include a preprocessor definition named after the build
|
197
|
+
# setting. This is done to support the TargetEnvironmentHeader
|
198
|
+
# specification of Pods available only on certain build
|
199
|
+
# configurations.
|
200
|
+
#
|
201
|
+
# @param [String] name
|
202
|
+
# The name of the build configuration.
|
203
|
+
#
|
204
|
+
# @param [Symbol] type
|
205
|
+
# The type of the build configuration used to populate the build
|
206
|
+
# settings, must be :debug or :release.
|
207
|
+
#
|
208
|
+
# @return [XCBuildConfiguration] The new build configuration.
|
209
|
+
#
|
210
|
+
def add_build_configuration(name, type)
|
211
|
+
build_configuration = super
|
212
|
+
values = ["#{name.gsub(' ', '_').upcase}=1"]
|
213
|
+
settings = build_configuration.build_settings
|
214
|
+
definitions = Array(settings['GCC_PREPROCESSOR_DEFINITIONS'])
|
215
|
+
values.each do |value|
|
216
|
+
unless definitions.include?(value)
|
217
|
+
definitions << value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
settings['GCC_PREPROCESSOR_DEFINITIONS'] = definitions
|
221
|
+
build_configuration
|
222
|
+
end
|
196
223
|
|
197
224
|
private
|
198
225
|
|
@@ -205,6 +232,5 @@ module Pod
|
|
205
232
|
attr_reader :refs_by_absolute_path
|
206
233
|
|
207
234
|
#-------------------------------------------------------------------------#
|
208
|
-
|
209
235
|
end
|
210
236
|
end
|
data/lib/cocoapods/resolver.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Pod
|
2
|
-
|
3
2
|
# The resolver is responsible of generating a list of specifications grouped
|
4
3
|
# by target for a given Podfile.
|
5
4
|
#
|
@@ -15,7 +14,6 @@ module Pod
|
|
15
14
|
#
|
16
15
|
#
|
17
16
|
class Resolver
|
18
|
-
|
19
17
|
# @return [Sandbox] the Sandbox used by the resolver to find external
|
20
18
|
# dependencies.
|
21
19
|
#
|
@@ -30,14 +28,21 @@ module Pod
|
|
30
28
|
#
|
31
29
|
attr_reader :locked_dependencies
|
32
30
|
|
31
|
+
# @return [Array<Source>] The list of the sources which will be used for
|
32
|
+
# the resolution.
|
33
|
+
#
|
34
|
+
attr_accessor :sources
|
35
|
+
|
33
36
|
# @param [Sandbox] sandbox @see sandbox
|
34
37
|
# @param [Podfile] podfile @see podfile
|
35
38
|
# @param [Array<Dependency>] locked_dependencies @see locked_dependencies
|
39
|
+
# @param [Array<Source>, Source] sources @see sources
|
36
40
|
#
|
37
|
-
def initialize(sandbox, podfile, locked_dependencies
|
41
|
+
def initialize(sandbox, podfile, locked_dependencies, sources)
|
38
42
|
@sandbox = sandbox
|
39
43
|
@podfile = podfile
|
40
44
|
@locked_dependencies = locked_dependencies
|
45
|
+
@sources = Array(sources)
|
41
46
|
end
|
42
47
|
|
43
48
|
#-------------------------------------------------------------------------#
|
@@ -53,14 +58,15 @@ module Pod
|
|
53
58
|
# definition.
|
54
59
|
#
|
55
60
|
def resolve
|
56
|
-
@cached_sources = SourcesManager.aggregate
|
57
61
|
@cached_sets = {}
|
58
62
|
@cached_specs = {}
|
59
63
|
@specs_by_target = {}
|
60
64
|
|
61
65
|
target_definitions = podfile.target_definition_list
|
62
66
|
target_definitions.each do |target|
|
63
|
-
|
67
|
+
title = "Resolving dependencies for target `#{target.name}' " \
|
68
|
+
"(#{target.platform})"
|
69
|
+
UI.section(title) do
|
64
70
|
@loaded_specs = []
|
65
71
|
find_dependency_specs(podfile, target.dependencies, target)
|
66
72
|
specs = cached_specs.values_at(*@loaded_specs).sort_by(&:name)
|
@@ -85,14 +91,6 @@ module Pod
|
|
85
91
|
|
86
92
|
# !@ Resolution context
|
87
93
|
|
88
|
-
# @return [Source::Aggregate] A cache of the sources needed to find the
|
89
|
-
# podspecs.
|
90
|
-
#
|
91
|
-
# @note The sources are cached because frequently accessed by the
|
92
|
-
# resolver and loading them requires disk activity.
|
93
|
-
#
|
94
|
-
attr_accessor :cached_sources
|
95
|
-
|
96
94
|
# @return [Hash<String => Set>] A cache that keeps tracks of the sets
|
97
95
|
# loaded by the resolution process.
|
98
96
|
#
|
@@ -150,7 +148,7 @@ module Pod
|
|
150
148
|
dependency = locked_dep if locked_dep
|
151
149
|
|
152
150
|
UI.message("- #{dependency}", '', 2) do
|
153
|
-
set = find_cached_set(dependency)
|
151
|
+
set = find_cached_set(dependency, dependent_spec)
|
154
152
|
set.required_by(dependency, dependent_spec.to_s)
|
155
153
|
|
156
154
|
unless @loaded_specs.include?(dependency.name)
|
@@ -170,38 +168,62 @@ module Pod
|
|
170
168
|
end
|
171
169
|
end
|
172
170
|
|
173
|
-
# Loads or returns a previously initialized for the Pod
|
174
|
-
# dependency.
|
171
|
+
# @return [Set] Loads or returns a previously initialized set for the Pod
|
172
|
+
# of the given dependency.
|
175
173
|
#
|
176
174
|
# @param [Dependency] dependency
|
177
|
-
#
|
175
|
+
# The dependency for which the set is needed.
|
176
|
+
#
|
177
|
+
# @param [#to_s] dependent_spec
|
178
|
+
# the specification whose dependencies are being resolved. Used
|
179
|
+
# only for UI purposes.
|
178
180
|
#
|
179
181
|
# @return [Set] the cached set for a given dependency.
|
180
182
|
#
|
181
|
-
def find_cached_set(dependency)
|
183
|
+
def find_cached_set(dependency, dependent_spec)
|
182
184
|
name = dependency.root_name
|
183
185
|
unless cached_sets[name]
|
184
186
|
if dependency.external_source
|
185
187
|
spec = sandbox.specification(dependency.root_name)
|
186
188
|
unless spec
|
187
|
-
raise StandardError,
|
189
|
+
raise StandardError, '[Bug] Unable to find the specification ' \
|
190
|
+
"for `#{dependency}`."
|
188
191
|
end
|
189
192
|
set = Specification::Set::External.new(spec)
|
190
193
|
else
|
191
|
-
set =
|
194
|
+
set = find_set_from_sources(dependency)
|
192
195
|
end
|
193
196
|
cached_sets[name] = set
|
194
197
|
unless set
|
195
|
-
raise Informative,
|
198
|
+
raise Informative, 'Unable to find a specification for ' \
|
199
|
+
"`#{dependency}` depended upon by #{dependent_spec}."
|
196
200
|
end
|
197
201
|
end
|
198
202
|
cached_sets[name]
|
199
203
|
end
|
200
204
|
|
205
|
+
# @return [Set] Loads a set for the Pod of the given dependency from the
|
206
|
+
# sources. The set will be limited to the versions of the first
|
207
|
+
# source which includes the Pod.
|
208
|
+
#
|
209
|
+
# @param [Dependency] dependency
|
210
|
+
# The dependency for which the set is needed.
|
211
|
+
#
|
212
|
+
def find_set_from_sources(dependency)
|
213
|
+
sources.each do |source|
|
214
|
+
set = source.search(dependency)
|
215
|
+
return set if set
|
216
|
+
end
|
217
|
+
nil
|
218
|
+
end
|
219
|
+
|
201
220
|
# Ensures that a specification is compatible with the platform of a target.
|
202
221
|
#
|
203
222
|
# @raise If the specification is not supported by the target.
|
204
223
|
#
|
224
|
+
# @todo This step is not specific to the resolution process and should be
|
225
|
+
# performed later in the analysis.
|
226
|
+
#
|
205
227
|
# @return [void]
|
206
228
|
#
|
207
229
|
def validate_platform(spec, target)
|
data/lib/cocoapods/sandbox.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
module Pod
|
4
|
-
|
5
4
|
# The sandbox provides support for the directory that CocoaPods uses for an
|
6
5
|
# installation. In this directory the Pods projects, the support files and
|
7
6
|
# the sources of the Pods are stored.
|
@@ -12,41 +11,31 @@ module Pod
|
|
12
11
|
#
|
13
12
|
# Pods
|
14
13
|
# |
|
15
|
-
# +--
|
16
|
-
# |
|
17
|
-
# |
|
18
|
-
# |
|
14
|
+
# +-- Headers
|
15
|
+
# | +-- Private
|
16
|
+
# | | +-- [Pod Name]
|
17
|
+
# | +-- Public
|
18
|
+
# | +-- [Pod Name]
|
19
19
|
# |
|
20
|
-
# +--
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# +--
|
28
|
-
#
|
29
|
-
#
|
30
|
-
# +--
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# | +-- Pods-acknowledgements.plist
|
38
|
-
# | +-- Pods-dummy.m
|
39
|
-
# | +-- Pods-prefix.pch
|
40
|
-
# | +-- Pods.xcconfig
|
41
|
-
# |
|
42
|
-
# +-- Manifest.lock
|
43
|
-
# |
|
44
|
-
# +-- Pods.xcodeproj
|
45
|
-
#
|
46
|
-
# See #833
|
20
|
+
# +-- Local Podspecs
|
21
|
+
# | +-- External Sources
|
22
|
+
# | +-- Normal Sources
|
23
|
+
# |
|
24
|
+
# +-- Target Support Files
|
25
|
+
# | +-- [Target Name]
|
26
|
+
# | +-- Pods-acknowledgements.markdown
|
27
|
+
# | +-- Pods-acknowledgements.plist
|
28
|
+
# | +-- Pods-dummy.m
|
29
|
+
# | +-- Pods-prefix.pch
|
30
|
+
# | +-- Pods.xcconfig
|
31
|
+
# |
|
32
|
+
# +-- [Pod Name]
|
33
|
+
# |
|
34
|
+
# +-- Manifest.lock
|
35
|
+
# |
|
36
|
+
# +-- Pods.xcodeproj
|
47
37
|
#
|
48
38
|
class Sandbox
|
49
|
-
|
50
39
|
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
|
51
40
|
autoload :HeadersStore, 'cocoapods/sandbox/headers_store'
|
52
41
|
autoload :PathList, 'cocoapods/sandbox/path_list'
|
@@ -64,7 +53,7 @@ module Pod
|
|
64
53
|
def initialize(root)
|
65
54
|
FileUtils.mkdir_p(root)
|
66
55
|
@root = Pathname.new(root).realpath
|
67
|
-
@public_headers = HeadersStore.new(self,
|
56
|
+
@public_headers = HeadersStore.new(self, 'Public')
|
68
57
|
@predownloaded_pods = []
|
69
58
|
@head_pods = []
|
70
59
|
@checkout_sources = {}
|
@@ -83,14 +72,6 @@ module Pod
|
|
83
72
|
#
|
84
73
|
attr_accessor :project
|
85
74
|
|
86
|
-
# Removes the sandbox.
|
87
|
-
#
|
88
|
-
# @return [void]
|
89
|
-
#
|
90
|
-
def implode
|
91
|
-
root.rmtree
|
92
|
-
end
|
93
|
-
|
94
75
|
# Removes the files of the Pod with the given name from the sandbox.
|
95
76
|
#
|
96
77
|
# @return [void]
|
@@ -105,6 +86,19 @@ module Pod
|
|
105
86
|
podspe_path.rmtree if podspe_path
|
106
87
|
end
|
107
88
|
|
89
|
+
# Prepares the sandbox for a new installation removing any file that will
|
90
|
+
# be regenerated and ensuring that the directories exists.
|
91
|
+
#
|
92
|
+
def prepare
|
93
|
+
FileUtils.rm_rf(headers_root)
|
94
|
+
FileUtils.rm_rf(target_support_files_root)
|
95
|
+
|
96
|
+
FileUtils.mkdir_p(headers_root)
|
97
|
+
FileUtils.mkdir_p(sources_root)
|
98
|
+
FileUtils.mkdir_p(specifications_root)
|
99
|
+
FileUtils.mkdir_p(target_support_files_root)
|
100
|
+
end
|
101
|
+
|
108
102
|
# @return [String] a string representation suitable for debugging.
|
109
103
|
#
|
110
104
|
def inspect
|
@@ -120,26 +114,25 @@ module Pod
|
|
120
114
|
# @return [Pathname] the path of the manifest.
|
121
115
|
#
|
122
116
|
def manifest_path
|
123
|
-
root +
|
117
|
+
root + 'Manifest.lock'
|
124
118
|
end
|
125
119
|
|
126
120
|
# @return [Pathname] the path of the Pods project.
|
127
121
|
#
|
128
122
|
def project_path
|
129
|
-
root +
|
123
|
+
root + 'Pods.xcodeproj'
|
130
124
|
end
|
131
125
|
|
132
|
-
# Returns the path for the directory where
|
133
|
-
# a target.
|
126
|
+
# Returns the path for the directory where the support files of
|
127
|
+
# a target are stored.
|
134
128
|
#
|
135
129
|
# @param [String] name
|
136
130
|
# The name of the target.
|
137
131
|
#
|
138
132
|
# @return [Pathname] the path of the support files.
|
139
133
|
#
|
140
|
-
def
|
141
|
-
|
142
|
-
root
|
134
|
+
def target_support_files_dir(name)
|
135
|
+
target_support_files_root + name
|
143
136
|
end
|
144
137
|
|
145
138
|
# Returns the path where the Pod with the given name is stored, taking into
|
@@ -155,8 +148,7 @@ module Pod
|
|
155
148
|
if local?(root_name)
|
156
149
|
Pathname.new(development_pods[root_name])
|
157
150
|
else
|
158
|
-
|
159
|
-
root + root_name
|
151
|
+
sources_root + root_name
|
160
152
|
end
|
161
153
|
end
|
162
154
|
|
@@ -170,10 +162,31 @@ module Pod
|
|
170
162
|
@pods_with_absolute_path.include? name
|
171
163
|
end
|
172
164
|
|
173
|
-
# @return [Pathname]
|
165
|
+
# @return [Pathname] The directory where headers are stored.
|
166
|
+
#
|
167
|
+
def headers_root
|
168
|
+
root + 'Headers'
|
169
|
+
end
|
170
|
+
|
171
|
+
# @return [Pathname] The directory where the downloaded sources of
|
172
|
+
# the Pods are stored.
|
173
|
+
#
|
174
|
+
def sources_root
|
175
|
+
root
|
176
|
+
end
|
177
|
+
|
178
|
+
# @return [Pathname] the path for the directory where the
|
179
|
+
# specifications are stored.
|
180
|
+
#
|
181
|
+
def specifications_root
|
182
|
+
root + 'Local Podspecs'
|
183
|
+
end
|
184
|
+
|
185
|
+
# @return [Pathname] The directory where the files generated by
|
186
|
+
# CocoaPods to support the umbrella targets are stored.
|
174
187
|
#
|
175
|
-
def
|
176
|
-
root + '
|
188
|
+
def target_support_files_root
|
189
|
+
root + 'Target Support Files'
|
177
190
|
end
|
178
191
|
|
179
192
|
#-------------------------------------------------------------------------#
|
@@ -191,21 +204,11 @@ module Pod
|
|
191
204
|
#
|
192
205
|
def specification(name)
|
193
206
|
if file = specification_path(name)
|
194
|
-
|
207
|
+
original_path = development_pods[name]
|
208
|
+
Dir.chdir(original_path || Dir.pwd) { Specification.from_file(file) }
|
195
209
|
end
|
196
210
|
end
|
197
211
|
|
198
|
-
# @return [Pathname] the path for the directory where to store the
|
199
|
-
# specifications.
|
200
|
-
#
|
201
|
-
# @todo Migrate old installations and store the for all the pods.
|
202
|
-
# Two folders should be created `External Sources` and `Podspecs`.
|
203
|
-
#
|
204
|
-
def specifications_dir(external_source = false)
|
205
|
-
# root + "Specifications"
|
206
|
-
root + "Local Podspecs"
|
207
|
-
end
|
208
|
-
|
209
212
|
# Returns the path of the specification for the Pod with the
|
210
213
|
# given name, if one is stored.
|
211
214
|
#
|
@@ -216,11 +219,11 @@ module Pod
|
|
216
219
|
# @return [Nil] if the podspec is not stored.
|
217
220
|
#
|
218
221
|
def specification_path(name)
|
219
|
-
path =
|
222
|
+
path = specifications_root + "#{name}.podspec"
|
220
223
|
if path.exist?
|
221
224
|
path
|
222
225
|
else
|
223
|
-
path =
|
226
|
+
path = specifications_root + "#{name}.podspec.json"
|
224
227
|
if path.exist?
|
225
228
|
path
|
226
229
|
else
|
@@ -241,9 +244,9 @@ module Pod
|
|
241
244
|
# @todo Store all the specifications (including those not originating
|
242
245
|
# from external sources) so users can check them.
|
243
246
|
#
|
244
|
-
def store_podspec(name, podspec,
|
247
|
+
def store_podspec(name, podspec, _external_source = false, json = false)
|
245
248
|
file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
|
246
|
-
output_path =
|
249
|
+
output_path = specifications_root + file_name
|
247
250
|
output_path.dirname.mkpath
|
248
251
|
if podspec.is_a?(String)
|
249
252
|
output_path.open('w') { |f| f.puts(podspec) }
|
@@ -253,9 +256,13 @@ module Pod
|
|
253
256
|
end
|
254
257
|
FileUtils.copy(podspec, output_path)
|
255
258
|
end
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
+
|
260
|
+
Dir.chdir(podspec.is_a?(Pathname) ? File.dirname(podspec) : Dir.pwd) do
|
261
|
+
spec = Specification.from_file(output_path)
|
262
|
+
|
263
|
+
unless spec.name == name
|
264
|
+
raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
|
265
|
+
end
|
259
266
|
end
|
260
267
|
end
|
261
268
|
|
@@ -390,7 +397,5 @@ module Pod
|
|
390
397
|
end
|
391
398
|
|
392
399
|
#-------------------------------------------------------------------------#
|
393
|
-
|
394
400
|
end
|
395
401
|
end
|
396
|
-
|