cocoapods 0.19.1 → 0.20.0
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 +80 -2
- data/README.md +3 -2
- data/bin/sandbox-pod +130 -0
- data/lib/cocoapods.rb +1 -3
- data/lib/cocoapods/command.rb +1 -0
- data/lib/cocoapods/command/help.rb +2 -2
- data/lib/cocoapods/command/project.rb +0 -2
- data/lib/cocoapods/command/search.rb +6 -6
- data/lib/cocoapods/config.rb +94 -50
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +87 -18
- data/lib/cocoapods/installer.rb +9 -11
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +1 -1
- data/lib/cocoapods/installer/pod_source_installer.rb +6 -38
- data/lib/cocoapods/installer/target_installer.rb +6 -6
- data/lib/cocoapods/resolver.rb +4 -1
- data/lib/cocoapods/sandbox.rb +34 -1
- data/lib/cocoapods/user_interface.rb +1 -1
- data/lib/cocoapods/user_interface/error_report.rb +1 -1
- data/lib/cocoapods/validator.rb +0 -1
- metadata +93 -14
- data/lib/cocoapods/generator/documentation.rb +0 -217
@@ -1,217 +0,0 @@
|
|
1
|
-
require 'escape'
|
2
|
-
require 'active_support/core_ext/array/conversions'
|
3
|
-
|
4
|
-
module Pod
|
5
|
-
module Generator
|
6
|
-
|
7
|
-
# Generates the documentation for a Pod with the appledoc tool.
|
8
|
-
#
|
9
|
-
class Documentation
|
10
|
-
|
11
|
-
extend Executable
|
12
|
-
executable :appledoc
|
13
|
-
|
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.", [], true
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
target_path.mkpath
|
62
|
-
Dir.chdir(pod_root) do
|
63
|
-
appledoc apple_doc_command_line_arguments(install_docset)
|
64
|
-
end
|
65
|
-
|
66
|
-
if $?.exitstatus != 0
|
67
|
-
UI.warn "[!] Appledoc encountered an error (exitstatus: #{$?.exitstatus}), an update might be available to solve the issue."
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
#-----------------------------------------------------------------------#
|
73
|
-
|
74
|
-
public
|
75
|
-
|
76
|
-
# !@group Docset information.
|
77
|
-
|
78
|
-
# @return [String] The name of the docset
|
79
|
-
#
|
80
|
-
def name
|
81
|
-
specification.name + ' ' + specification.version.to_s
|
82
|
-
end
|
83
|
-
|
84
|
-
# @return [String] The company of the docset.
|
85
|
-
#
|
86
|
-
# @todo Set to CocoaPods?
|
87
|
-
#
|
88
|
-
def company
|
89
|
-
if specification.authors
|
90
|
-
specification.authors.keys.sort.to_sentence
|
91
|
-
else
|
92
|
-
'no-company'
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# @return [String] The copyright of the docset.
|
97
|
-
#
|
98
|
-
def copyright
|
99
|
-
company
|
100
|
-
end
|
101
|
-
|
102
|
-
# @return [String] The description of the docset.
|
103
|
-
#
|
104
|
-
def description
|
105
|
-
specification.summary || specification.description || 'Generated by CocoaPods.'
|
106
|
-
end
|
107
|
-
|
108
|
-
# @return [String] The id of the docset, uniq for every Pod.
|
109
|
-
#
|
110
|
-
def docs_id
|
111
|
-
"org.cocoapods.#{specification.name.downcase}"
|
112
|
-
end
|
113
|
-
|
114
|
-
#-----------------------------------------------------------------------#
|
115
|
-
|
116
|
-
public
|
117
|
-
|
118
|
-
# !@group Paths.
|
119
|
-
|
120
|
-
# @return [Array<String>] the list of the headers to process
|
121
|
-
# with the appledoc tool.
|
122
|
-
#
|
123
|
-
def public_headers
|
124
|
-
absolute_paths = file_accessors.map(&:public_headers).flatten.uniq
|
125
|
-
absolute_paths.map { |f| f.relative_path_from(pod_root).to_s }
|
126
|
-
end
|
127
|
-
|
128
|
-
# @return [String] the path of the file to use as the index of
|
129
|
-
# documentation relative to the root of the Pod.
|
130
|
-
#
|
131
|
-
def index_file
|
132
|
-
readme_file = file_accessors.first.readme
|
133
|
-
readme_file.relative_path_from(pod_root).to_s if readme_file
|
134
|
-
end
|
135
|
-
|
136
|
-
#-----------------------------------------------------------------------#
|
137
|
-
|
138
|
-
public
|
139
|
-
|
140
|
-
# !@group Appledoc options.
|
141
|
-
|
142
|
-
# @return [Array<String>] The list of the appledoc options followed by
|
143
|
-
# their values as defined in the specification.
|
144
|
-
#
|
145
|
-
def spec_appledoc_options
|
146
|
-
return [] unless specification.documentation
|
147
|
-
specification.documentation[:appledoc] || []
|
148
|
-
end
|
149
|
-
|
150
|
-
# @return [Array<String>] The list of the appledoc options followed by
|
151
|
-
# their values.
|
152
|
-
#
|
153
|
-
# @note The appledoc tool terminates with an exits status of 1 if a
|
154
|
-
# warning was logged (see `--exit-threshold` option).
|
155
|
-
#
|
156
|
-
def appledoc_options
|
157
|
-
options = [
|
158
|
-
'--project-name', name,
|
159
|
-
'--docset-desc', description,
|
160
|
-
'--project-company', company,
|
161
|
-
'--docset-copyright', copyright,
|
162
|
-
'--company-id', docs_id,
|
163
|
-
'--ignore', '.m',
|
164
|
-
'--keep-undocumented-objects',
|
165
|
-
'--keep-undocumented-members',
|
166
|
-
'--keep-intermediate-files',
|
167
|
-
'--exit-threshold', '2'
|
168
|
-
]
|
169
|
-
options += ['--index-desc', index_file] if index_file
|
170
|
-
options += spec_appledoc_options
|
171
|
-
end
|
172
|
-
|
173
|
-
# @return [String] the arguments to pass to the appledoc command line
|
174
|
-
# tool, properly escaped.
|
175
|
-
#
|
176
|
-
# @param [Bool] install_docset
|
177
|
-
# Whether the documentation should also be installed in Xcode.
|
178
|
-
#
|
179
|
-
def apple_doc_command_line_arguments(install_docset)
|
180
|
-
arguments = appledoc_options
|
181
|
-
arguments += ['--output', target_path.to_s]
|
182
|
-
arguments += install_docset ? ['--create-docset'] : ['--no-create-docset']
|
183
|
-
arguments += public_headers
|
184
|
-
Escape.shell_command(arguments)
|
185
|
-
end
|
186
|
-
|
187
|
-
#-----------------------------------------------------------------------#
|
188
|
-
|
189
|
-
private
|
190
|
-
|
191
|
-
# !@group Private Helpers
|
192
|
-
|
193
|
-
def target_path
|
194
|
-
sandbox.documentation_dir + specification.name
|
195
|
-
end
|
196
|
-
|
197
|
-
def pod_root
|
198
|
-
path_list.root
|
199
|
-
end
|
200
|
-
|
201
|
-
def file_accessors
|
202
|
-
return @file_accessors if @file_accessors
|
203
|
-
|
204
|
-
@file_accessors = []
|
205
|
-
all_specs = [specification, *specification.subspecs]
|
206
|
-
all_specs.each do |spec|
|
207
|
-
spec.available_platforms.each do |platform|
|
208
|
-
accessor = Sandbox::FileAccessor.new(path_list, spec.consumer(platform))
|
209
|
-
@file_accessors << accessor
|
210
|
-
end
|
211
|
-
end
|
212
|
-
@file_accessors
|
213
|
-
end
|
214
|
-
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|