cocoapods-tt 0.0.1
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/lib/cocoapods-tt/command/native/install.rb +56 -0
- data/lib/cocoapods-tt/command/native/update.rb +157 -0
- data/lib/cocoapods-tt/command/tt/make.rb +92 -0
- data/lib/cocoapods-tt/command/tt.rb +115 -0
- data/lib/cocoapods-tt/command.rb +1 -0
- data/lib/cocoapods-tt/gem_version.rb +3 -0
- data/lib/cocoapods-tt/native/command.rb +185 -0
- data/lib/cocoapods-tt/native/config.rb +366 -0
- data/lib/cocoapods-tt/native/core_overrides.rb +1 -0
- data/lib/cocoapods-tt/native/downloader/cache.rb +322 -0
- data/lib/cocoapods-tt/native/downloader/request.rb +86 -0
- data/lib/cocoapods-tt/native/downloader/response.rb +16 -0
- data/lib/cocoapods-tt/native/downloader.rb +192 -0
- data/lib/cocoapods-tt/native/executable.rb +247 -0
- data/lib/cocoapods-tt/native/external_sources/abstract_external_source.rb +205 -0
- data/lib/cocoapods-tt/native/external_sources/downloader_source.rb +30 -0
- data/lib/cocoapods-tt/native/external_sources/path_source.rb +55 -0
- data/lib/cocoapods-tt/native/external_sources/podspec_source.rb +54 -0
- data/lib/cocoapods-tt/native/external_sources.rb +57 -0
- data/lib/cocoapods-tt/native/gem_version.rb +5 -0
- data/lib/cocoapods-tt/native/generator/acknowledgements/markdown.rb +44 -0
- data/lib/cocoapods-tt/native/generator/acknowledgements/plist.rb +94 -0
- data/lib/cocoapods-tt/native/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods-tt/native/generator/app_target_helper.rb +363 -0
- data/lib/cocoapods-tt/native/generator/bridge_support.rb +22 -0
- data/lib/cocoapods-tt/native/generator/constant.rb +19 -0
- data/lib/cocoapods-tt/native/generator/copy_dsyms_script.rb +56 -0
- data/lib/cocoapods-tt/native/generator/copy_resources_script.rb +223 -0
- data/lib/cocoapods-tt/native/generator/copy_xcframework_script.rb +227 -0
- data/lib/cocoapods-tt/native/generator/dummy_source.rb +31 -0
- data/lib/cocoapods-tt/native/generator/embed_frameworks_script.rb +196 -0
- data/lib/cocoapods-tt/native/generator/file_list.rb +39 -0
- data/lib/cocoapods-tt/native/generator/header.rb +103 -0
- data/lib/cocoapods-tt/native/generator/info_plist_file.rb +128 -0
- data/lib/cocoapods-tt/native/generator/module_map.rb +99 -0
- data/lib/cocoapods-tt/native/generator/prefix_header.rb +60 -0
- data/lib/cocoapods-tt/native/generator/script_phase_constants.rb +100 -0
- data/lib/cocoapods-tt/native/generator/umbrella_header.rb +46 -0
- data/lib/cocoapods-tt/native/hooks_manager.rb +132 -0
- data/lib/cocoapods-tt/native/installer/analyzer/analysis_result.rb +87 -0
- data/lib/cocoapods-tt/native/installer/analyzer/locking_dependency_analyzer.rb +103 -0
- data/lib/cocoapods-tt/native/installer/analyzer/pod_variant.rb +87 -0
- data/lib/cocoapods-tt/native/installer/analyzer/pod_variant_set.rb +175 -0
- data/lib/cocoapods-tt/native/installer/analyzer/podfile_dependency_cache.rb +55 -0
- data/lib/cocoapods-tt/native/installer/analyzer/sandbox_analyzer.rb +268 -0
- data/lib/cocoapods-tt/native/installer/analyzer/specs_state.rb +108 -0
- data/lib/cocoapods-tt/native/installer/analyzer/target_inspection_result.rb +58 -0
- data/lib/cocoapods-tt/native/installer/analyzer/target_inspector.rb +258 -0
- data/lib/cocoapods-tt/native/installer/analyzer.rb +1204 -0
- data/lib/cocoapods-tt/native/installer/base_install_hooks_context.rb +135 -0
- data/lib/cocoapods-tt/native/installer/installation_options.rb +195 -0
- data/lib/cocoapods-tt/native/installer/pod_source_installer.rb +224 -0
- data/lib/cocoapods-tt/native/installer/pod_source_preparer.rb +77 -0
- data/lib/cocoapods-tt/native/installer/podfile_validator.rb +168 -0
- data/lib/cocoapods-tt/native/installer/post_install_hooks_context.rb +9 -0
- data/lib/cocoapods-tt/native/installer/post_integrate_hooks_context.rb +9 -0
- data/lib/cocoapods-tt/native/installer/pre_install_hooks_context.rb +51 -0
- data/lib/cocoapods-tt/native/installer/pre_integrate_hooks_context.rb +9 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache.rb +11 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analysis_result.rb +53 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analyzer.rb +200 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_cache_version.rb +43 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_installation_cache.rb +103 -0
- data/lib/cocoapods-tt/native/installer/project_cache/project_metadata_cache.rb +73 -0
- data/lib/cocoapods-tt/native/installer/project_cache/target_cache_key.rb +176 -0
- data/lib/cocoapods-tt/native/installer/project_cache/target_metadata.rb +74 -0
- data/lib/cocoapods-tt/native/installer/sandbox_dir_cleaner.rb +105 -0
- data/lib/cocoapods-tt/native/installer/sandbox_header_paths_installer.rb +45 -0
- data/lib/cocoapods-tt/native/installer/source_provider_hooks_context.rb +34 -0
- data/lib/cocoapods-tt/native/installer/target_uuid_generator.rb +34 -0
- data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +179 -0
- data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator.rb +815 -0
- data/lib/cocoapods-tt/native/installer/user_project_integrator.rb +280 -0
- data/lib/cocoapods-tt/native/installer/xcode/multi_pods_project_generator.rb +82 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb +66 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_installer.rb +192 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/app_host_installer.rb +154 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/file_references_installer.rb +329 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +195 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_installer.rb +1239 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_integrator.rb +312 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pods_project_writer.rb +90 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/project_generator.rb +120 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installation_result.rb +140 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer.rb +257 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer_helper.rb +110 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator.rb +291 -0
- data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator_result.rb +54 -0
- data/lib/cocoapods-tt/native/installer/xcode/single_pods_project_generator.rb +38 -0
- data/lib/cocoapods-tt/native/installer/xcode/target_validator.rb +170 -0
- data/lib/cocoapods-tt/native/installer/xcode.rb +11 -0
- data/lib/cocoapods-tt/native/installer.rb +1044 -0
- data/lib/cocoapods-tt/native/native_target_extension.rb +60 -0
- data/lib/cocoapods-tt/native/open-uri.rb +33 -0
- data/lib/cocoapods-tt/native/podfile.rb +13 -0
- data/lib/cocoapods-tt/native/project.rb +544 -0
- data/lib/cocoapods-tt/native/resolver/lazy_specification.rb +88 -0
- data/lib/cocoapods-tt/native/resolver/resolver_specification.rb +41 -0
- data/lib/cocoapods-tt/native/resolver.rb +600 -0
- data/lib/cocoapods-tt/native/sandbox/file_accessor.rb +532 -0
- data/lib/cocoapods-tt/native/sandbox/headers_store.rb +163 -0
- data/lib/cocoapods-tt/native/sandbox/path_list.rb +242 -0
- data/lib/cocoapods-tt/native/sandbox/pod_dir_cleaner.rb +71 -0
- data/lib/cocoapods-tt/native/sandbox/podspec_finder.rb +23 -0
- data/lib/cocoapods-tt/native/sandbox.rb +470 -0
- data/lib/cocoapods-tt/native/sources_manager.rb +221 -0
- data/lib/cocoapods-tt/native/target/aggregate_target.rb +558 -0
- data/lib/cocoapods-tt/native/target/build_settings.rb +1385 -0
- data/lib/cocoapods-tt/native/target/pod_target.rb +1168 -0
- data/lib/cocoapods-tt/native/target.rb +378 -0
- data/lib/cocoapods-tt/native/user_interface/error_report.rb +204 -0
- data/lib/cocoapods-tt/native/user_interface/inspector_reporter.rb +102 -0
- data/lib/cocoapods-tt/native/user_interface.rb +463 -0
- data/lib/cocoapods-tt/native/validator.rb +1170 -0
- data/lib/cocoapods-tt/native/version_metadata.rb +26 -0
- data/lib/cocoapods-tt/native/xcode/framework_paths.rb +54 -0
- data/lib/cocoapods-tt/native/xcode/linkage_analyzer.rb +22 -0
- data/lib/cocoapods-tt/native/xcode/xcframework/xcframework_slice.rb +138 -0
- data/lib/cocoapods-tt/native/xcode/xcframework.rb +99 -0
- data/lib/cocoapods-tt/native/xcode.rb +7 -0
- data/lib/cocoapods-tt.rb +1 -0
- data/lib/cocoapods_plugin.rb +17 -0
- metadata +193 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
module Pod
|
2
|
+
module ExternalSources
|
3
|
+
# Abstract class that defines the common behaviour of external sources.
|
4
|
+
#
|
5
|
+
class AbstractExternalSource
|
6
|
+
# @return [String] the name of the Pod described by this external source.
|
7
|
+
#
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
# @return [Hash{Symbol => String}] the hash representation of the
|
11
|
+
# external source.
|
12
|
+
#
|
13
|
+
attr_reader :params
|
14
|
+
|
15
|
+
# @return [String] the path where the podfile is defined to resolve
|
16
|
+
# relative paths.
|
17
|
+
#
|
18
|
+
attr_reader :podfile_path
|
19
|
+
|
20
|
+
# @return [Boolean] Whether the source is allowed to touch the cache.
|
21
|
+
#
|
22
|
+
attr_reader :can_cache
|
23
|
+
alias_method :can_cache?, :can_cache
|
24
|
+
|
25
|
+
# Initialize a new instance
|
26
|
+
#
|
27
|
+
# @param [String] name @see #name
|
28
|
+
# @param [Hash] params @see #params
|
29
|
+
# @param [String] podfile_path @see #podfile_path
|
30
|
+
# @param [Boolean] can_cache @see #can_cache
|
31
|
+
#
|
32
|
+
def initialize(name, params, podfile_path, can_cache = true)
|
33
|
+
@name = name
|
34
|
+
@params = params
|
35
|
+
@podfile_path = podfile_path
|
36
|
+
@can_cache = can_cache
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [Bool] whether an external source source is equal to another
|
40
|
+
# according to the {#name} and to the {#params}.
|
41
|
+
#
|
42
|
+
def ==(other)
|
43
|
+
return false if other.nil?
|
44
|
+
name == other.name && params == other.params
|
45
|
+
end
|
46
|
+
|
47
|
+
public
|
48
|
+
|
49
|
+
# @!group Subclasses hooks
|
50
|
+
|
51
|
+
# Fetches the external source from the remote according to the params.
|
52
|
+
#
|
53
|
+
# @param [Sandbox] _sandbox
|
54
|
+
# the sandbox where the specification should be stored.
|
55
|
+
#
|
56
|
+
# @return [void]
|
57
|
+
#
|
58
|
+
def fetch(_sandbox)
|
59
|
+
raise 'Abstract method'
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [String] a string representation of the source suitable for UI.
|
63
|
+
#
|
64
|
+
def description
|
65
|
+
raise 'Abstract method'
|
66
|
+
end
|
67
|
+
|
68
|
+
protected
|
69
|
+
|
70
|
+
# Return the normalized path for a podspec for a relative declared path.
|
71
|
+
#
|
72
|
+
# @param [String] declared_path
|
73
|
+
# The path declared in the podfile.
|
74
|
+
#
|
75
|
+
# @return [String] The uri of the podspec appending the name of the file
|
76
|
+
# and expanding it if necessary.
|
77
|
+
#
|
78
|
+
# @note If the declared path is expanded only if the represents a path
|
79
|
+
# relative to the file system.
|
80
|
+
#
|
81
|
+
def normalized_podspec_path(declared_path)
|
82
|
+
extension = File.extname(declared_path)
|
83
|
+
if extension == '.podspec' || extension == '.json'
|
84
|
+
path_with_ext = declared_path
|
85
|
+
else
|
86
|
+
path_with_ext = "#{declared_path}/#{name}.podspec"
|
87
|
+
end
|
88
|
+
podfile_dir = File.dirname(podfile_path || '')
|
89
|
+
File.expand_path(path_with_ext, podfile_dir)
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
# @! Subclasses helpers
|
95
|
+
|
96
|
+
# Pre-downloads a Pod passing the options to the downloader and informing
|
97
|
+
# the sandbox.
|
98
|
+
#
|
99
|
+
# @param [Sandbox] sandbox
|
100
|
+
# The sandbox where the Pod should be downloaded.
|
101
|
+
#
|
102
|
+
# @note To prevent a double download of the repository the pod is
|
103
|
+
# marked as pre-downloaded indicating to the installer that only
|
104
|
+
# clean operations are needed.
|
105
|
+
#
|
106
|
+
# @todo The downloader configuration is the same of the
|
107
|
+
# #{PodSourceInstaller} and it needs to be kept in sync.
|
108
|
+
#
|
109
|
+
# @return [void]
|
110
|
+
#
|
111
|
+
def pre_download(sandbox)
|
112
|
+
title = "Pre-downloading: `#{name}` #{description}"
|
113
|
+
UI.titled_section(title, :verbose_prefix => '-> ') do
|
114
|
+
target = sandbox.pod_dir(name)
|
115
|
+
begin
|
116
|
+
download_result = Downloader.download(download_request, target, :can_cache => can_cache)
|
117
|
+
rescue Pod::DSLError => e
|
118
|
+
raise Informative, "Failed to load '#{name}' podspec: #{e.message}"
|
119
|
+
rescue => e
|
120
|
+
raise Informative, "Failed to download '#{name}': #{e.message}"
|
121
|
+
end
|
122
|
+
|
123
|
+
spec = download_result.spec
|
124
|
+
raise Informative, "Unable to find a specification for '#{name}'." unless spec
|
125
|
+
|
126
|
+
# since the podspec might be cleaned, we want the checksum to refer
|
127
|
+
# to the json in the sandbox
|
128
|
+
spec.defined_in_file = nil
|
129
|
+
|
130
|
+
store_podspec(sandbox, spec)
|
131
|
+
sandbox.store_pre_downloaded_pod(name)
|
132
|
+
sandbox.store_checkout_source(name, download_result.checkout_options)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def download_request
|
137
|
+
Downloader::Request.new(
|
138
|
+
:name => name,
|
139
|
+
:params => params,
|
140
|
+
)
|
141
|
+
end
|
142
|
+
|
143
|
+
# Stores the podspec in the sandbox and marks it as from an external
|
144
|
+
# source.
|
145
|
+
#
|
146
|
+
# @param [Sandbox] sandbox
|
147
|
+
# The sandbox where the specification should be stored.
|
148
|
+
#
|
149
|
+
# @param [Pathname, String, Specification] spec
|
150
|
+
# The path of the specification or its contents.
|
151
|
+
#
|
152
|
+
# @note All the concrete implementations of #{fetch} should invoke this
|
153
|
+
# method.
|
154
|
+
#
|
155
|
+
# @note The sandbox ensures that the podspec exists and that the names
|
156
|
+
# match.
|
157
|
+
#
|
158
|
+
# @return [void]
|
159
|
+
#
|
160
|
+
def store_podspec(sandbox, spec, json = false)
|
161
|
+
begin
|
162
|
+
spec = case spec
|
163
|
+
when Pathname
|
164
|
+
Specification.from_file(spec)
|
165
|
+
when String
|
166
|
+
path = "#{name}.podspec"
|
167
|
+
path << '.json' if json
|
168
|
+
Specification.from_string(spec, path).tap { |s| s.defined_in_file = nil }
|
169
|
+
when Specification
|
170
|
+
spec.dup
|
171
|
+
else
|
172
|
+
raise "Unknown spec type: #{spec}"
|
173
|
+
end
|
174
|
+
rescue Pod::DSLError => e
|
175
|
+
raise Informative, "Failed to load '#{name}' podspec: #{e.message}"
|
176
|
+
end
|
177
|
+
|
178
|
+
validate_podspec(spec)
|
179
|
+
sandbox.store_podspec(name, spec, true, true)
|
180
|
+
end
|
181
|
+
|
182
|
+
def validate_podspec(podspec)
|
183
|
+
defined_in_file = podspec.defined_in_file
|
184
|
+
podspec.defined_in_file = nil
|
185
|
+
|
186
|
+
validator = validator_for_podspec(podspec)
|
187
|
+
validator.quick = true
|
188
|
+
validator.allow_warnings = true
|
189
|
+
validator.ignore_public_only_results = true
|
190
|
+
Config.instance.with_changes(:silent => true) do
|
191
|
+
validator.validate
|
192
|
+
end
|
193
|
+
unless validator.validated?
|
194
|
+
raise Informative, "The `#{name}` pod failed to validate due to #{validator.failure_reason}:\n#{validator.results_message}"
|
195
|
+
end
|
196
|
+
ensure
|
197
|
+
podspec.defined_in_file = defined_in_file
|
198
|
+
end
|
199
|
+
|
200
|
+
def validator_for_podspec(podspec)
|
201
|
+
Validator.new(podspec, [], [])
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Pod
|
2
|
+
module ExternalSources
|
3
|
+
# Provides support for fetching a specification file from a source handled
|
4
|
+
# by the downloader. Supports all the options of the downloader
|
5
|
+
#
|
6
|
+
# @note The podspec must be in the root of the repository and should have a
|
7
|
+
# name matching the one of the dependency.
|
8
|
+
#
|
9
|
+
class DownloaderSource < AbstractExternalSource
|
10
|
+
# @see AbstractExternalSource#fetch
|
11
|
+
#
|
12
|
+
def fetch(sandbox)
|
13
|
+
pre_download(sandbox)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @see AbstractExternalSource#description
|
17
|
+
#
|
18
|
+
def description
|
19
|
+
strategy = Downloader.strategy_from_options(params)
|
20
|
+
options = params.dup
|
21
|
+
url = options.delete(strategy)
|
22
|
+
result = "from `#{url}`"
|
23
|
+
options.each do |key, value|
|
24
|
+
result << ", #{key} `#{value}`"
|
25
|
+
end
|
26
|
+
result
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Pod
|
2
|
+
module ExternalSources
|
3
|
+
# Provides support for fetching a specification file from a path local to
|
4
|
+
# the machine running the installation.
|
5
|
+
#
|
6
|
+
class PathSource < AbstractExternalSource
|
7
|
+
# @see AbstractExternalSource#fetch
|
8
|
+
#
|
9
|
+
def fetch(sandbox)
|
10
|
+
title = "Fetching podspec for `#{name}` #{description}"
|
11
|
+
UI.section(title, '-> ') do
|
12
|
+
podspec = podspec_path
|
13
|
+
unless podspec.exist?
|
14
|
+
raise Informative, "No podspec found for `#{name}` in " \
|
15
|
+
"`#{declared_path}`"
|
16
|
+
end
|
17
|
+
store_podspec(sandbox, podspec, podspec.extname == '.json')
|
18
|
+
is_absolute = absolute?(declared_path)
|
19
|
+
sandbox.store_local_path(name, podspec, is_absolute)
|
20
|
+
sandbox.remove_checkout_source(name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @see AbstractExternalSource#description
|
25
|
+
#
|
26
|
+
def description
|
27
|
+
"from `#{declared_path}`"
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# @!group Helpers
|
33
|
+
|
34
|
+
# @return [String] The path as declared by the user.
|
35
|
+
#
|
36
|
+
def declared_path
|
37
|
+
result = params[:path]
|
38
|
+
result.to_s if result
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Pathname] The absolute path of the podspec.
|
42
|
+
#
|
43
|
+
def podspec_path
|
44
|
+
path = Pathname(normalized_podspec_path(declared_path))
|
45
|
+
path.exist? ? path : Pathname("#{path}.json")
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Bool]
|
49
|
+
#
|
50
|
+
def absolute?(path)
|
51
|
+
Pathname(path).absolute? || path.to_s.start_with?('~')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Pod
|
2
|
+
module ExternalSources
|
3
|
+
# Provides support for fetching a specification file from an URL. Can be
|
4
|
+
# http, file, etc.
|
5
|
+
#
|
6
|
+
class PodspecSource < AbstractExternalSource
|
7
|
+
# @see AbstractExternalSource#fetch
|
8
|
+
#
|
9
|
+
def fetch(sandbox)
|
10
|
+
title = "Fetching podspec for `#{name}` #{description}"
|
11
|
+
UI.titled_section(title, :verbose_prefix => '-> ') do
|
12
|
+
podspec_path = Pathname(podspec_uri)
|
13
|
+
is_json = podspec_path.extname == '.json'
|
14
|
+
if podspec_path.exist?
|
15
|
+
store_podspec(sandbox, podspec_path, is_json)
|
16
|
+
else
|
17
|
+
require 'cocoapods/open-uri'
|
18
|
+
begin
|
19
|
+
OpenURI.open_uri(podspec_uri) { |io| store_podspec(sandbox, io.read, is_json) }
|
20
|
+
rescue OpenURI::HTTPError => e
|
21
|
+
status = e.io.status.join(' ')
|
22
|
+
raise Informative, "Failed to fetch podspec for `#{name}` at `#{podspec_uri}`.\n Error: #{status}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# @see AbstractExternalSource#description
|
29
|
+
#
|
30
|
+
def description
|
31
|
+
"from `#{params[:podspec]}`"
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# @!group Helpers
|
37
|
+
|
38
|
+
# @return [String] The uri of the podspec appending the name of the file
|
39
|
+
# and expanding it if necessary.
|
40
|
+
#
|
41
|
+
# @note If the declared path is expanded only if the represents a path
|
42
|
+
# relative to the file system.
|
43
|
+
#
|
44
|
+
def podspec_uri
|
45
|
+
declared_path = params[:podspec].to_s
|
46
|
+
if declared_path =~ %r{^.+://}
|
47
|
+
declared_path
|
48
|
+
else
|
49
|
+
normalized_podspec_path(declared_path)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'cocoapods/external_sources/abstract_external_source'
|
2
|
+
require 'cocoapods/external_sources/downloader_source'
|
3
|
+
require 'cocoapods/external_sources/path_source'
|
4
|
+
require 'cocoapods/external_sources/podspec_source'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
# Provides support for initializing the correct concrete class of an external
|
8
|
+
# source.
|
9
|
+
#
|
10
|
+
module ExternalSources
|
11
|
+
# Instantiate a matching {AbstractExternalSource} for a given dependency.
|
12
|
+
#
|
13
|
+
# @param [Dependency] dependency
|
14
|
+
# the dependency
|
15
|
+
#
|
16
|
+
# @param [String] podfile_path
|
17
|
+
# @see AbstractExternalSource#podfile_path
|
18
|
+
#
|
19
|
+
# @param [Boolean] can_cache
|
20
|
+
# @see AbstractExternalSource#can_cache
|
21
|
+
#
|
22
|
+
# @return [AbstractExternalSource] an initialized instance of the concrete
|
23
|
+
# external source class associated with the option specified in the
|
24
|
+
# hash.
|
25
|
+
#
|
26
|
+
def self.from_dependency(dependency, podfile_path, can_cache)
|
27
|
+
from_params(dependency.external_source, dependency, podfile_path, can_cache)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.from_params(params, dependency, podfile_path, can_cache)
|
31
|
+
name = dependency.root_name
|
32
|
+
if klass = concrete_class_from_params(params)
|
33
|
+
klass.new(name, params, podfile_path, can_cache)
|
34
|
+
else
|
35
|
+
msg = "Unknown external source parameters for `#{name}`: `#{params}`"
|
36
|
+
raise Informative, msg
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get the class to represent the defined source type of a dependency
|
41
|
+
#
|
42
|
+
# @param [Array<Symbol>] params
|
43
|
+
# the source params of the dependency
|
44
|
+
#
|
45
|
+
# @return [Class]
|
46
|
+
#
|
47
|
+
def self.concrete_class_from_params(params)
|
48
|
+
if params.key?(:podspec)
|
49
|
+
PodspecSource
|
50
|
+
elsif params.key?(:path)
|
51
|
+
PathSource
|
52
|
+
elsif Downloader.strategy_from_options(params)
|
53
|
+
DownloaderSource
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class Markdown < Acknowledgements
|
4
|
+
def self.path_from_basepath(path)
|
5
|
+
Pathname.new(path.dirname + "#{path.basename}.markdown")
|
6
|
+
end
|
7
|
+
|
8
|
+
def save_as(path)
|
9
|
+
file = File.new(path, 'w')
|
10
|
+
file.write(licenses)
|
11
|
+
file.close
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [String] The contents of the acknowledgements in Markdown format.
|
15
|
+
#
|
16
|
+
def generate
|
17
|
+
licenses
|
18
|
+
end
|
19
|
+
|
20
|
+
def title_from_string(string, level)
|
21
|
+
unless string.empty?
|
22
|
+
'#' * level << " #{string}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def string_for_spec(spec)
|
27
|
+
if (license_text = license_text(spec))
|
28
|
+
"\n" << title_from_string(spec.name, 2) << "\n\n" << license_text << "\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def licenses
|
33
|
+
licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
|
34
|
+
specs.each do |spec|
|
35
|
+
if (license = string_for_spec(spec))
|
36
|
+
license = license.force_encoding('UTF-8') if license.respond_to?(:force_encoding)
|
37
|
+
licenses_string += license
|
38
|
+
end
|
39
|
+
end
|
40
|
+
licenses_string += "#{title_from_string(footnote_title, 2)}#{footnote_text}\n"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
module Generator
|
5
|
+
class Plist < Acknowledgements
|
6
|
+
def self.path_from_basepath(path)
|
7
|
+
Pathname.new(path.dirname + "#{path.basename}.plist")
|
8
|
+
end
|
9
|
+
|
10
|
+
def save_as(path)
|
11
|
+
Xcodeproj::Plist.write_to_path(plist_hash, path)
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [String] The contents of the plist
|
15
|
+
#
|
16
|
+
def generate
|
17
|
+
plist = Nanaimo::Plist.new(plist_hash, :xml)
|
18
|
+
contents = StringIO.new
|
19
|
+
Nanaimo::Writer::XMLWriter.new(plist, :pretty => true, :output => contents, :strict => false).write
|
20
|
+
contents.string
|
21
|
+
end
|
22
|
+
|
23
|
+
def plist_hash
|
24
|
+
{
|
25
|
+
:Title => plist_title,
|
26
|
+
:StringsTable => plist_title,
|
27
|
+
:PreferenceSpecifiers => licenses,
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def plist_title
|
32
|
+
'Acknowledgements'
|
33
|
+
end
|
34
|
+
|
35
|
+
def licenses
|
36
|
+
licences_array = [header_hash]
|
37
|
+
specs.each do |spec|
|
38
|
+
if (hash = hash_for_spec(spec))
|
39
|
+
licences_array << hash
|
40
|
+
end
|
41
|
+
end
|
42
|
+
licences_array << footnote_hash
|
43
|
+
end
|
44
|
+
|
45
|
+
def hash_for_spec(spec)
|
46
|
+
if (license = license_text(spec))
|
47
|
+
hash = {
|
48
|
+
:Type => 'PSGroupSpecifier',
|
49
|
+
:Title => sanitize_encoding(spec.name),
|
50
|
+
:FooterText => sanitize_encoding(license),
|
51
|
+
}
|
52
|
+
hash[:License] = sanitize_encoding(spec.license[:type]) if spec.license[:type]
|
53
|
+
|
54
|
+
hash
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def header_hash
|
59
|
+
{
|
60
|
+
:Type => 'PSGroupSpecifier',
|
61
|
+
:Title => sanitize_encoding(header_title),
|
62
|
+
:FooterText => sanitize_encoding(header_text),
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def footnote_hash
|
67
|
+
{
|
68
|
+
:Type => 'PSGroupSpecifier',
|
69
|
+
:Title => sanitize_encoding(footnote_title),
|
70
|
+
:FooterText => sanitize_encoding(footnote_text),
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
#-----------------------------------------------------------------------#
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
# !@group Private methods
|
79
|
+
|
80
|
+
# Returns the sanitized text with UTF-8 invalid characters eliminated.
|
81
|
+
#
|
82
|
+
# @param [String] text
|
83
|
+
# the text we want to sanitize.
|
84
|
+
#
|
85
|
+
# @return [String] The sanitized UTF-8 text.
|
86
|
+
#
|
87
|
+
def sanitize_encoding(text)
|
88
|
+
text.encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')
|
89
|
+
end
|
90
|
+
|
91
|
+
#-----------------------------------------------------------------------#
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class Acknowledgements
|
4
|
+
# @return [Array<Class>] The classes of the acknowledgements generator
|
5
|
+
# subclasses.
|
6
|
+
#
|
7
|
+
def self.generators
|
8
|
+
[Plist, Markdown]
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [Array<Sandbox::FileAccessor>] the list of the file accessors
|
12
|
+
# for the specs of the target that needs to generate the
|
13
|
+
# acknowledgements.
|
14
|
+
#
|
15
|
+
attr_reader :file_accessors
|
16
|
+
|
17
|
+
# @param [Array<Sandbox::FileAccessor>] @see file_accessors.
|
18
|
+
#
|
19
|
+
def initialize(file_accessors)
|
20
|
+
@file_accessors = file_accessors
|
21
|
+
end
|
22
|
+
|
23
|
+
#-----------------------------------------------------------------------#
|
24
|
+
|
25
|
+
# !@group Configuration
|
26
|
+
|
27
|
+
# @return [String] The title of the acknowledgements file.
|
28
|
+
#
|
29
|
+
def header_title
|
30
|
+
'Acknowledgements'
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [String] A text to present before listing the acknowledgements.
|
34
|
+
#
|
35
|
+
def header_text
|
36
|
+
'This application makes use of the following third party libraries:'
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [String] The title of the foot notes.
|
40
|
+
#
|
41
|
+
def footnote_title
|
42
|
+
''
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [String] the foot notes.
|
46
|
+
#
|
47
|
+
def footnote_text
|
48
|
+
'Generated by CocoaPods - https://cocoapods.org'
|
49
|
+
end
|
50
|
+
|
51
|
+
#-----------------------------------------------------------------------#
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# !@group Private methods
|
56
|
+
|
57
|
+
# @return [Array<Specification>] The root specifications for which the
|
58
|
+
# acknowledgements should be generated.
|
59
|
+
#
|
60
|
+
def specs
|
61
|
+
file_accessors.map { |accessor| accessor.spec.root }.uniq
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns the text of the license for the given spec.
|
65
|
+
#
|
66
|
+
# @param [Specification] spec
|
67
|
+
# the specification for which license is needed.
|
68
|
+
#
|
69
|
+
# @return [String] The text of the license.
|
70
|
+
# @return [Nil] If no license text could be found.
|
71
|
+
#
|
72
|
+
def license_text(spec)
|
73
|
+
return nil unless spec.license
|
74
|
+
text = spec.license[:text]
|
75
|
+
unless text
|
76
|
+
if license_file = spec.license[:file]
|
77
|
+
license_path = file_accessor(spec).root + license_file
|
78
|
+
if File.exist?(license_path)
|
79
|
+
text = IO.read(license_path)
|
80
|
+
else
|
81
|
+
UI.warn "Unable to read the license file `#{license_file}` " \
|
82
|
+
"for the spec `#{spec}`"
|
83
|
+
end
|
84
|
+
elsif license_file = file_accessor(spec).license
|
85
|
+
text = IO.read(license_file)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
text
|
89
|
+
end
|
90
|
+
|
91
|
+
protected
|
92
|
+
|
93
|
+
# Returns the file accessor for the given spec.
|
94
|
+
#
|
95
|
+
# @param [Specification] spec
|
96
|
+
# the specification for which the file accessor is needed.
|
97
|
+
#
|
98
|
+
# @return [Sandbox::FileAccessor] The file accessor.
|
99
|
+
#
|
100
|
+
def file_accessor(spec)
|
101
|
+
file_accessors.find { |accessor| accessor.spec.root == spec }
|
102
|
+
end
|
103
|
+
|
104
|
+
#-----------------------------------------------------------------------#
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|