xcocoapods 1.5.3
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 +7 -0
- data/CHANGELOG.md +6303 -0
- data/LICENSE +28 -0
- data/README.md +80 -0
- data/bin/pod +56 -0
- data/bin/sandbox-pod +168 -0
- data/lib/cocoapods.rb +73 -0
- data/lib/cocoapods/command.rb +175 -0
- data/lib/cocoapods/command/cache.rb +28 -0
- data/lib/cocoapods/command/cache/clean.rb +90 -0
- data/lib/cocoapods/command/cache/list.rb +69 -0
- data/lib/cocoapods/command/env.rb +66 -0
- data/lib/cocoapods/command/init.rb +128 -0
- data/lib/cocoapods/command/install.rb +45 -0
- data/lib/cocoapods/command/ipc.rb +19 -0
- data/lib/cocoapods/command/ipc/list.rb +40 -0
- data/lib/cocoapods/command/ipc/podfile.rb +31 -0
- data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
- data/lib/cocoapods/command/ipc/repl.rb +51 -0
- data/lib/cocoapods/command/ipc/spec.rb +29 -0
- data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
- data/lib/cocoapods/command/lib.rb +11 -0
- data/lib/cocoapods/command/lib/create.rb +105 -0
- data/lib/cocoapods/command/lib/lint.rb +121 -0
- data/lib/cocoapods/command/list.rb +39 -0
- data/lib/cocoapods/command/options/project_directory.rb +36 -0
- data/lib/cocoapods/command/options/repo_update.rb +34 -0
- data/lib/cocoapods/command/outdated.rb +140 -0
- data/lib/cocoapods/command/repo.rb +29 -0
- data/lib/cocoapods/command/repo/add.rb +103 -0
- data/lib/cocoapods/command/repo/lint.rb +82 -0
- data/lib/cocoapods/command/repo/list.rb +93 -0
- data/lib/cocoapods/command/repo/push.rb +281 -0
- data/lib/cocoapods/command/repo/remove.rb +36 -0
- data/lib/cocoapods/command/repo/update.rb +28 -0
- data/lib/cocoapods/command/setup.rb +103 -0
- data/lib/cocoapods/command/spec.rb +112 -0
- data/lib/cocoapods/command/spec/cat.rb +51 -0
- data/lib/cocoapods/command/spec/create.rb +283 -0
- data/lib/cocoapods/command/spec/edit.rb +87 -0
- data/lib/cocoapods/command/spec/env_spec.rb +53 -0
- data/lib/cocoapods/command/spec/lint.rb +137 -0
- data/lib/cocoapods/command/spec/which.rb +43 -0
- data/lib/cocoapods/command/update.rb +101 -0
- data/lib/cocoapods/config.rb +347 -0
- data/lib/cocoapods/core_overrides.rb +1 -0
- data/lib/cocoapods/downloader.rb +190 -0
- data/lib/cocoapods/downloader/cache.rb +233 -0
- data/lib/cocoapods/downloader/request.rb +86 -0
- data/lib/cocoapods/downloader/response.rb +16 -0
- data/lib/cocoapods/executable.rb +222 -0
- data/lib/cocoapods/external_sources.rb +57 -0
- data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
- data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
- data/lib/cocoapods/external_sources/path_source.rb +55 -0
- data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
- data/lib/cocoapods/gem_version.rb +5 -0
- data/lib/cocoapods/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
- data/lib/cocoapods/generator/app_target_helper.rb +244 -0
- data/lib/cocoapods/generator/bridge_support.rb +22 -0
- data/lib/cocoapods/generator/constant.rb +19 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
- data/lib/cocoapods/generator/dummy_source.rb +31 -0
- data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
- data/lib/cocoapods/generator/header.rb +103 -0
- data/lib/cocoapods/generator/info_plist_file.rb +116 -0
- data/lib/cocoapods/generator/module_map.rb +99 -0
- data/lib/cocoapods/generator/prefix_header.rb +60 -0
- data/lib/cocoapods/generator/umbrella_header.rb +46 -0
- data/lib/cocoapods/hooks_manager.rb +132 -0
- data/lib/cocoapods/installer.rb +703 -0
- data/lib/cocoapods/installer/analyzer.rb +972 -0
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
- data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
- data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
- data/lib/cocoapods/installer/installation_options.rb +158 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
- data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
- data/lib/cocoapods/installer/podfile_validator.rb +139 -0
- data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
- data/lib/cocoapods/installer/xcode.rb +8 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
- data/lib/cocoapods/open-uri.rb +33 -0
- data/lib/cocoapods/project.rb +414 -0
- data/lib/cocoapods/resolver.rb +585 -0
- data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
- data/lib/cocoapods/sandbox.rb +404 -0
- data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
- data/lib/cocoapods/sandbox/headers_store.rb +146 -0
- data/lib/cocoapods/sandbox/path_list.rb +220 -0
- data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
- data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
- data/lib/cocoapods/sources_manager.rb +157 -0
- data/lib/cocoapods/target.rb +261 -0
- data/lib/cocoapods/target/aggregate_target.rb +338 -0
- data/lib/cocoapods/target/build_settings.rb +1075 -0
- data/lib/cocoapods/target/pod_target.rb +559 -0
- data/lib/cocoapods/user_interface.rb +459 -0
- data/lib/cocoapods/user_interface/error_report.rb +187 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/validator.rb +981 -0
- metadata +533 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'delegate'
|
|
2
|
+
module Pod
|
|
3
|
+
class Specification
|
|
4
|
+
class Set
|
|
5
|
+
class SpecWithSource < DelegateClass(Specification)
|
|
6
|
+
attr_reader :spec_source
|
|
7
|
+
def initialize(spec, source)
|
|
8
|
+
super(spec)
|
|
9
|
+
@spec_source = source
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
undef is_a?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class LazySpecification < DelegateClass(Specification)
|
|
16
|
+
attr_reader :name, :version, :spec_source
|
|
17
|
+
|
|
18
|
+
def initialize(name, version, spec_source)
|
|
19
|
+
@name = name
|
|
20
|
+
@version = version
|
|
21
|
+
@spec_source = spec_source
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def subspec_by_name(name = nil, raise_if_missing = true, include_test_specifications = false)
|
|
25
|
+
subspec =
|
|
26
|
+
if !name || name == self.name
|
|
27
|
+
self
|
|
28
|
+
else
|
|
29
|
+
specification.subspec_by_name(name, raise_if_missing, include_test_specifications)
|
|
30
|
+
end
|
|
31
|
+
return unless subspec
|
|
32
|
+
|
|
33
|
+
SpecWithSource.new subspec, spec_source
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def specification
|
|
37
|
+
@specification ||= spec_source.specification(name, version.version)
|
|
38
|
+
end
|
|
39
|
+
alias __getobj__ specification
|
|
40
|
+
|
|
41
|
+
undef is_a?
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class External
|
|
45
|
+
def all_specifications(_warn_for_multiple_pod_sources)
|
|
46
|
+
[specification]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# returns the highest versioned spec last
|
|
51
|
+
def all_specifications(warn_for_multiple_pod_sources)
|
|
52
|
+
@all_specifications ||= begin
|
|
53
|
+
sources_by_version = {}
|
|
54
|
+
versions_by_source.each do |source, versions|
|
|
55
|
+
versions.each { |v| (sources_by_version[v] ||= []) << source }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
if warn_for_multiple_pod_sources
|
|
59
|
+
duplicate_versions = sources_by_version.select { |_version, sources| sources.count > 1 }
|
|
60
|
+
|
|
61
|
+
duplicate_versions.each do |version, sources|
|
|
62
|
+
UI.warn "Found multiple specifications for `#{name} (#{version})`:\n" +
|
|
63
|
+
sources.
|
|
64
|
+
map { |s| s.specification_path(name, version) }.
|
|
65
|
+
map { |v| "- #{v}" }.join("\n")
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# sort versions from high to low
|
|
70
|
+
sources_by_version.sort_by(&:first).flat_map do |version, sources|
|
|
71
|
+
# within each version, we want the prefered (first-specified) source
|
|
72
|
+
# to be the _last_ one
|
|
73
|
+
sources.reverse_each.map { |source| LazySpecification.new(name, version, source) }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
3
|
+
module Pod
|
|
4
|
+
# The sandbox provides support for the directory that CocoaPods uses for an
|
|
5
|
+
# installation. In this directory the Pods projects, the support files and
|
|
6
|
+
# the sources of the Pods are stored.
|
|
7
|
+
#
|
|
8
|
+
# CocoaPods assumes to have control of the sandbox.
|
|
9
|
+
#
|
|
10
|
+
# Once completed the sandbox will have the following file structure:
|
|
11
|
+
#
|
|
12
|
+
# Pods
|
|
13
|
+
# |
|
|
14
|
+
# +-- Headers
|
|
15
|
+
# | +-- Private
|
|
16
|
+
# | | +-- [Pod Name]
|
|
17
|
+
# | +-- Public
|
|
18
|
+
# | +-- [Pod Name]
|
|
19
|
+
# |
|
|
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
|
|
37
|
+
#
|
|
38
|
+
class Sandbox
|
|
39
|
+
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
|
|
40
|
+
autoload :HeadersStore, 'cocoapods/sandbox/headers_store'
|
|
41
|
+
autoload :PathList, 'cocoapods/sandbox/path_list'
|
|
42
|
+
autoload :PodDirCleaner, 'cocoapods/sandbox/pod_dir_cleaner'
|
|
43
|
+
autoload :PodspecFinder, 'cocoapods/sandbox/podspec_finder'
|
|
44
|
+
|
|
45
|
+
# @return [Pathname] the root of the sandbox.
|
|
46
|
+
#
|
|
47
|
+
attr_reader :root
|
|
48
|
+
|
|
49
|
+
# @return [HeadersStore] the header directory for the user targets.
|
|
50
|
+
#
|
|
51
|
+
attr_reader :public_headers
|
|
52
|
+
|
|
53
|
+
# Initialize a new instance
|
|
54
|
+
#
|
|
55
|
+
# @param [String, Pathname] root @see #root
|
|
56
|
+
#
|
|
57
|
+
def initialize(root)
|
|
58
|
+
FileUtils.mkdir_p(root)
|
|
59
|
+
@root = Pathname.new(root).realpath
|
|
60
|
+
@public_headers = HeadersStore.new(self, 'Public', :public)
|
|
61
|
+
@predownloaded_pods = []
|
|
62
|
+
@checkout_sources = {}
|
|
63
|
+
@development_pods = {}
|
|
64
|
+
@pods_with_absolute_path = []
|
|
65
|
+
@stored_podspecs = {}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @return [Lockfile] the manifest which contains the information about the
|
|
69
|
+
# installed pods.
|
|
70
|
+
#
|
|
71
|
+
attr_accessor :manifest
|
|
72
|
+
|
|
73
|
+
def manifest
|
|
74
|
+
@manifest ||= begin
|
|
75
|
+
Lockfile.from_file(manifest_path) if manifest_path.exist?
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @return [Project] the Pods project.
|
|
80
|
+
#
|
|
81
|
+
attr_accessor :project
|
|
82
|
+
|
|
83
|
+
# Removes the files of the Pod with the given name from the sandbox.
|
|
84
|
+
#
|
|
85
|
+
# @return [void]
|
|
86
|
+
#
|
|
87
|
+
def clean_pod(name)
|
|
88
|
+
root_name = Specification.root_name(name)
|
|
89
|
+
unless local?(root_name)
|
|
90
|
+
path = pod_dir(name)
|
|
91
|
+
path.rmtree if path.exist?
|
|
92
|
+
end
|
|
93
|
+
podspec_path = specification_path(name)
|
|
94
|
+
podspec_path.rmtree if podspec_path
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Prepares the sandbox for a new installation removing any file that will
|
|
98
|
+
# be regenerated and ensuring that the directories exists.
|
|
99
|
+
#
|
|
100
|
+
def prepare
|
|
101
|
+
FileUtils.rm_rf(headers_root)
|
|
102
|
+
|
|
103
|
+
FileUtils.mkdir_p(headers_root)
|
|
104
|
+
FileUtils.mkdir_p(sources_root)
|
|
105
|
+
FileUtils.mkdir_p(specifications_root)
|
|
106
|
+
FileUtils.mkdir_p(target_support_files_root)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# @return [String] a string representation suitable for debugging.
|
|
110
|
+
#
|
|
111
|
+
def inspect
|
|
112
|
+
"#<#{self.class}> with root #{root}"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
#-------------------------------------------------------------------------#
|
|
116
|
+
|
|
117
|
+
public
|
|
118
|
+
|
|
119
|
+
# @!group Paths
|
|
120
|
+
|
|
121
|
+
# @return [Pathname] the path of the manifest.
|
|
122
|
+
#
|
|
123
|
+
def manifest_path
|
|
124
|
+
root + 'Manifest.lock'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# @return [Pathname] the path of the Pods project.
|
|
128
|
+
#
|
|
129
|
+
def project_path
|
|
130
|
+
root + 'Pods.xcodeproj'
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Returns the path for the directory where the support files of
|
|
134
|
+
# a target are stored.
|
|
135
|
+
#
|
|
136
|
+
# @param [String] name
|
|
137
|
+
# The name of the target.
|
|
138
|
+
#
|
|
139
|
+
# @return [Pathname] the path of the support files.
|
|
140
|
+
#
|
|
141
|
+
def target_support_files_dir(name)
|
|
142
|
+
target_support_files_root + name
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Returns the path where the Pod with the given name is stored, taking into
|
|
146
|
+
# account whether the Pod is locally sourced.
|
|
147
|
+
#
|
|
148
|
+
# @param [String] name
|
|
149
|
+
# The name of the Pod.
|
|
150
|
+
#
|
|
151
|
+
# @return [Pathname] the path of the Pod.
|
|
152
|
+
#
|
|
153
|
+
def pod_dir(name)
|
|
154
|
+
root_name = Specification.root_name(name)
|
|
155
|
+
if local?(root_name)
|
|
156
|
+
Pathname.new(development_pods[root_name].dirname)
|
|
157
|
+
else
|
|
158
|
+
sources_root + root_name
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Returns true if the path as originally specified was absolute.
|
|
163
|
+
#
|
|
164
|
+
# @param [String] name
|
|
165
|
+
#
|
|
166
|
+
# @return [Bool] true if originally absolute
|
|
167
|
+
#
|
|
168
|
+
def local_path_was_absolute?(name)
|
|
169
|
+
@pods_with_absolute_path.include? name
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @return [Pathname] The directory where headers are stored.
|
|
173
|
+
#
|
|
174
|
+
def headers_root
|
|
175
|
+
root + 'Headers'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# @return [Pathname] The directory where the downloaded sources of
|
|
179
|
+
# the Pods are stored.
|
|
180
|
+
#
|
|
181
|
+
def sources_root
|
|
182
|
+
root
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# @return [Pathname] the path for the directory where the
|
|
186
|
+
# specifications are stored.
|
|
187
|
+
#
|
|
188
|
+
def specifications_root
|
|
189
|
+
root + 'Local Podspecs'
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# @return [Pathname] The directory where the files generated by
|
|
193
|
+
# CocoaPods to support the umbrella targets are stored.
|
|
194
|
+
#
|
|
195
|
+
def target_support_files_root
|
|
196
|
+
root + 'Target Support Files'
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
#-------------------------------------------------------------------------#
|
|
200
|
+
|
|
201
|
+
public
|
|
202
|
+
|
|
203
|
+
# @!group Specification store
|
|
204
|
+
|
|
205
|
+
# Returns the specification for the Pod with the given name.
|
|
206
|
+
#
|
|
207
|
+
# @param [String] name
|
|
208
|
+
# the name of the Pod for which the specification is requested.
|
|
209
|
+
#
|
|
210
|
+
# @return [Specification] the specification if the file is found.
|
|
211
|
+
#
|
|
212
|
+
def specification(name)
|
|
213
|
+
@stored_podspecs[name] ||= if file = specification_path(name)
|
|
214
|
+
original_path = development_pods[name]
|
|
215
|
+
Specification.from_file(original_path || file)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Returns the path of the specification for the Pod with the
|
|
220
|
+
# given name, if one is stored.
|
|
221
|
+
#
|
|
222
|
+
# @param [String] name
|
|
223
|
+
# the name of the Pod for which the podspec file is requested.
|
|
224
|
+
#
|
|
225
|
+
# @return [Pathname] the path or nil.
|
|
226
|
+
# @return [Nil] if the podspec is not stored.
|
|
227
|
+
#
|
|
228
|
+
def specification_path(name)
|
|
229
|
+
name = Specification.root_name(name)
|
|
230
|
+
path = specifications_root + "#{name}.podspec"
|
|
231
|
+
if path.exist?
|
|
232
|
+
path
|
|
233
|
+
else
|
|
234
|
+
path = specifications_root + "#{name}.podspec.json"
|
|
235
|
+
if path.exist?
|
|
236
|
+
path
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Stores a specification in the `Local Podspecs` folder.
|
|
242
|
+
#
|
|
243
|
+
# @param [String] name
|
|
244
|
+
# the name of the pod
|
|
245
|
+
#
|
|
246
|
+
# @param [String, Pathname, Specification] podspec
|
|
247
|
+
# The contents of the specification (String) or the path to a
|
|
248
|
+
# podspec file (Pathname).
|
|
249
|
+
#
|
|
250
|
+
# @return [void]
|
|
251
|
+
#
|
|
252
|
+
#
|
|
253
|
+
def store_podspec(name, podspec, _external_source = false, json = false)
|
|
254
|
+
file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
|
|
255
|
+
output_path = specifications_root + file_name
|
|
256
|
+
|
|
257
|
+
case podspec
|
|
258
|
+
when String
|
|
259
|
+
output_path.open('w') { |f| f.puts(podspec) }
|
|
260
|
+
when Pathname
|
|
261
|
+
unless podspec.exist?
|
|
262
|
+
raise Informative, "No podspec found for `#{name}` in #{podspec}"
|
|
263
|
+
end
|
|
264
|
+
spec = Specification.from_file(podspec)
|
|
265
|
+
FileUtils.copy(podspec, output_path)
|
|
266
|
+
when Specification
|
|
267
|
+
raise ArgumentError, 'can only store Specification objects as json' unless json
|
|
268
|
+
output_path.open('w') { |f| f.puts(podspec.to_pretty_json) }
|
|
269
|
+
spec = podspec.dup
|
|
270
|
+
else
|
|
271
|
+
raise ArgumentError, "Unknown type for podspec: #{podspec.inspect}"
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
spec ||= Specification.from_file(output_path)
|
|
275
|
+
spec.defined_in_file ||= output_path
|
|
276
|
+
|
|
277
|
+
unless spec.name == name
|
|
278
|
+
raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
|
|
279
|
+
end
|
|
280
|
+
@stored_podspecs[spec.name] = spec
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
#-------------------------------------------------------------------------#
|
|
284
|
+
|
|
285
|
+
public
|
|
286
|
+
|
|
287
|
+
# @!group Pods information
|
|
288
|
+
|
|
289
|
+
# Marks a Pod as pre-downloaded
|
|
290
|
+
#
|
|
291
|
+
# @param [String] name
|
|
292
|
+
# The name of the Pod.
|
|
293
|
+
#
|
|
294
|
+
# @return [void]
|
|
295
|
+
#
|
|
296
|
+
def store_pre_downloaded_pod(name)
|
|
297
|
+
root_name = Specification.root_name(name)
|
|
298
|
+
predownloaded_pods << root_name
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# @return [Array<String>] The names of the pods that have been
|
|
302
|
+
# pre-downloaded from an external source.
|
|
303
|
+
#
|
|
304
|
+
attr_reader :predownloaded_pods
|
|
305
|
+
|
|
306
|
+
# Checks if a Pod has been pre-downloaded by the resolver in order to fetch
|
|
307
|
+
# the podspec.
|
|
308
|
+
#
|
|
309
|
+
# @param [String] name
|
|
310
|
+
# The name of the Pod.
|
|
311
|
+
#
|
|
312
|
+
# @return [Bool] Whether the Pod has been pre-downloaded.
|
|
313
|
+
#
|
|
314
|
+
def predownloaded?(name)
|
|
315
|
+
root_name = Specification.root_name(name)
|
|
316
|
+
predownloaded_pods.include?(root_name)
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
#--------------------------------------#
|
|
320
|
+
|
|
321
|
+
# Stores the local path of a Pod.
|
|
322
|
+
#
|
|
323
|
+
# @param [String] name
|
|
324
|
+
# The name of the Pod.
|
|
325
|
+
#
|
|
326
|
+
# @param [Hash] source
|
|
327
|
+
# The hash which contains the options as returned by the
|
|
328
|
+
# downloader.
|
|
329
|
+
#
|
|
330
|
+
# @return [void]
|
|
331
|
+
#
|
|
332
|
+
def store_checkout_source(name, source)
|
|
333
|
+
root_name = Specification.root_name(name)
|
|
334
|
+
checkout_sources[root_name] = source
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Removes the checkout source of a Pod.
|
|
338
|
+
#
|
|
339
|
+
# @param [String] name
|
|
340
|
+
# The name of the Pod.
|
|
341
|
+
#
|
|
342
|
+
# @return [void]
|
|
343
|
+
#
|
|
344
|
+
def remove_checkout_source(name)
|
|
345
|
+
root_name = Specification.root_name(name)
|
|
346
|
+
checkout_sources.delete(root_name)
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# @return [Hash{String=>Hash}] The options necessary to recreate the exact
|
|
350
|
+
# checkout of a given Pod grouped by its name.
|
|
351
|
+
#
|
|
352
|
+
attr_reader :checkout_sources
|
|
353
|
+
|
|
354
|
+
#--------------------------------------#
|
|
355
|
+
|
|
356
|
+
# Stores the local path of a Pod.
|
|
357
|
+
#
|
|
358
|
+
# @param [String] name
|
|
359
|
+
# The name of the Pod.
|
|
360
|
+
#
|
|
361
|
+
# @param [Pathname, String] path
|
|
362
|
+
# The path to the local Podspec
|
|
363
|
+
#
|
|
364
|
+
# @param [Bool] was_absolute
|
|
365
|
+
# True if the specified local path was absolute.
|
|
366
|
+
#
|
|
367
|
+
# @return [void]
|
|
368
|
+
#
|
|
369
|
+
def store_local_path(name, path, was_absolute = false)
|
|
370
|
+
root_name = Specification.root_name(name)
|
|
371
|
+
path = Pathname.new(path) unless path.is_a?(Pathname)
|
|
372
|
+
development_pods[root_name] = path
|
|
373
|
+
@pods_with_absolute_path << root_name if was_absolute
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
# @return [Hash{String=>Pathname}] The path of the Pods' podspecs with a local source
|
|
377
|
+
# grouped by their root name.
|
|
378
|
+
#
|
|
379
|
+
attr_reader :development_pods
|
|
380
|
+
|
|
381
|
+
# Checks if a Pod is locally sourced?
|
|
382
|
+
#
|
|
383
|
+
# @param [String] name
|
|
384
|
+
# The name of the Pod.
|
|
385
|
+
#
|
|
386
|
+
# @return [Bool] Whether the Pod is locally sourced.
|
|
387
|
+
#
|
|
388
|
+
def local?(name)
|
|
389
|
+
!local_podspec(name).nil?
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
# @param [String] name
|
|
393
|
+
# The name of a locally specified Pod
|
|
394
|
+
#
|
|
395
|
+
# @return [Pathname] Path to the local Podspec of the Pod
|
|
396
|
+
#
|
|
397
|
+
def local_podspec(name)
|
|
398
|
+
root_name = Specification.root_name(name)
|
|
399
|
+
development_pods[root_name]
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
#-------------------------------------------------------------------------#
|
|
403
|
+
end
|
|
404
|
+
end
|