cocoapods 0.16.4 → 0.17.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 +7 -0
- data/CHANGELOG.md +108 -0
- data/README.md +3 -3
- data/bin/pod +1 -1
- data/lib/cocoapods.rb +31 -31
- data/lib/cocoapods/command.rb +62 -107
- data/lib/cocoapods/command/inter_process_communication.rb +103 -0
- data/lib/cocoapods/command/list.rb +45 -44
- data/lib/cocoapods/command/outdated.rb +28 -25
- data/lib/cocoapods/command/project.rb +90 -0
- data/lib/cocoapods/command/push.rb +50 -32
- data/lib/cocoapods/command/repo.rb +125 -155
- data/lib/cocoapods/command/search.rb +23 -12
- data/lib/cocoapods/command/setup.rb +103 -64
- data/lib/cocoapods/command/spec.rb +329 -90
- data/lib/cocoapods/config.rb +197 -44
- data/lib/cocoapods/downloader.rb +47 -34
- data/lib/cocoapods/executable.rb +98 -41
- data/lib/cocoapods/external_sources.rb +325 -0
- data/lib/cocoapods/file_list.rb +8 -1
- data/lib/cocoapods/gem_version.rb +7 -0
- data/lib/cocoapods/generator/acknowledgements.rb +71 -7
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +10 -9
- data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -8
- data/lib/cocoapods/generator/copy_resources_script.rb +2 -2
- data/lib/cocoapods/generator/documentation.rb +153 -37
- data/lib/cocoapods/generator/prefix_header.rb +82 -0
- data/lib/cocoapods/generator/target_header.rb +58 -0
- data/lib/cocoapods/generator/xcconfig.rb +130 -0
- data/lib/cocoapods/hooks/installer_representation.rb +123 -0
- data/lib/cocoapods/hooks/library_representation.rb +79 -0
- data/lib/cocoapods/hooks/pod_representation.rb +74 -0
- data/lib/cocoapods/installer.rb +398 -147
- data/lib/cocoapods/installer/analyzer.rb +556 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
- data/lib/cocoapods/installer/file_references_installer.rb +179 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +289 -0
- data/lib/cocoapods/installer/target_installer.rb +307 -112
- data/lib/cocoapods/installer/user_project_integrator.rb +140 -176
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +193 -0
- data/lib/cocoapods/library.rb +195 -0
- data/lib/cocoapods/open_uri.rb +16 -14
- data/lib/cocoapods/project.rb +175 -52
- data/lib/cocoapods/resolver.rb +151 -164
- data/lib/cocoapods/sandbox.rb +276 -54
- data/lib/cocoapods/sandbox/file_accessor.rb +210 -0
- data/lib/cocoapods/sandbox/headers_store.rb +96 -0
- data/lib/cocoapods/sandbox/path_list.rb +178 -0
- data/lib/cocoapods/sources_manager.rb +218 -0
- data/lib/cocoapods/user_interface.rb +82 -18
- data/lib/cocoapods/{command → user_interface}/error_report.rb +5 -5
- data/lib/cocoapods/validator.rb +379 -0
- metadata +74 -55
- data/lib/cocoapods/command/install.rb +0 -55
- data/lib/cocoapods/command/linter.rb +0 -317
- data/lib/cocoapods/command/update.rb +0 -25
- data/lib/cocoapods/dependency.rb +0 -285
- data/lib/cocoapods/downloader/git.rb +0 -276
- data/lib/cocoapods/downloader/http.rb +0 -99
- data/lib/cocoapods/downloader/mercurial.rb +0 -26
- data/lib/cocoapods/downloader/subversion.rb +0 -42
- data/lib/cocoapods/local_pod.rb +0 -620
- data/lib/cocoapods/lockfile.rb +0 -274
- data/lib/cocoapods/platform.rb +0 -127
- data/lib/cocoapods/podfile.rb +0 -551
- data/lib/cocoapods/source.rb +0 -223
- data/lib/cocoapods/specification.rb +0 -579
- data/lib/cocoapods/specification/set.rb +0 -175
- data/lib/cocoapods/specification/statistics.rb +0 -112
- data/lib/cocoapods/user_interface/ui_pod.rb +0 -130
- data/lib/cocoapods/version.rb +0 -26
@@ -3,10 +3,11 @@ module Pod
|
|
3
3
|
|
4
4
|
class Markdown < Acknowledgements
|
5
5
|
|
6
|
+
def self.path_from_basepath(path)
|
7
|
+
Pathname.new(path.dirname + "#{path.basename.to_s}.markdown")
|
8
|
+
end
|
9
|
+
|
6
10
|
def save_as(path)
|
7
|
-
if (path.extname != ".markdown")
|
8
|
-
path = Pathname.new(path.dirname + "#{path.basename.to_s}.markdown")
|
9
|
-
end
|
10
11
|
file = File.new(path, "w")
|
11
12
|
file.write(licenses)
|
12
13
|
file.close
|
@@ -18,17 +19,17 @@ module Pod
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
if (license_text =
|
23
|
-
"\n" << title_from_string(
|
22
|
+
def string_for_spec(spec)
|
23
|
+
if (license_text = license_text(spec))
|
24
|
+
"\n" << title_from_string(spec.name, 2) << "\n\n" << license_text << "\n"
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
def licenses
|
28
29
|
licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
|
29
|
-
|
30
|
-
if (license =
|
31
|
-
license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
|
30
|
+
specs.each do |spec|
|
31
|
+
if (license = string_for_spec(spec))
|
32
|
+
license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
|
32
33
|
licenses_string += license
|
33
34
|
end
|
34
35
|
end
|
@@ -4,10 +4,11 @@ module Pod
|
|
4
4
|
class Plist < Acknowledgements
|
5
5
|
require "xcodeproj/xcodeproj_ext"
|
6
6
|
|
7
|
+
def self.path_from_basepath(path)
|
8
|
+
Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
|
9
|
+
end
|
10
|
+
|
7
11
|
def save_as(path)
|
8
|
-
if (path.extname != ".plist")
|
9
|
-
path = Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
|
10
|
-
end
|
11
12
|
Xcodeproj.write_plist(plist, path)
|
12
13
|
end
|
13
14
|
|
@@ -25,19 +26,19 @@ module Pod
|
|
25
26
|
|
26
27
|
def licenses
|
27
28
|
licences_array = [header_hash]
|
28
|
-
|
29
|
-
if (hash =
|
29
|
+
specs.each do |spec|
|
30
|
+
if (hash = hash_for_spec(spec))
|
30
31
|
licences_array << hash
|
31
32
|
end
|
32
33
|
end
|
33
34
|
licences_array << footnote_hash
|
34
35
|
end
|
35
36
|
|
36
|
-
def
|
37
|
-
if (license =
|
37
|
+
def hash_for_spec(spec)
|
38
|
+
if (license = license_text(spec))
|
38
39
|
{
|
39
40
|
:Type => "PSGroupSpecifier",
|
40
|
-
:Title =>
|
41
|
+
:Title => spec.name,
|
41
42
|
:FooterText => license
|
42
43
|
}
|
43
44
|
end
|
@@ -34,7 +34,7 @@ EOS
|
|
34
34
|
attr_reader :resources
|
35
35
|
|
36
36
|
# A list of files relative to the project pods root.
|
37
|
-
def initialize(resources)
|
37
|
+
def initialize(resources = [])
|
38
38
|
@resources = resources
|
39
39
|
end
|
40
40
|
|
@@ -45,7 +45,7 @@ EOS
|
|
45
45
|
script.puts "install_resource '#{resource}'"
|
46
46
|
end
|
47
47
|
end
|
48
|
-
#
|
48
|
+
# @todo use File api
|
49
49
|
system("chmod +x '#{pathname}'")
|
50
50
|
end
|
51
51
|
end
|
@@ -4,56 +4,156 @@ require 'active_support/core_ext/array/conversions'
|
|
4
4
|
module Pod
|
5
5
|
module Generator
|
6
6
|
|
7
|
+
# Generates the documentation for a Pod with the appledoc tool.
|
8
|
+
#
|
7
9
|
class Documentation
|
8
|
-
include Config::Mixin
|
9
|
-
extend Executable
|
10
10
|
|
11
|
+
extend Executable
|
11
12
|
executable :appledoc
|
12
|
-
attr_reader :pod, :specification, :target_path, :options
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
attr_reader :sandbox
|
15
|
+
attr_reader :specification
|
16
|
+
attr_reader :path_list
|
17
|
+
|
18
|
+
def initialize(sandbox, specification, path_list)
|
19
|
+
@sandbox = sandbox
|
20
|
+
@specification = specification.root
|
21
|
+
@path_list = path_list
|
22
|
+
end
|
23
|
+
|
24
|
+
DOC_SETS_PATH = "~/Library/Developer/Shared/Documentation/DocSets"
|
25
|
+
|
26
|
+
# @return [Bool] Whether the documentation for the current Pod is already
|
27
|
+
# installed in the system.
|
28
|
+
#
|
29
|
+
def already_installed?
|
30
|
+
index = spec_appledoc_options.index('--company-id')
|
31
|
+
company_id = index ? spec_appledoc_options[index + 1] : docs_id
|
32
|
+
docset_path = DOC_SETS_PATH + "/#{company_id}.#{name.gsub(/ /,'-')}.docset"
|
33
|
+
Pathname.new(File.expand_path(docset_path)).exist?
|
34
|
+
end
|
35
|
+
|
36
|
+
# Generates and optionally installs the documentation for the current
|
37
|
+
# Pod.
|
38
|
+
#
|
39
|
+
# @param [Bool] install_docset
|
40
|
+
# Whether the documentation should also be installed in Xcode.
|
41
|
+
#
|
42
|
+
# @note As the documentation is once per Pod to speed up the
|
43
|
+
# installation process it is generate for all the specs
|
44
|
+
# (including those not currently used). For this reason it is
|
45
|
+
# important that the documentation is generated before cleaning a
|
46
|
+
# Pod installation.
|
47
|
+
#
|
48
|
+
# @todo Passing the files explicitly clutters output and chokes on very
|
49
|
+
# long list (AWSiOSSDK). It is possible to just pass the dir of
|
50
|
+
# the pod, however this would include other files like demo
|
51
|
+
# projects.
|
52
|
+
#
|
53
|
+
# @return [void]
|
54
|
+
#
|
55
|
+
def generate(install_docset)
|
56
|
+
if `which appledoc`.strip.empty?
|
57
|
+
UI.warn "[!] Skipping documentation generation because appledoc can't be found.",
|
58
|
+
actions = [], verbose_only = true
|
59
|
+
return
|
60
|
+
end
|
61
|
+
|
62
|
+
target_path.mkpath
|
63
|
+
Dir.chdir(pod_root) do
|
64
|
+
appledoc apple_doc_command_line_arguments(install_docset)
|
65
|
+
end
|
66
|
+
|
67
|
+
if $?.exitstatus != 0
|
68
|
+
UI.warn "[!] Appledoc encountered an error (exitstatus: #{$?.exitstatus}), an update might be available to solve the issue."
|
69
|
+
end
|
70
|
+
|
19
71
|
end
|
20
72
|
|
73
|
+
#-----------------------------------------------------------------------#
|
74
|
+
|
75
|
+
public
|
76
|
+
|
77
|
+
# !@group Docset information.
|
78
|
+
|
79
|
+
# @return [String] The name of the docset
|
80
|
+
#
|
21
81
|
def name
|
22
|
-
|
82
|
+
specification.name + ' ' + specification.version.to_s
|
23
83
|
end
|
24
84
|
|
85
|
+
# @return [String] The company of the docset.
|
86
|
+
#
|
87
|
+
# @todo Set to CocoaPods?
|
88
|
+
#
|
25
89
|
def company
|
26
|
-
if
|
27
|
-
|
90
|
+
if specification.authors
|
91
|
+
specification.authors.keys.sort.to_sentence
|
28
92
|
else
|
29
93
|
'no-company'
|
30
94
|
end
|
31
95
|
end
|
32
96
|
|
97
|
+
# @return [String] The copyright of the docset.
|
98
|
+
#
|
33
99
|
def copyright
|
34
100
|
company
|
35
101
|
end
|
36
102
|
|
103
|
+
# @return [String] The description of the docset.
|
104
|
+
#
|
37
105
|
def description
|
38
|
-
|
106
|
+
specification.summary || specification.description || 'Generated by CocoaPods.'
|
39
107
|
end
|
40
108
|
|
109
|
+
# @return [String] The id of the docset.
|
110
|
+
#
|
41
111
|
def docs_id
|
42
112
|
'org.cocoapods'
|
43
113
|
end
|
44
114
|
|
45
|
-
|
46
|
-
|
115
|
+
#-----------------------------------------------------------------------#
|
116
|
+
|
117
|
+
public
|
118
|
+
|
119
|
+
# !@group Paths.
|
120
|
+
|
121
|
+
# @return [Array<String>] the list of the headers to process
|
122
|
+
# with the appledoc tool.
|
123
|
+
#
|
124
|
+
def public_headers
|
125
|
+
absolute_paths = file_accessors.map(&:public_headers).flatten.uniq
|
126
|
+
absolute_paths.map { |f| f.relative_path_from(pod_root).to_s }
|
47
127
|
end
|
48
128
|
|
129
|
+
# @return [String] the path of the file to use ad index of the
|
130
|
+
# documentation relative to the root of the Pod.
|
131
|
+
#
|
49
132
|
def index_file
|
50
|
-
|
133
|
+
readme_file = file_accessors.first.readme
|
134
|
+
readme_file.relative_path_from(pod_root).to_s if readme_file
|
51
135
|
end
|
52
136
|
|
137
|
+
#-----------------------------------------------------------------------#
|
138
|
+
|
139
|
+
public
|
140
|
+
|
141
|
+
# !@group Appledoc options.
|
142
|
+
|
143
|
+
# @return [Array<String>] The list of the appledoc options followed by
|
144
|
+
# their value as defined in the specification.
|
145
|
+
#
|
53
146
|
def spec_appledoc_options
|
54
|
-
|
147
|
+
return [] unless specification.documentation
|
148
|
+
specification.documentation[:appledoc]
|
55
149
|
end
|
56
150
|
|
151
|
+
# @return [Array<String>] The list of the appledoc options followed by
|
152
|
+
# their value.
|
153
|
+
#
|
154
|
+
# @note The appledoc tool terminates with an exits status of 1 if a
|
155
|
+
# warning was logged (see `--exit-threshold` option).
|
156
|
+
#
|
57
157
|
def appledoc_options
|
58
158
|
options = [
|
59
159
|
'--project-name', name,
|
@@ -65,38 +165,54 @@ module Pod
|
|
65
165
|
'--keep-undocumented-objects',
|
66
166
|
'--keep-undocumented-members',
|
67
167
|
'--keep-intermediate-files',
|
68
|
-
'--exit-threshold', '2'
|
168
|
+
'--exit-threshold', '2'
|
69
169
|
]
|
70
170
|
options += ['--index-desc', index_file] if index_file
|
71
171
|
options += spec_appledoc_options
|
72
172
|
end
|
73
173
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
174
|
+
# @return [String] the arguments to pass to the appledoc command line
|
175
|
+
# tool, properly escaped.
|
176
|
+
#
|
177
|
+
# @param [Bool] install_docset
|
178
|
+
# Whether the documentation should also be installed in Xcode.
|
179
|
+
#
|
180
|
+
def apple_doc_command_line_arguments(install_docset)
|
181
|
+
arguments = appledoc_options
|
182
|
+
arguments += ['--output', target_path.to_s]
|
183
|
+
arguments += install_docset ? ['--create-docset'] : ['--no-create-docset']
|
184
|
+
arguments += public_headers
|
185
|
+
Escape.shell_command(arguments)
|
78
186
|
end
|
79
187
|
|
80
|
-
|
81
|
-
options = appledoc_options
|
82
|
-
options += ['--output', @target_path.to_s]
|
83
|
-
options += install ? ['--create-docset'] : ['--no-create-docset']
|
84
|
-
# TODO: passing the files explicitly clutters output and chokes on very long list (AWSiOSSDK Spec).
|
85
|
-
# It is possible to just pass the dir of the pod, however this would include other files like demo projects.
|
86
|
-
options += files
|
188
|
+
#-----------------------------------------------------------------------#
|
87
189
|
|
88
|
-
|
89
|
-
@pod.chdir do
|
90
|
-
appledoc Escape.shell_command(options)
|
91
|
-
end
|
190
|
+
private
|
92
191
|
|
93
|
-
|
94
|
-
|
95
|
-
|
192
|
+
# !@group Private Helpers
|
193
|
+
|
194
|
+
def target_path
|
195
|
+
sandbox.root + 'Documentation' + specification.name
|
196
|
+
end
|
96
197
|
|
97
|
-
|
98
|
-
|
198
|
+
def pod_root
|
199
|
+
path_list.root
|
99
200
|
end
|
201
|
+
|
202
|
+
def file_accessors
|
203
|
+
return @file_accessors if @file_accessors
|
204
|
+
|
205
|
+
@file_accessors = []
|
206
|
+
all_specs = [specification, *specification.subspecs]
|
207
|
+
all_specs.each do |spec|
|
208
|
+
spec.available_platforms.each do |platform|
|
209
|
+
accessor = Sandbox::FileAccessor.new(path_list, spec.consumer(platform))
|
210
|
+
@file_accessors << accessor
|
211
|
+
end
|
212
|
+
end
|
213
|
+
@file_accessors
|
214
|
+
end
|
215
|
+
|
100
216
|
end
|
101
217
|
end
|
102
218
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
|
4
|
+
# Generates a prefix header file for a Pods library. The prefix header is
|
5
|
+
# generated according to the platform of the target and the pods.
|
6
|
+
#
|
7
|
+
# According to the platform the prefix header imports `UIKit/UIKit.h` or
|
8
|
+
# `Cocoa/Cocoa.h`.
|
9
|
+
#
|
10
|
+
class PrefixHeader
|
11
|
+
|
12
|
+
# @return [Platform] the platform for which the prefix header will be
|
13
|
+
# generated.
|
14
|
+
#
|
15
|
+
attr_reader :file_accessors
|
16
|
+
attr_reader :platform
|
17
|
+
|
18
|
+
# @return [Array<LocalPod>] the LocalPod for the target for which the
|
19
|
+
# prefix header needs to be generated.
|
20
|
+
#
|
21
|
+
# attr_reader :consumers
|
22
|
+
|
23
|
+
# @return [Array<String>] any header to import (with quotes).
|
24
|
+
#
|
25
|
+
attr_reader :imports
|
26
|
+
|
27
|
+
# @param [Platform] platform @see platform
|
28
|
+
# @param [Array<LocalPod>] consumers @see consumers
|
29
|
+
#
|
30
|
+
def initialize(file_accessors, platform)
|
31
|
+
@file_accessors = file_accessors
|
32
|
+
@platform = platform
|
33
|
+
@imports = []
|
34
|
+
end
|
35
|
+
|
36
|
+
# Generates the contents of the prefix header according to the platform
|
37
|
+
# and the pods.
|
38
|
+
#
|
39
|
+
# @note If the platform is iOS an import call to `UIKit/UIKit.h` is
|
40
|
+
# added to the top of the prefix header. For OS X `Cocoa/Cocoa.h`
|
41
|
+
# is imported.
|
42
|
+
#
|
43
|
+
# @return [String]
|
44
|
+
#
|
45
|
+
# @todo Subspecs can specify prefix header information too.
|
46
|
+
#
|
47
|
+
def generate
|
48
|
+
result = "#ifdef __OBJC__\n"
|
49
|
+
result << "#import #{platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}\n"
|
50
|
+
result << "#endif\n"
|
51
|
+
|
52
|
+
imports.each do |import|
|
53
|
+
result << %|\n#import "#{import}"|
|
54
|
+
end
|
55
|
+
|
56
|
+
file_accessors.each do |file_accessor|
|
57
|
+
result << "\n"
|
58
|
+
if prefix_header_contents = file_accessor.spec_consumer.prefix_header_contents
|
59
|
+
result << prefix_header_contents
|
60
|
+
result << "\n"
|
61
|
+
end
|
62
|
+
if prefix_header = file_accessor.prefix_header
|
63
|
+
result << Pathname(prefix_header).read
|
64
|
+
end
|
65
|
+
end
|
66
|
+
result
|
67
|
+
end
|
68
|
+
|
69
|
+
# Generates and saves the prefix header to the given path.
|
70
|
+
#
|
71
|
+
# @param [Pathname] path
|
72
|
+
# the path where the prefix header should be stored.
|
73
|
+
#
|
74
|
+
# @return [void]
|
75
|
+
#
|
76
|
+
def save_as(path)
|
77
|
+
path.open('w') { |header| header.write(generate) }
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
|
4
|
+
# Generates a header which allows to inspect at compile time the installed
|
5
|
+
# pods and the installed specifications of a pod.
|
6
|
+
#
|
7
|
+
# Example output:
|
8
|
+
#
|
9
|
+
# #define __COCOA_PODS
|
10
|
+
#
|
11
|
+
# #define __POD_AFIncrementaStore
|
12
|
+
# #define __POD_AFNetworking
|
13
|
+
# #define __POD_libextobjc_EXTConcreteProtocol
|
14
|
+
# #define __POD_libextobjc_EXTKeyPathCoding
|
15
|
+
# #define __POD_libextobjc_EXTScope
|
16
|
+
#
|
17
|
+
# Example usage:
|
18
|
+
#
|
19
|
+
# #ifdef __COCOA_PODS
|
20
|
+
# #ifdef __POD__AFNetworking
|
21
|
+
# #import "MYLib+AFNetworking.h"
|
22
|
+
# #endif
|
23
|
+
# #else
|
24
|
+
# // Non CocoaPods code
|
25
|
+
# #endif
|
26
|
+
#
|
27
|
+
class TargetHeader
|
28
|
+
|
29
|
+
# @return [Array<LocalPod>] the specifications installed for the target.
|
30
|
+
#
|
31
|
+
attr_reader :specs
|
32
|
+
|
33
|
+
# @param [Array<LocalPod>] pods @see pods
|
34
|
+
#
|
35
|
+
def initialize(specs)
|
36
|
+
@specs = specs
|
37
|
+
end
|
38
|
+
|
39
|
+
# Generates and saves the file.
|
40
|
+
#
|
41
|
+
# @param [Pathname] pathname
|
42
|
+
# The path where to save the generated file.
|
43
|
+
#
|
44
|
+
# @return [void]
|
45
|
+
#
|
46
|
+
def save_as(pathname)
|
47
|
+
pathname.open('w') do |source|
|
48
|
+
source.puts "// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future"
|
49
|
+
source.puts "#define __COCOA_PODS"
|
50
|
+
source.puts
|
51
|
+
specs.each do |specs|
|
52
|
+
source.puts "#define __POD_#{specs.name.gsub(/[^\w]/,'_')}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|