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.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +108 -0
  3. data/README.md +3 -3
  4. data/bin/pod +1 -1
  5. data/lib/cocoapods.rb +31 -31
  6. data/lib/cocoapods/command.rb +62 -107
  7. data/lib/cocoapods/command/inter_process_communication.rb +103 -0
  8. data/lib/cocoapods/command/list.rb +45 -44
  9. data/lib/cocoapods/command/outdated.rb +28 -25
  10. data/lib/cocoapods/command/project.rb +90 -0
  11. data/lib/cocoapods/command/push.rb +50 -32
  12. data/lib/cocoapods/command/repo.rb +125 -155
  13. data/lib/cocoapods/command/search.rb +23 -12
  14. data/lib/cocoapods/command/setup.rb +103 -64
  15. data/lib/cocoapods/command/spec.rb +329 -90
  16. data/lib/cocoapods/config.rb +197 -44
  17. data/lib/cocoapods/downloader.rb +47 -34
  18. data/lib/cocoapods/executable.rb +98 -41
  19. data/lib/cocoapods/external_sources.rb +325 -0
  20. data/lib/cocoapods/file_list.rb +8 -1
  21. data/lib/cocoapods/gem_version.rb +7 -0
  22. data/lib/cocoapods/generator/acknowledgements.rb +71 -7
  23. data/lib/cocoapods/generator/acknowledgements/markdown.rb +10 -9
  24. data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -8
  25. data/lib/cocoapods/generator/copy_resources_script.rb +2 -2
  26. data/lib/cocoapods/generator/documentation.rb +153 -37
  27. data/lib/cocoapods/generator/prefix_header.rb +82 -0
  28. data/lib/cocoapods/generator/target_header.rb +58 -0
  29. data/lib/cocoapods/generator/xcconfig.rb +130 -0
  30. data/lib/cocoapods/hooks/installer_representation.rb +123 -0
  31. data/lib/cocoapods/hooks/library_representation.rb +79 -0
  32. data/lib/cocoapods/hooks/pod_representation.rb +74 -0
  33. data/lib/cocoapods/installer.rb +398 -147
  34. data/lib/cocoapods/installer/analyzer.rb +556 -0
  35. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
  36. data/lib/cocoapods/installer/file_references_installer.rb +179 -0
  37. data/lib/cocoapods/installer/pod_source_installer.rb +289 -0
  38. data/lib/cocoapods/installer/target_installer.rb +307 -112
  39. data/lib/cocoapods/installer/user_project_integrator.rb +140 -176
  40. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +193 -0
  41. data/lib/cocoapods/library.rb +195 -0
  42. data/lib/cocoapods/open_uri.rb +16 -14
  43. data/lib/cocoapods/project.rb +175 -52
  44. data/lib/cocoapods/resolver.rb +151 -164
  45. data/lib/cocoapods/sandbox.rb +276 -54
  46. data/lib/cocoapods/sandbox/file_accessor.rb +210 -0
  47. data/lib/cocoapods/sandbox/headers_store.rb +96 -0
  48. data/lib/cocoapods/sandbox/path_list.rb +178 -0
  49. data/lib/cocoapods/sources_manager.rb +218 -0
  50. data/lib/cocoapods/user_interface.rb +82 -18
  51. data/lib/cocoapods/{command → user_interface}/error_report.rb +5 -5
  52. data/lib/cocoapods/validator.rb +379 -0
  53. metadata +74 -55
  54. data/lib/cocoapods/command/install.rb +0 -55
  55. data/lib/cocoapods/command/linter.rb +0 -317
  56. data/lib/cocoapods/command/update.rb +0 -25
  57. data/lib/cocoapods/dependency.rb +0 -285
  58. data/lib/cocoapods/downloader/git.rb +0 -276
  59. data/lib/cocoapods/downloader/http.rb +0 -99
  60. data/lib/cocoapods/downloader/mercurial.rb +0 -26
  61. data/lib/cocoapods/downloader/subversion.rb +0 -42
  62. data/lib/cocoapods/local_pod.rb +0 -620
  63. data/lib/cocoapods/lockfile.rb +0 -274
  64. data/lib/cocoapods/platform.rb +0 -127
  65. data/lib/cocoapods/podfile.rb +0 -551
  66. data/lib/cocoapods/source.rb +0 -223
  67. data/lib/cocoapods/specification.rb +0 -579
  68. data/lib/cocoapods/specification/set.rb +0 -175
  69. data/lib/cocoapods/specification/statistics.rb +0 -112
  70. data/lib/cocoapods/user_interface/ui_pod.rb +0 -130
  71. data/lib/cocoapods/version.rb +0 -26
@@ -0,0 +1,325 @@
1
+ module Pod
2
+
3
+ # Provides support for initializing the correct concrete class of an external
4
+ # source.
5
+ #
6
+ module ExternalSources
7
+
8
+ # @return [AbstractExternalSource] an initialized instance of the concrete
9
+ # external source class associated with the option specified in the
10
+ # hash.
11
+ #
12
+ def self.from_dependency(dependency, podfile_path)
13
+ name = dependency.root_name
14
+ params = dependency.external_source
15
+
16
+ klass = if params.key?(:git) then GitSource
17
+ elsif params.key?(:svn) then SvnSource
18
+ elsif params.key?(:hg) then MercurialSource
19
+ elsif params.key?(:podspec) then PodspecSource
20
+ elsif params.key?(:local) then LocalSource
21
+ end
22
+
23
+ if klass
24
+ klass.new(name, params, podfile_path)
25
+ else
26
+ msg = "Unknown external source parameters for `#{name}`: `#{params}`"
27
+ raise Informative, msg
28
+ end
29
+ end
30
+
31
+ #-------------------------------------------------------------------------#
32
+
33
+ # Abstract class that defines the common behaviour of external sources.
34
+ #
35
+ class AbstractExternalSource
36
+
37
+ # @return [String] the name of the Pod described by this external source.
38
+ #
39
+ attr_reader :name
40
+
41
+ # @return [Hash{Symbol => String}] the hash representation of the
42
+ # external source.
43
+ #
44
+ attr_reader :params
45
+
46
+ # @return [String] the path where the podfile is defined to resolve
47
+ # relative paths.
48
+ #
49
+ attr_reader :podfile_path
50
+
51
+ # @param [String] name @see name
52
+ # @param [Hash] params @see params
53
+ # @param [String] podfile_path @see podfile_path
54
+ #
55
+ def initialize(name, params, podfile_path)
56
+ @name = name
57
+ @params = params
58
+ @podfile_path = podfile_path
59
+ end
60
+
61
+ # @return [Bool] whether an external source source is equal to another
62
+ # according to the {#name} and to the {#params}.
63
+ #
64
+ def ==(other)
65
+ return false if other.nil?
66
+ name == other.name && params == other.params
67
+ end
68
+
69
+ #--------------------------------------#
70
+
71
+ public
72
+
73
+ # @!group Fetching
74
+
75
+ # Fetches the external source from the remote according to the params.
76
+ #
77
+ # @param [Sandbox] sandbox
78
+ # the sandbox where the specification should be stored.
79
+ #
80
+ # @return [void]
81
+ #
82
+ def fetch(sandbox)
83
+ raise "Abstract method"
84
+ end
85
+
86
+ #--------------------------------------#
87
+
88
+ public
89
+
90
+ # @!group Subclasses hooks
91
+
92
+ # Fetches the external source from the remote according to the params.
93
+ #
94
+ # @param [Sandbox] sandbox
95
+ # the sandbox where the specification should be stored.
96
+ #
97
+ # @return [void]
98
+ #
99
+ def fetch(sandbox)
100
+ raise "Abstract method"
101
+ end
102
+
103
+ # @return [String] a string representation of the source suitable for UI.
104
+ #
105
+ def description
106
+ raise "Abstract method"
107
+ end
108
+
109
+ #--------------------------------------#
110
+
111
+ private
112
+
113
+ # @! Subclasses helpers
114
+
115
+ # Pre-downloads a Pod passing the options to the downloader and informing
116
+ # the sandbox.
117
+ #
118
+ # @param [Sandbox] sandbox
119
+ # The sandbox where the Pod should be downloaded.
120
+ #
121
+ # @note To prevent a double download of the repository the pod is
122
+ # marked as pre-downloaded indicating to the installer that only
123
+ # clean operations are needed.
124
+ #
125
+ # @return [void]
126
+ #
127
+ def pre_download(sandbox)
128
+ UI.titled_section("Pre-downloading: `#{name}` #{description}", { :verbose_prefix => "-> " }) do
129
+ target = sandbox.root + name
130
+ target.rmtree if target.exist?
131
+ downloader = Downloader.for_target(target, params)
132
+ downloader.download
133
+ store_podspec(sandbox, target + "#{name}.podspec")
134
+ sandbox.store_pre_downloaded_pod(name)
135
+ if downloader.options_specific?
136
+ source = params
137
+ else
138
+ source = downloader.checkout_options
139
+ end
140
+ sandbox.store_checkout_source(name, source)
141
+ end
142
+ end
143
+
144
+ # Stores the podspec in the sandbox and marks it as from an external
145
+ # source.
146
+ #
147
+ # @param [Sandbox] sandbox
148
+ # The sandbox where the specification should be stored.
149
+ #
150
+ # @param [Pathname, String] spec
151
+ # The path of the specification or its contents.
152
+ #
153
+ # @note All the concrete implementations of #{fetch} should invoke this
154
+ # method.
155
+ #
156
+ # @note The sandbox ensures that the podspec exists and that the names
157
+ # match.
158
+ #
159
+ # @return [void]
160
+ #
161
+ def store_podspec(sandbox, spec)
162
+ sandbox.store_podspec(name, spec, true)
163
+ end
164
+
165
+ end
166
+
167
+ #-------------------------------------------------------------------------#
168
+
169
+ # Provides support for fetching a specification file from a Git remote.
170
+ #
171
+ # Supports all the options of the downloader (is similar to the git key of
172
+ # `source` attribute of a specification).
173
+ #
174
+ # @note The podspec must be in the root of the repository and should have a
175
+ # name matching the one of the dependency.
176
+ #
177
+ class GitSource < AbstractExternalSource
178
+
179
+ # @see AbstractExternalSource#fetch
180
+ #
181
+ def fetch(sandbox)
182
+ pre_download(sandbox)
183
+ end
184
+
185
+ # @see AbstractExternalSource#description
186
+ #
187
+ def description
188
+ "from `#{params[:git]}`".tap do |description|
189
+ description << ", commit `#{params[:commit]}`" if params[:commit]
190
+ description << ", branch `#{params[:branch]}`" if params[:branch]
191
+ description << ", tag `#{params[:tag]}`" if params[:tag]
192
+ end
193
+ end
194
+ end
195
+
196
+ #-------------------------------------------------------------------------#
197
+
198
+ # Provides support for fetching a specification file from a SVN source
199
+ # remote.
200
+ #
201
+ # Supports all the options of the downloader (is similar to the git key of
202
+ # `source` attribute of a specification).
203
+ #
204
+ # @note The podspec must be in the root of the repository and should have a
205
+ # name matching the one of the dependency.
206
+ #
207
+ class SvnSource < AbstractExternalSource
208
+
209
+ # @see AbstractExternalSource#fetch
210
+ #
211
+ def fetch(sandbox)
212
+ pre_download(sandbox)
213
+ end
214
+
215
+ # @see AbstractExternalSource#description
216
+ #
217
+ def description
218
+ "from `#{params[:svn]}`".tap do |description|
219
+ description << ", folder `#{params[:folder]}`" if params[:folder]
220
+ description << ", tag `#{params[:tag]}`" if params[:tag]
221
+ description << ", revision `#{params[:revision]}`" if params[:revision]
222
+ end
223
+ end
224
+ end
225
+
226
+ #-------------------------------------------------------------------------#
227
+
228
+ # Provides support for fetching a specification file from a Mercurial
229
+ # source remote.
230
+ #
231
+ # Supports all the options of the downloader (is similar to the git key of
232
+ # `source` attribute of a specification).
233
+ #
234
+ # @note The podspec must be in the root of the repository and should have a
235
+ # name matching the one of the dependency.
236
+ #
237
+ class MercurialSource < AbstractExternalSource
238
+
239
+ # @see AbstractExternalSource#fetch
240
+ #
241
+ def fetch(sandbox)
242
+ pre_download(sandbox)
243
+ end
244
+
245
+ # @see AbstractExternalSource#description
246
+ #
247
+ def description
248
+ "from `#{params[:hg]}`".tap do |description|
249
+ description << ", revision `#{params[:revision]}`" if params[:revision]
250
+ end
251
+ end
252
+ end
253
+
254
+ #-------------------------------------------------------------------------#
255
+
256
+ # Provides support for fetching a specification file from an URL. Can be
257
+ # http, file, etc.
258
+ #
259
+ class PodspecSource < AbstractExternalSource
260
+
261
+ # @see AbstractExternalSource#fetch
262
+ #
263
+ def fetch(sandbox)
264
+ UI.titled_section("Fetching podspec for `#{name}` #{description}", { :verbose_prefix => "-> " }) do
265
+ path = params[:podspec]
266
+ path = Pathname.new(path).expand_path if path.to_s.start_with?("~")
267
+ require 'open-uri'
268
+ open(path) { |io| store_podspec(sandbox, io.read) }
269
+ end
270
+ end
271
+
272
+ # @see AbstractExternalSource#description
273
+ #
274
+ def description
275
+ "from `#{params[:podspec]}`"
276
+ end
277
+ end
278
+
279
+ #-------------------------------------------------------------------------#
280
+
281
+ # Provides support for fetching a specification file from a path local to
282
+ # the machine running the installation.
283
+ #
284
+ # Works with the {LocalPod::LocalSourcedPod} class.
285
+ #
286
+ class LocalSource < AbstractExternalSource
287
+
288
+ # @see AbstractExternalSource#fetch
289
+ #
290
+ def fetch(sandbox)
291
+ UI.titled_section("Fetching podspec for `#{name}` #{description}", { :verbose_prefix => "-> " }) do
292
+ podspec = pod_spec_path
293
+ store_podspec(sandbox, podspec)
294
+ sandbox.store_local_path(name, podspec.dirname)
295
+ end
296
+ end
297
+
298
+ # @see AbstractExternalSource#description
299
+ #
300
+ def description
301
+ "from `#{params[:local]}`"
302
+ end
303
+
304
+ #--------------------------------------#
305
+
306
+ private
307
+
308
+ # @!group Helpers
309
+
310
+ # @return [Pathname] the path of the podspec.
311
+ #
312
+ def pod_spec_path
313
+ declared_path = params[:local].to_s
314
+ path_with_ext = File.extname(declared_path) == '.podspec' ? declared_path : "#{declared_path}/#{name}.podspec"
315
+ path_without_tilde = path_with_ext.gsub('~', ENV['HOME'])
316
+ absolute_path = Pathname(podfile_path).dirname + path_without_tilde
317
+
318
+ unless absolute_path.exist?
319
+ raise Informative, "No podspec found for `#{name}` in `#{params[:local]}`"
320
+ end
321
+ absolute_path
322
+ end
323
+ end
324
+ end
325
+ end
@@ -6,7 +6,9 @@ end
6
6
 
7
7
  # This makes Rake::FileList usable with the Specification attributes
8
8
  # source_files, public_header_files, preserve_paths, and resources.
9
-
9
+ #
10
+ # @todo This needs to be deprecated as we no have the PathList List
11
+ #
10
12
  module Rake
11
13
  class FileList
12
14
  def prepend_patterns(pathname)
@@ -20,6 +22,11 @@ module Rake
20
22
  def glob
21
23
  to_a.map { |path| Pathname.new(path) }
22
24
  end
25
+
26
+ def inspect
27
+ "<##{self.class} pending_add=#{@pending_add}>"
28
+ end
29
+ alias :to_s :inspect
23
30
  end
24
31
  end
25
32
 
@@ -0,0 +1,7 @@
1
+ module Pod
2
+
3
+ # The version of the cocoapods command line tool.
4
+ #
5
+ VERSION = '0.17.0.rc1' unless defined? Pod::VERSION
6
+ end
7
+
@@ -3,35 +3,99 @@ module Pod
3
3
 
4
4
  class Acknowledgements
5
5
 
6
+ # @return [Array<Class>] The classes of the acknowledgements generator
7
+ # subclasses.
8
+ #
6
9
  def self.generators
7
10
  [Plist, Markdown]
8
11
  end
9
12
 
10
- def initialize(target_definition, pods)
11
- @target_definition, @pods = target_definition, pods
12
- end
13
+ # @return [Array<Sandbox::FileAccessor>] the list of the file accessors
14
+ # for the specs of the target that needs to generate the
15
+ # acknowledgements.
16
+ #
17
+ attr_reader :file_accessors
13
18
 
14
- def save_as(path)
15
- Acknowledgements.generators.each do |generator|
16
- generator.new(@target_definition, @pods).save_as(path)
17
- end
19
+ # @param [Array<Sandbox::FileAccessor>] @see file_accessors.
20
+ #
21
+ def initialize(file_accessors)
22
+ @file_accessors = file_accessors
18
23
  end
19
24
 
25
+ #-----------------------------------------------------------------------#
26
+
27
+ # !@group Configuration
28
+
29
+ # @return [String] The title of the acknowledgements file.
30
+ #
20
31
  def header_title
21
32
  "Acknowledgements"
22
33
  end
23
34
 
35
+ # @return [String] A text to present before listing the acknowledgements.
36
+ #
24
37
  def header_text
25
38
  "This application makes use of the following third party libraries:"
26
39
  end
27
40
 
41
+ # @return [String] The title of the foot notes.
42
+ #
28
43
  def footnote_title
29
44
  ""
30
45
  end
31
46
 
47
+ # @return [String] the foot notes.
48
+ #
32
49
  def footnote_text
33
50
  "Generated by CocoaPods - http://cocoapods.org"
34
51
  end
52
+
53
+ #-----------------------------------------------------------------------#
54
+
55
+ private
56
+
57
+ # !@group Private methods
58
+
59
+ # @return [Array<Specification>] The root specifications for which the
60
+ # acknowledgements should be generated.
61
+ #
62
+ def specs
63
+ file_accessors.map{ |accessor| accessor.spec.root }.uniq
64
+ end
65
+
66
+ # Returns the text of the license for the given spec.
67
+ #
68
+ # @param [Specification] spec
69
+ # the specification for which license is needed.
70
+ #
71
+ # @return [String] The text of the license.
72
+ # @return [Nil] If not license text could be found.
73
+ #
74
+ def license_text(spec)
75
+ if spec.license
76
+ if text = spec.license[:text]
77
+ text
78
+ elsif license_file = file_accessor(spec).license
79
+ text = IO.read(license_file)
80
+ end
81
+ end
82
+ end
83
+
84
+ protected
85
+
86
+ # Returns the file accessor for the given spec.
87
+ #
88
+ # @param [Specification] spec
89
+ # the specification for which the file accessor is needed.
90
+ #
91
+ # @return [Sandbox::FileAccessor] The file accessor.
92
+ #
93
+ def file_accessor(spec)
94
+ file_accessors.find { |accessor| accessor.spec.root == spec }
95
+ end
96
+
97
+ #-----------------------------------------------------------------------#
98
+
35
99
  end
36
100
  end
37
101
  end