cocoapods 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,34 @@
1
+ ## 0.9.0
2
+
3
+ [CocoaPods](http://git.io/kucJQw) • [Xcodeproj](http://git.io/5eLL8g)
4
+
5
+ ###### Enhancements
6
+
7
+ - Force downloading the ‘bleeding edge’ version of a pod with the `:head` flag. [#392](http://git.io/t_NVRQ)
8
+ - Support for weak frameworks. [#263](http://git.io/XZDuog)
9
+ - Use double quotes when shelling out. This makes a url like `$HOME/local/lib` work. [#396](http://git.io/DnBzhA)
10
+
11
+ ###### Bug fixes
12
+
13
+ - Relaxed linter to accepts pod that only specify paths to preserve (like TuneupJS).
14
+ - Gender neutralization of podfile documentation. [#384](http://git.io/MAsHXg)
15
+ - Exit early when using an old RubyGems version (< 1.4.0). These versions contain subtle bugs
16
+ related to prerelease version comparisons. Unfortunately, OS X >= 10.7 ships with 1.3.6. [#398](http://git.io/Lr7DoA)
17
+
18
+
1
19
  ## 0.8.0
2
20
 
3
- [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.7.0...0.8.0) • [Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.2.2...0.2.3)
21
+ [CocoaPods](http://git.io/RgMF3w) • [Xcodeproj](http://git.io/KBKE_Q)
4
22
 
5
23
  ###### Breaking change
6
24
 
7
25
  Syntax change in Podfile: `dependency` has been replaced by `pod`.
8
26
 
9
- ```ruby
27
+ ``ruby
10
28
  platform :ios
11
29
  pod 'JSONKit', '~> 1.4'
12
30
  pod 'Reachability', '~> 2.0.4'
13
- ```
31
+ ``
14
32
 
15
33
  ###### Bug fixes
16
34
 
@@ -19,7 +37,7 @@ pod 'Reachability', '~> 2.0.4'
19
37
 
20
38
  ## 0.7.0
21
39
 
22
- [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.6.1...0.7.0) • [Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.2.1...0.2.2)
40
+ [CocoaPods](http://git.io/Agia6A) • [Xcodeproj](http://git.io/mlqquw)
23
41
 
24
42
  ###### Features
25
43
 
@@ -38,7 +56,7 @@ pod 'Reachability', '~> 2.0.4'
38
56
 
39
57
  ## 0.6.1
40
58
 
41
- [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.6.0...0.6.1) • [Xcodeproj](https://github.com/CocoaPods/XcodeProj/compare/0.2.0...0.2.1)
59
+ [CocoaPods](http://git.io/45wFjw) • [Xcodeproj](http://git.io/rRA4XQ)
42
60
 
43
61
  ###### Bug fixes
44
62
 
@@ -60,7 +78,7 @@ CocoaPods can now integrate all the targets specified in your `Podfile`.
60
78
  To specify which target, in your Xcode project, a Pods target should be linked
61
79
  with, use the `link_with` method like so:
62
80
 
63
- ```ruby
81
+ ``ruby
64
82
  platform :ios
65
83
 
66
84
  workspace 'MyWorkspace'
@@ -73,7 +91,7 @@ target :test, :exclusive => true do
73
91
  link_with 'TestRunnerTarget'
74
92
  dependency 'Kiwi'
75
93
  end
76
- ```
94
+ ``
77
95
 
78
96
  _NOTE: As you can see it can take either one target name, or an array of names._
79
97
 
@@ -98,9 +116,9 @@ configurations are based on the `Release` configuration, to base them on the
98
116
  `Debug` configuration you will have to explicitely specify them as can be seen
99
117
  above in the following line:
100
118
 
101
- ```ruby
119
+ ``ruby
102
120
  xcodeproj 'TestProject', 'Test' => :debug
103
- ```
121
+ ``
104
122
 
105
123
 
106
124
  ### Documentation
@@ -110,16 +128,16 @@ CocoaPods will now generate documentation for every library with the
110
128
 
111
129
  You can customize the settings used like so:
112
130
 
113
- ```ruby
131
+ ``ruby
114
132
  s.documentation = { :appledoc => ['--product-name', 'My awesome project!'] }
115
- ```
133
+ ``
116
134
 
117
135
  Alternatively, you can specify a URL where an HTML version of the documentation
118
136
  can be found:
119
137
 
120
- ```ruby
138
+ ``ruby
121
139
  s.documentation = { :html => 'http://example.com/docs/index.html' }
122
- ```
140
+ ``
123
141
 
124
142
  See [#149](https://github.com/CocoaPods/CocoaPods/issues/149) and
125
143
  [#151](https://github.com/CocoaPods/CocoaPods/issues/151) for more info.
@@ -140,18 +158,18 @@ If you're not happy with the default boilerplate text generated for the title, h
140
158
  and footnotes in the files, it's possible to customise these by overriding the methods
141
159
  that generate the text in your `Podfile` like this:
142
160
 
143
- ```ruby
161
+ ``ruby
144
162
  class ::Pod::Generator::Acknowledgements
145
163
  def header_text
146
164
  "My custom header text"
147
165
  end
148
166
  end
149
- ```
167
+ ``
150
168
 
151
169
  You can even go one step further and customise the text on a per target basis by
152
170
  checking against the target name, like this:
153
171
 
154
- ```ruby
172
+ ``ruby
155
173
  class ::Pod::Generator::Acknowledgements
156
174
  def header_text
157
175
  if @target_definition.label.end_with?("MyTargetName")
@@ -161,16 +179,16 @@ class ::Pod::Generator::Acknowledgements
161
179
  end
162
180
  end
163
181
  end
164
- ```
182
+ ``
165
183
 
166
184
  Finally, here's a list of the methods that are available to override:
167
185
 
168
- ```ruby
186
+ ``ruby
169
187
  header_title
170
188
  header_text
171
189
  footnote_title
172
190
  footnote_text
173
- ```
191
+ ``
174
192
 
175
193
 
176
194
  ### Introduced two new classes: LocalPod and Sandbox.
@@ -281,7 +299,7 @@ different sets of depedencies. This means that you can create a separate
281
299
  library which contains all dependencies, including extra ones that you only use
282
300
  in, for instance, a debug or test build. [[docs][1]]
283
301
 
284
- ```Ruby
302
+ ``ruby
285
303
  # This Podfile will build three static libraries:
286
304
  # * libPods.a
287
305
  # * libPods-debug.a
@@ -302,7 +320,7 @@ target :test, :exclusive => true do
302
320
  # the `libPods-test.a` library.
303
321
  dependency 'Kiwi'
304
322
  end
305
- ```
323
+ ``
306
324
 
307
325
  ### Install libraries from anywhere
308
326
 
@@ -310,7 +328,7 @@ A dependency can take a git url if the repo contains a podspec file in its
310
328
  root, or a podspec can be loaded from a file or HTTP location. If no podspec is
311
329
  available, a specification can be defined inline in the Podfile. [[docs][2]]
312
330
 
313
- ```Ruby
331
+ ``ruby
314
332
  # From a spec repo.
315
333
  dependency 'SSToolkit'
316
334
 
@@ -341,14 +359,14 @@ dependency do |s|
341
359
  end
342
360
  end
343
361
  end
344
- ```
362
+ ``
345
363
 
346
364
  ### Add a `post_install` hook to the Podfile class
347
365
 
348
366
  This allows the user to customize, for instance, the generated Xcode project
349
367
  _before_ it’s written to disk. [[docs][3]]
350
368
 
351
- ```Ruby
369
+ ``ruby
352
370
  # Enable garbage collection support for MacRuby applications.
353
371
  post_install do |installer|
354
372
  installer.project.targets.each do |target|
@@ -357,14 +375,14 @@ post_install do |installer|
357
375
  end
358
376
  end
359
377
  end
360
- ```
378
+ ``
361
379
 
362
380
  ### Manifest
363
381
 
364
382
  Generate a Podfile.lock file next to the Podfile, which contains a manifest of
365
383
  your application’s dependencies and their dependencies.
366
384
 
367
- ```
385
+ ``
368
386
  PODS:
369
387
  - JSONKit (1.4)
370
388
  - LibComponentLogging-Core (1.1.4)
@@ -386,7 +404,7 @@ DOWNLOAD_ONLY:
386
404
  DEPENDENCIES:
387
405
  - RestKit-JSON-JSONKit
388
406
  - RestKit-ObjectMapping
389
- ```
407
+ ``
390
408
 
391
409
  ### Generate Xcode projects from scratch
392
410
 
data/README.md CHANGED
@@ -43,7 +43,7 @@ Now that you've got CocoaPods installed you can easily add it to your project.
43
43
 
44
44
  1. If you're using a fresh out of the box Mac with Lion using Xcode from the Mac App Store, you will need to install the Command Line Tools for Xcode first: [here](https://developer.apple.com/downloads/index.action)
45
45
 
46
- 2. CocoaPods re-uses some of the RubyGems 1.3.6 classes. If you have an older version (pre OS X 10.7), you will have to update RubyGems: `$ gem update --system`.
46
+ 2. CocoaPods re-uses some of the RubyGems classes. If you have a version older than 1.4.0, you will have to update RubyGems: `$ gem update --system`.
47
47
 
48
48
 
49
49
  ## Adding it to your project
@@ -1,5 +1,19 @@
1
+ require 'rubygems'
2
+
3
+ # Better to fail early and clear then during installation of pods.
4
+ #
5
+ # RubyGems 1.3.6 (which ships with OS X >= 10.7) up to 1.4.0 have a couple of
6
+ # bugs related to comparing prerelease versions.
7
+ #
8
+ # E.g. https://github.com/CocoaPods/CocoaPods/issues/398
9
+ unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(Gem::VERSION))
10
+ require 'colored'
11
+ STDERR.puts "Your RubyGems version (#{Gem::VERSION}) is too old, please update with: `gem update --system`".red
12
+ exit 1
13
+ end
14
+
1
15
  module Pod
2
- VERSION = '0.8.0'
16
+ VERSION = '0.9.0'
3
17
 
4
18
  class PlainInformative < StandardError
5
19
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rbconfig'
4
4
  require 'cgi'
5
- require 'rubygems'
6
5
 
7
6
  module Pod
8
7
  class Command
@@ -301,7 +301,7 @@ module Pod
301
301
 
302
302
  # attributes with multiplatform values
303
303
  return messages unless platform_valid?
304
- messages << "Missing source_files" if spec.source_files.empty? && spec.subspecs.empty? && spec.resources.empty?
304
+ messages << "The spec appears to be empty (no source files, resources, or preserve paths)" if spec.source_files.empty? && spec.subspecs.empty? && spec.resources.empty? && spec.preserve_paths.empty?
305
305
  messages += paths_starting_with_a_slash_errors
306
306
  messages
307
307
  end
@@ -352,7 +352,7 @@ module Pod
352
352
  messages << "Git sources should specify either a tag or a commit" if source[:git] && !source[:commit] && !source[:tag]
353
353
  messages << "Github repositories should end in `.git'" if github_source? && source[:git] !~ /.*\.git/
354
354
  messages << "Github repositories should use `https' link" if github_source? && source[:git] !~ /https:\/\/github.com/
355
- messages << "Comments must be deleted" if text =~ /^\w*#\n\w*#/ # allow a single line comment as it is generally used in subspecs
355
+ messages << "Comments must be deleted" if text.scan(/^\s*#/).length > 24
356
356
  messages
357
357
  end
358
358
 
@@ -1,12 +1,10 @@
1
- module Gem
2
- end
3
- require 'rubygems/dependency'
4
1
  require 'open-uri'
5
2
 
6
3
  module Pod
7
4
  class Dependency < Gem::Dependency
8
5
 
9
- attr_reader :external_source
6
+ attr_reader :external_source, :head
7
+ alias :head? :head
10
8
  attr_accessor :specification
11
9
 
12
10
  def initialize(*name_and_version_requirements, &block)
@@ -18,15 +16,28 @@ module Pod
18
16
  elsif !name_and_version_requirements.empty? && block.nil?
19
17
  if name_and_version_requirements.last.is_a?(Hash)
20
18
  @external_source = ExternalSources.from_params(name_and_version_requirements[0].split('/').first, name_and_version_requirements.pop)
19
+
20
+ elsif (symbol = name_and_version_requirements.last).is_a?(Symbol) && symbol == :head
21
+ name_and_version_requirements.pop
22
+ @head = true
21
23
  end
22
24
  super(*name_and_version_requirements)
23
25
 
26
+ if head? && !latest_version?
27
+ raise Informative, "A `:head' dependency may not specify version requirements."
28
+ end
29
+
24
30
  else
25
31
  raise Informative, "A dependency needs either a name and version requirements, " \
26
32
  "a source hash, or a block which defines a podspec."
27
33
  end
28
34
  end
29
35
 
36
+ def latest_version?
37
+ versions = @version_requirements.requirements.map(&:last)
38
+ versions == [Gem::Version.new('0')]
39
+ end
40
+
30
41
  def ==(other)
31
42
  super && (@specification ? @specification == other.specification : @external_source == other.external_source)
32
43
  end
@@ -68,7 +79,10 @@ module Pod
68
79
  elsif @version_requirements != Gem::Requirement.default
69
80
  version << @version_requirements.to_s
70
81
  end
71
- version.empty? ? @name : "#{@name} (#{version})"
82
+ result = @name.dup
83
+ result += " (#{version})" unless version.empty?
84
+ result += " [HEAD]" if head?
85
+ result
72
86
  end
73
87
 
74
88
  def specification_from_sandbox(sandbox, platform)
@@ -23,7 +23,7 @@ module Pod
23
23
  else
24
24
  download_head
25
25
  end
26
- removed_cached_repos_if_needed
26
+ prune_cache
27
27
  end
28
28
 
29
29
  def create_cache
@@ -33,7 +33,7 @@ module Pod
33
33
  clone(url, cache_path)
34
34
  end
35
35
 
36
- def removed_cached_repos_if_needed
36
+ def prune_cache
37
37
  return unless caches_dir.exist?
38
38
  Dir.chdir(caches_dir) do
39
39
  repos = Pathname.new(caches_dir).children.select { |c| c.directory? }.sort_by(&:ctime)
@@ -134,7 +134,7 @@ module Pod
134
134
  end
135
135
 
136
136
  def clone(from, to)
137
- git "clone '#{from}' '#{to}'"
137
+ git "clone \"#{from}\" \"#{to}\""
138
138
  end
139
139
  end
140
140
 
@@ -12,11 +12,11 @@ module Pod
12
12
  end
13
13
 
14
14
  def download_head
15
- hg "clone '#{url}' '#{target_path}'"
15
+ hg "clone \"#{url}\" \"#{target_path}\""
16
16
  end
17
17
 
18
18
  def download_revision
19
- hg "clone '#{url}' --rev '#{options[:revision]}' '#{target_path}'"
19
+ hg "clone \"#{url}\" --rev '#{options[:revision]}' \"#{target_path}\""
20
20
  end
21
21
  end
22
22
  end
@@ -12,11 +12,11 @@ module Pod
12
12
  end
13
13
 
14
14
  def download_head
15
- svn "checkout '#{url}' '#{target_path}'"
15
+ svn "checkout \"#{url}\" \"#{target_path}\""
16
16
  end
17
17
 
18
18
  def download_revision
19
- svn "checkout '#{url}' -r '#{options[:revision]}' '#{target_path}'"
19
+ svn "checkout \"#{url}\" -r '#{options[:revision]}' \"#{target_path}\""
20
20
  end
21
21
  end
22
22
  end
@@ -48,13 +48,17 @@ module Pod
48
48
  pods.each do |pod|
49
49
  unless config.silent?
50
50
  marker = config.verbose ? "\n-> ".green : ''
51
- name = pod.top_specification.preferred_dependency ? "#{pod.top_specification.name}/#{pod.top_specification.preferred_dependency} (#{pod.top_specification.version})" : pod.to_s
51
+ if subspec_name = pod.top_specification.preferred_dependency
52
+ name = "#{pod.top_specification.name}/#{subspec_name} (#{pod.top_specification.version})"
53
+ else
54
+ name = pod.to_s
55
+ end
56
+ name << " [HEAD]" if pod.top_specification.version.head?
52
57
  puts marker << ( pod.exists? ? "Using #{name}" : "Installing #{name}".green )
53
58
  end
54
59
 
55
60
  unless pod.exists?
56
- downloader = Downloader.for_pod(pod)
57
- downloader.download
61
+ download_pod(pod)
58
62
  # The docs need to be generated before cleaning because
59
63
  # the documentation is created for all the subspecs.
60
64
  generate_docs(pod)
@@ -63,6 +67,19 @@ module Pod
63
67
  end
64
68
  end
65
69
 
70
+ def download_pod(pod)
71
+ downloader = Downloader.for_pod(pod)
72
+ # Force the `bleeding edge' version if necessary.
73
+ if pod.top_specification.version.head?
74
+ if downloader.respond_to?(:download_head)
75
+ downloader.download_head
76
+ else
77
+ end
78
+ else
79
+ downloader.download
80
+ end
81
+ end
82
+
66
83
  #TODO: move to generator ?
67
84
  def generate_docs(pod)
68
85
  doc_generator = Generator::Documentation.new(pod)
@@ -295,16 +295,22 @@ module Pod
295
295
  # * `<= 0.1` Version 0.1 and any lower version
296
296
  # * `~> 0.1.2` Version 0.1.2 and the versions upto 0.2, not including 0.2
297
297
  #
298
- #
299
- # Finally, a list of version requirements can be specified for even more fine
298
+ # A list of version requirements can be specified for even more fine
300
299
  # grained control.
301
300
  #
301
+ #
302
302
  # For more information, regarding versioning policy, see:
303
303
  #
304
304
  # * http://semver.org
305
305
  # * http://docs.rubygems.org/read/chapter/7
306
306
  #
307
307
  #
308
+ # Finally, instead of a version, you can specify the `:head` flag. This will
309
+ # use the pod’s latest version spec version, but force the download of the
310
+ # ‘bleeding edge’ version. Use this with caution, as the spec might not be
311
+ # compatible anymore.
312
+ #
313
+ #
308
314
  # ## Dependency on a library, outside those available in a spec repo.
309
315
  #
310
316
  # ### From a podspec in the root of a library repo.
@@ -343,7 +349,7 @@ module Pod
343
349
  #
344
350
  # ### For a library without any available podspec
345
351
  #
346
- # Finally, if no man alive has created a podspec, for the library you want
352
+ # Finally, if no living soul has created a podspec, for the library you want
347
353
  # to use, yet, you will have to specify the library yourself.
348
354
  #
349
355
  #
@@ -61,10 +61,12 @@ module Pod
61
61
  set.required_by(dependent_specification)
62
62
  # Ensure we don't resolve the same spec twice for one target
63
63
  unless @loaded_specs.include?(dependency.name)
64
- spec = set.specification_by_name(dependency.name)
64
+ spec = set.specification_by_name(dependency.name)
65
65
  @loaded_specs << spec.name
66
66
  @specs[spec.name] = spec
67
+ # Configure the specification
67
68
  spec.activate_platform(target_definition.platform)
69
+ spec.version.head = dependency.head?
68
70
  # And recursively load the dependencies of the spec.
69
71
  find_dependency_specs(spec, spec.dependencies, target_definition) if spec.dependencies
70
72
  end
@@ -44,6 +44,7 @@ module Pod
44
44
  preserve_paths
45
45
  exclude_header_search_paths
46
46
  frameworks
47
+ weak_frameworks
47
48
  libraries
48
49
  dependencies
49
50
  compiler_flags ].each do |attr|
@@ -127,6 +128,8 @@ module Pod
127
128
  xcconfig=
128
129
  framework=
129
130
  frameworks=
131
+ weak_framework=
132
+ weak_frameworks=
130
133
  library=
131
134
  libraries=
132
135
  compiler_flags=
@@ -240,12 +243,14 @@ module Pod
240
243
  pltf_chained_attr_accessor :preserve_paths, lambda {|value, current| pattern_list(value) } # Paths that should not be cleaned
241
244
  pltf_chained_attr_accessor :exclude_header_search_paths, lambda {|value, current| pattern_list(value) } # Headers to be excluded from being added to search paths (RestKit)
242
245
  pltf_chained_attr_accessor :frameworks, lambda {|value, current| (current << value).flatten }
246
+ pltf_chained_attr_accessor :weak_frameworks, lambda {|value, current| (current << value).flatten }
243
247
  pltf_chained_attr_accessor :libraries, lambda {|value, current| (current << value).flatten }
244
248
 
245
- alias_method :resource=, :resources=
246
- alias_method :preserve_path=, :preserve_paths=
247
- alias_method :framework=, :frameworks=
248
- alias_method :library=, :libraries=
249
+ alias_method :resource=, :resources=
250
+ alias_method :preserve_path=, :preserve_paths=
251
+ alias_method :framework=, :frameworks=
252
+ alias_method :weak_framework=, :weak_frameworks=
253
+ alias_method :library=, :libraries=
249
254
 
250
255
  # @!method header_dir=
251
256
  #
@@ -271,9 +276,11 @@ module Pod
271
276
  platform_attr_writer :xcconfig, lambda {|value, current| current.tap { |c| c.merge!(value) } }
272
277
 
273
278
  def xcconfig
274
- raw_xconfig.dup.
275
- tap { |x| x.libraries.merge libraries }.
276
- tap { |x| x.frameworks.merge frameworks }
279
+ result = raw_xconfig.dup
280
+ result.libraries.merge(libraries)
281
+ result.frameworks.merge(frameworks)
282
+ result.weak_frameworks.merge(weak_frameworks)
283
+ result
277
284
  end
278
285
 
279
286
  def raw_xconfig
@@ -343,15 +350,14 @@ module Pod
343
350
  attr_reader :subspecs
344
351
 
345
352
  def recursive_subspecs
346
- unless @recursive_subspecs
353
+ @recursive_subspecs ||= begin
347
354
  mapper = lambda do |spec|
348
- spec.subspecs.map do |subspec|
349
- [subspec, *mapper.call(subspec)]
350
- end.flatten
351
- end
352
- @recursive_subspecs = mapper.call self
355
+ spec.subspecs.map do |subspec|
356
+ [subspec, *mapper.call(subspec)]
357
+ end.flatten
358
+ end
359
+ mapper.call(self)
353
360
  end
354
- @recursive_subspecs
355
361
  end
356
362
 
357
363
  def subspec_by_name(name)
@@ -1,9 +1,9 @@
1
- module Gem
2
- end
3
- require 'rubygems/version'
1
+
4
2
 
5
3
  module Pod
6
4
  class Version < Gem::Version
5
+ attr_accessor :head
6
+ alias_method :head?, :head
7
7
  end
8
8
  end
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-09 00:00:00.000000000 Z
12
+ date: 2012-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday