cocoapods 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/CHANGELOG.md +129 -0
  2. data/README.md +58 -54
  3. data/bin/pod +1 -0
  4. data/lib/cocoapods.rb +7 -10
  5. data/lib/cocoapods/bridge_support_generator.rb +3 -5
  6. data/lib/cocoapods/command.rb +1 -1
  7. data/lib/cocoapods/command/repo.rb +22 -12
  8. data/lib/cocoapods/command/setup.rb +14 -3
  9. data/lib/cocoapods/command/spec.rb +8 -7
  10. data/lib/cocoapods/config.rb +2 -2
  11. data/lib/cocoapods/dependency.rb +65 -3
  12. data/lib/cocoapods/downloader.rb +7 -2
  13. data/lib/cocoapods/installer.rb +244 -99
  14. data/lib/cocoapods/podfile.rb +145 -10
  15. data/lib/cocoapods/resolver.rb +10 -6
  16. data/lib/cocoapods/specification.rb +13 -12
  17. data/lib/cocoapods/specification/set.rb +34 -0
  18. data/lib/cocoapods/xcodeproj_ext.rb +99 -0
  19. metadata +32 -35
  20. data/lib/cocoapods/project_template.rb +0 -35
  21. data/lib/cocoapods/xcode/config.rb +0 -33
  22. data/lib/cocoapods/xcode/copy_resources_script.rb +0 -21
  23. data/lib/cocoapods/xcode/project.rb +0 -356
  24. data/lib/cocoapods/xcode/workspace.rb +0 -56
  25. data/xcode-project-templates/cocoa-static-library/Pods-Prefix.pch +0 -7
  26. data/xcode-project-templates/cocoa-static-library/Pods.xcconfig +0 -1
  27. data/xcode-project-templates/cocoa-static-library/Pods.xcodeproj/project.pbxproj +0 -236
  28. data/xcode-project-templates/cocoa-static-library/PodsResources.sh +0 -8
  29. data/xcode-project-templates/cocoa-touch-static-library/Pods-Prefix.pch +0 -7
  30. data/xcode-project-templates/cocoa-touch-static-library/Pods.xcconfig +0 -1
  31. data/xcode-project-templates/cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj +0 -248
  32. data/xcode-project-templates/cocoa-touch-static-library/PodsResources.sh +0 -8
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 2
7
+ - 3
9
8
  - 0
10
- version: 0.2.0
9
+ version: 0.3.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Eloy Duran
@@ -15,12 +14,29 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-09-17 00:00:00 Z
19
- dependencies: []
20
-
17
+ date: 2011-11-13 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: xcodeproj
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 0
30
+ - 2
31
+ version: 0.0.2
32
+ type: :runtime
33
+ version_requirements: *id001
21
34
  description: |-
22
- CocoaPods is an Objective-C library package manager. It tries to take away all hard work of maintaining your dependencies, but in a lean and flexible way. Its goal is to create a more centralized overview of open-source libraries and unify the way in which we deal with them.
23
- CocoaPods will calculate the right set of versions of all of your project's dependencies, install them, and set them up to be build as part of a dependency static library, which your project links against.
35
+ CocoaPods manages library dependencies for your Xcode project.
36
+
37
+ You specify the dependencies for your project in one easy text file. CocoaPods resolves dependencies between libraries, fetches source code for the dependencies, and creates and maintains an Xcode workspace to build your project.
38
+
39
+ Ultimately, the goal is to improve discoverability of, and engagement in, third party open-source libraries, by creating a more centralized ecosystem.
24
40
  email: eloy.de.enige@gmail.com
25
41
  executables:
26
42
  - pod
@@ -42,65 +58,46 @@ files:
42
58
  - lib/cocoapods/executable.rb
43
59
  - lib/cocoapods/installer.rb
44
60
  - lib/cocoapods/podfile.rb
45
- - lib/cocoapods/project_template.rb
46
61
  - lib/cocoapods/resolver.rb
47
62
  - lib/cocoapods/source.rb
48
63
  - lib/cocoapods/specification/set.rb
49
64
  - lib/cocoapods/specification.rb
50
65
  - lib/cocoapods/version.rb
51
- - lib/cocoapods/xcode/config.rb
52
- - lib/cocoapods/xcode/copy_resources_script.rb
53
- - lib/cocoapods/xcode/project.rb
54
- - lib/cocoapods/xcode/workspace.rb
66
+ - lib/cocoapods/xcodeproj_ext.rb
55
67
  - lib/cocoapods.rb
56
- - xcode-project-templates/cocoa-static-library/Pods-Prefix.pch
57
- - xcode-project-templates/cocoa-static-library/Pods.xcconfig
58
- - xcode-project-templates/cocoa-static-library/Pods.xcodeproj/project.pbxproj
59
- - xcode-project-templates/cocoa-static-library/PodsResources.sh
60
- - xcode-project-templates/cocoa-touch-static-library/Pods-Prefix.pch
61
- - xcode-project-templates/cocoa-touch-static-library/Pods.xcconfig
62
- - xcode-project-templates/cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj
63
- - xcode-project-templates/cocoa-touch-static-library/PodsResources.sh
64
68
  - bin/pod
65
69
  - README.md
66
70
  - LICENSE
67
- homepage: https://github.com/alloy/cocoapods
71
+ - CHANGELOG.md
72
+ has_rdoc: true
73
+ homepage: https://github.com/CocoaPods/CocoaPods
68
74
  licenses:
69
75
  - MIT
70
- post_install_message: |+
71
- To speed up load time of CocoaPods consider compiling the Ruby source files:
72
-
73
- $ sudo macgem install rubygems-compile
74
- $ sudo macgem compile cocoapods
75
-
76
+ post_install_message: "[!] If this is your first time install of CocoaPods, or if you are upgrading, first run: $ pod setup"
76
77
  rdoc_options: []
77
78
 
78
79
  require_paths:
79
80
  - lib
80
81
  required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- hash: 3
86
85
  segments:
87
86
  - 0
88
87
  version: "0"
89
88
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
89
  requirements:
92
90
  - - ">="
93
91
  - !ruby/object:Gem::Version
94
- hash: 3
95
92
  segments:
96
93
  - 0
97
94
  version: "0"
98
95
  requirements: []
99
96
 
100
97
  rubyforge_project:
101
- rubygems_version: 1.8.7
98
+ rubygems_version: 1.3.6
102
99
  signing_key:
103
100
  specification_version: 3
104
- summary: A simple Objective-C library package manager. (Requires MacRuby.)
101
+ summary: An Objective-C library package manager. (Requires MacRuby.)
105
102
  test_files: []
106
103
 
@@ -1,35 +0,0 @@
1
- require 'fileutils'
2
-
3
- module Pod
4
- class ProjectTemplate
5
- def initialize(platform)
6
- @platform = platform
7
- end
8
-
9
- # TODO this is a workaround for an issue with MacRuby with compiled files
10
- # that makes the use of __FILE__ impossible.
11
- #
12
- #TEMPLATES_DIR = Pathname.new(File.expand_path('../../../xcode-project-templates', __FILE__))
13
- file = $LOADED_FEATURES.find { |file| file =~ %r{cocoapods/project_template\.rbo?$} }
14
- TEMPLATES_DIR = Pathname.new(File.expand_path('../../../xcode-project-templates', file))
15
-
16
- def path
17
- @path ||= case @platform
18
- when :osx
19
- TEMPLATES_DIR + 'cocoa-static-library'
20
- when :ios
21
- TEMPLATES_DIR + 'cocoa-touch-static-library'
22
- else
23
- raise "No Xcode project template exists for the platform `#{platform.inspect}'"
24
- end
25
- end
26
-
27
- def xcodeproj_path
28
- @xcodeproj_path = File.join(path, 'Pods.xcodeproj')
29
- end
30
-
31
- def copy_to(pods_root)
32
- FileUtils.cp_r("#{path}/.", pods_root)
33
- end
34
- end
35
- end
@@ -1,33 +0,0 @@
1
- module Pod
2
- module Xcode
3
- class Config
4
- def initialize(xcconfig = {})
5
- @attributes = {}
6
- merge!(xcconfig)
7
- end
8
-
9
- def to_hash
10
- @attributes
11
- end
12
-
13
- def merge!(xcconfig)
14
- xcconfig.to_hash.each do |key, value|
15
- if existing_value = @attributes[key]
16
- @attributes[key] = "#{existing_value} #{value}"
17
- else
18
- @attributes[key] = value
19
- end
20
- end
21
- end
22
- alias_method :<<, :merge!
23
-
24
- def to_s
25
- @attributes.map { |key, value| "#{key} = #{value}" }.join("\n")
26
- end
27
-
28
- def create_in(pods_root)
29
- (pods_root + 'Pods.xcconfig').open('w') { |file| file << to_s }
30
- end
31
- end
32
- end
33
- end
@@ -1,21 +0,0 @@
1
- module Pod
2
- module Xcode
3
- class CopyResourcesScript
4
- attr_reader :resources
5
-
6
- # A list of files relative to the project pods root.
7
- def initialize(resources)
8
- @resources = resources
9
- end
10
-
11
- def create_in(root)
12
- return if @resources.empty?
13
- (root + 'PodsResources.sh').open('a') do |script|
14
- @resources.each do |resource|
15
- script.puts "install_resource '#{resource}'"
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,356 +0,0 @@
1
- framework 'Foundation'
2
- require 'fileutils'
3
-
4
- module Pod
5
- module Xcode
6
- class Project
7
- class PBXObject
8
- def self.attributes_accessor(*names)
9
- names.each do |name|
10
- name = name.to_s
11
- define_method(name) { @attributes[name] }
12
- define_method("#{name}=") { |value| @attributes[name] = value }
13
- end
14
- end
15
-
16
- def self.isa
17
- @isa ||= name.split('::').last
18
- end
19
-
20
- attr_reader :uuid, :attributes
21
- attributes_accessor :isa, :name
22
-
23
- def initialize(project, uuid, attributes)
24
- @project, @uuid, @attributes = project, uuid || generate_uuid, attributes
25
- self.isa ||= self.class.isa
26
- end
27
-
28
- def inspect
29
- "#<#{isa} UUID: `#{uuid}', name: `#{name}'>"
30
- end
31
-
32
- private
33
-
34
- def generate_uuid
35
- _uuid = CFUUIDCreate(nil)
36
- uuid = CFUUIDCreateString(nil, _uuid)
37
- CFRelease(_uuid)
38
- CFMakeCollectable(uuid)
39
- # Xcode's version is actually shorter, not worrying about collisions too much right now.
40
- uuid.gsub('-', '')[0..23]
41
- end
42
-
43
- def list_by_class(uuids, klass, scoped = nil)
44
- unless scoped
45
- scoped = uuids.map { |uuid| @project.objects[uuid] }.select { |o| o.is_a?(klass) }
46
- end
47
- PBXObjectList.new(klass, @project, scoped) do |object|
48
- # Add the uuid of a newly created object to the uuids list
49
- uuids << object.uuid
50
- end
51
- end
52
- end
53
-
54
- class PBXGroup < PBXObject
55
- attributes_accessor :sourceTree, :children
56
-
57
- def initialize(project, uuid, attributes)
58
- super
59
- self.sourceTree ||= '<group>'
60
- self.children ||= []
61
- end
62
-
63
- def files
64
- list_by_class(children, PBXFileReference)
65
- end
66
-
67
- def source_files
68
- list_by_class(children, PBXFileReference, files.select { |file| !file.build_file.nil? })
69
- end
70
-
71
- def groups
72
- list_by_class(children, PBXGroup)
73
- end
74
-
75
- def add_source_file(path, copy_header_phase = nil, compiler_flags = nil)
76
- file = files.new('path' => path.to_s)
77
- build_file = file.build_file
78
- if path.extname == '.h'
79
- build_file.settings = { 'ATTRIBUTES' => ["Public"] }
80
- # Working around a bug in Xcode 4.2 betas, remove this once the Xcode bug is fixed:
81
- # https://github.com/alloy/cocoapods/issues/13
82
- #phase = copy_header_phase || @project.headers_build_phases.first
83
- phase = copy_header_phase || @project.copy_files_build_phases.first # TODO is this really needed?
84
- phase.files << build_file
85
- else
86
- build_file.settings = { 'COMPILER_FLAGS' => compiler_flags } if compiler_flags
87
- @project.source_build_phase.files << build_file
88
- end
89
- file
90
- end
91
-
92
- def <<(child)
93
- children << child.uuid
94
- end
95
- end
96
-
97
- class PBXFileReference < PBXObject
98
- attributes_accessor :path, :sourceTree
99
-
100
- def initialize(project, uuid, attributes)
101
- is_new = uuid.nil?
102
- super
103
- self.name ||= pathname.basename.to_s
104
- self.sourceTree ||= 'SOURCE_ROOT'
105
- if is_new
106
- @project.build_files.new.file = self
107
- end
108
- end
109
-
110
- def pathname
111
- Pathname.new(path)
112
- end
113
-
114
- def build_file
115
- @project.build_files.find { |o| o.fileRef == uuid }
116
- end
117
- end
118
-
119
- class PBXBuildFile < PBXObject
120
- attributes_accessor :fileRef, :settings
121
-
122
- # Takes a PBXFileReference instance and assigns its uuid to the fileRef attribute.
123
- def file=(file)
124
- self.fileRef = file.uuid
125
- end
126
-
127
- # Returns a PBXFileReference instance corresponding to the uuid in the fileRef attribute.
128
- def file
129
- @project.objects[fileRef]
130
- end
131
- end
132
-
133
- class PBXBuildPhase < PBXObject
134
- attributes_accessor :files
135
- alias_method :file_uuids, :files
136
- alias_method :file_uuids=, :files=
137
-
138
- def initialize(project, uuid, attributes)
139
- super
140
- self.file_uuids ||= []
141
- end
142
-
143
- def files
144
- list_by_class(file_uuids, PBXBuildFile)
145
- end
146
- end
147
-
148
- class PBXSourcesBuildPhase < PBXBuildPhase; end
149
- class PBXCopyFilesBuildPhase < PBXBuildPhase; end
150
- class PBXFrameworksBuildPhase < PBXBuildPhase; end
151
- class PBXShellScriptBuildPhase < PBXBuildPhase
152
- attributes_accessor :shellScript
153
- end
154
-
155
- class PBXNativeTarget < PBXObject
156
- attributes_accessor :buildPhases, :buildConfigurationList
157
- alias_method :build_phase_uuids, :buildPhases
158
- alias_method :build_phase_uuids=, :buildPhases=
159
- alias_method :build_configuration_list_uuid, :buildConfigurationList
160
- alias_method :build_configuration_list_uuid=, :buildConfigurationList=
161
-
162
- def buildPhases
163
- list_by_class(build_phase_uuids, PBXBuildPhase)
164
- end
165
-
166
- def buildConfigurationList
167
- @project.objects[build_configuration_list_uuid]
168
- end
169
-
170
- def buildConfigurationList=(config_list)
171
- self.build_configuration_list_uuid = config_list.uuid
172
- end
173
- end
174
-
175
- class XCBuildConfiguration < PBXObject
176
- attributes_accessor :baseConfigurationReference
177
- alias_method :base_configuration_reference_uuid, :baseConfigurationReference
178
- alias_method :base_configuration_reference_uuid=, :baseConfigurationReference=
179
-
180
- def baseConfigurationReference
181
- @project.objects[base_configuration_reference_uuid]
182
- end
183
-
184
- def baseConfigurationReference=(config)
185
- self.base_configuration_reference_uuid = config.uuid
186
- end
187
- end
188
-
189
- class XCConfigurationList < PBXObject
190
- attributes_accessor :buildConfigurations
191
- alias_method :build_configuration_uuids, :buildConfigurations
192
- alias_method :build_configuration_uuids=, :buildConfigurations=
193
-
194
- def buildConfigurations
195
- list_by_class(build_configuration_uuids, XCBuildConfiguration)
196
- end
197
-
198
- def buildConfigurations=(configs)
199
- self.build_configuration_uuids = configs.map(&:uuid)
200
- end
201
- end
202
-
203
- # Missing constants that begin with either `PBX' or `XC' are assumed to be
204
- # valid classes in a Xcode project. A new PBXObject subclass is created
205
- # for the constant and returned.
206
- def self.const_missing(name)
207
- if name =~ /^(PBX|XC)/
208
- klass = Class.new(PBXObject)
209
- const_set(name, klass)
210
- klass
211
- else
212
- super
213
- end
214
- end
215
-
216
- class PBXObjectList
217
- include Enumerable
218
-
219
- def initialize(represented_class, project, scoped, &new_object_callback)
220
- @represented_class = represented_class
221
- @project = project
222
- @scoped_hash = scoped.is_a?(Array) ? scoped.inject({}) { |h, o| h[o.uuid] = o.attributes; h } : scoped
223
- @callback = new_object_callback
224
- end
225
-
226
- def [](uuid)
227
- if hash = @scoped_hash[uuid]
228
- Project.const_get(hash['isa']).new(@project, uuid, hash)
229
- end
230
- end
231
-
232
- def add(klass, hash = {})
233
- object = klass.new(@project, nil, hash)
234
- @project.objects_hash[object.uuid] = object.attributes
235
- object
236
- end
237
-
238
- def new(hash = {})
239
- object = add(@represented_class, hash)
240
- @callback.call(object) if @callback
241
- object
242
- end
243
-
244
- def <<(object)
245
- @callback.call(object) if @callback
246
- end
247
-
248
- def each
249
- @scoped_hash.keys.each do |uuid|
250
- yield self[uuid]
251
- end
252
- end
253
-
254
- def inspect
255
- "<PBXObjectList: #{map(&:inspect)}>"
256
- end
257
-
258
- # Only makes sense on the list that has the full objects_hash as its scoped hash.
259
- def select_by_class(klass)
260
- scoped = @project.objects_hash.select { |_, attr| attr['isa'] == klass.isa }
261
- PBXObjectList.new(klass, @project, scoped)
262
- end
263
- end
264
-
265
- def initialize(xcodeproj)
266
- file = File.join(xcodeproj, 'project.pbxproj')
267
- @plist = NSMutableDictionary.dictionaryWithContentsOfFile(file.to_s)
268
- end
269
-
270
- def to_hash
271
- @plist
272
- end
273
-
274
- def objects_hash
275
- @plist['objects']
276
- end
277
-
278
- def objects
279
- @objects ||= PBXObjectList.new(PBXObject, self, objects_hash)
280
- end
281
-
282
- def groups
283
- objects.select_by_class(PBXGroup)
284
- end
285
-
286
- def main_group
287
- project = objects[@plist['rootObject']]
288
- objects[project.attributes['mainGroup']]
289
- end
290
-
291
- # Shortcut access to the `Pods' PBXGroup.
292
- def pods
293
- groups.find { |g| g.name == 'Pods' }
294
- end
295
-
296
- # Adds a group as child to the `Pods' group.
297
- def add_pod_group(name)
298
- pods.groups.new('name' => name)
299
- end
300
-
301
- def files
302
- objects.select_by_class(PBXFileReference)
303
- end
304
-
305
- def build_files
306
- objects.select_by_class(PBXBuildFile)
307
- end
308
-
309
- def source_build_phase
310
- objects.find { |o| o.is_a?(PBXSourcesBuildPhase) }
311
- end
312
-
313
- def copy_files_build_phases
314
- objects.select_by_class(PBXCopyFilesBuildPhase)
315
- end
316
-
317
- def targets
318
- objects.select_by_class(PBXNativeTarget)
319
- end
320
-
321
- IGNORE_GROUPS = ['Pods', 'Frameworks', 'Products', 'Supporting Files']
322
- def source_files
323
- source_files = {}
324
- groups.each do |group|
325
- next if group.name.nil? || IGNORE_GROUPS.include?(group.name)
326
- source_files[group.name] = group.source_files.map(&:pathname)
327
- end
328
- source_files
329
- end
330
-
331
- def save_as(projpath)
332
- projpath = projpath.to_s
333
- FileUtils.mkdir_p(projpath)
334
- @plist.writeToFile(File.join(projpath, 'project.pbxproj'), atomically:true)
335
- end
336
-
337
- # TODO add comments, or even constants, describing what these magic numbers are.
338
- def add_copy_header_build_phase(name, path)
339
- phase = copy_files_build_phases.new({
340
- "buildActionMask" => "2147483647",
341
- "dstPath" => "$(PUBLIC_HEADERS_FOLDER_PATH)/#{path}",
342
- "dstSubfolderSpec" => "16",
343
- "name" => "Copy #{name} Public Headers",
344
- "runOnlyForDeploymentPostprocessing" => "0",
345
- })
346
- targets.first.buildPhases << phase
347
- phase
348
- end
349
-
350
- # A silly hack to pretty print the objects hash from MacRuby.
351
- def pretty_print
352
- puts `ruby -r pp -e 'pp(#{@template.inspect})'`
353
- end
354
- end
355
- end
356
- end