cocoapods 0.3.1 → 0.3.2

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.
@@ -1,5 +1,5 @@
1
1
  module Pod
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
 
4
4
  class Informative < StandardError
5
5
  end
@@ -19,6 +19,7 @@ module Pod
19
19
  autoload :Version, 'cocoapods/version'
20
20
 
21
21
  autoload :Pathname, 'pathname'
22
+ autoload :FileList, 'cocoapods/file_list'
22
23
  end
23
24
 
24
25
  module Xcodeproj
@@ -54,11 +54,8 @@ module Pod
54
54
 
55
55
  def clean(clean_paths = [])
56
56
  (@pod_root + '.git').rmtree
57
- clean_paths.each do |pattern|
58
- pattern = @pod_root + pattern
59
- pattern.glob.each do |path|
60
- path.rmtree
61
- end
57
+ clean_paths.each do |path|
58
+ path.rmtree
62
59
  end if clean_paths
63
60
  end
64
61
  end
@@ -0,0 +1,34 @@
1
+ require 'rake'
2
+
3
+ # This makes Rake::FileList usable with the Specification attributes
4
+ # source_files, clean_paths, and resources.
5
+
6
+ module Rake
7
+ class FileList
8
+ def prepend_patterns(pathname)
9
+ @pending_add.map! { |pattern| (pathname + pattern).to_s }
10
+ end
11
+
12
+ def directory?
13
+ false
14
+ end
15
+
16
+ def glob
17
+ to_a.map { |path| Pathname.new(path) }
18
+ end
19
+ end
20
+ end
21
+
22
+ class Pathname
23
+ alias_method :_original_sum, :+
24
+ def +(other)
25
+ if other.is_a?(Rake::FileList)
26
+ other.prepend_patterns(self)
27
+ other
28
+ else
29
+ _original_sum(other)
30
+ end
31
+ end
32
+ end
33
+
34
+
@@ -21,7 +21,7 @@ module Pod
21
21
  attr_accessor :defined_in_file
22
22
 
23
23
  def initialize
24
- @dependencies = []
24
+ @dependencies, @resources, @clean_paths = [], [], []
25
25
  @xcconfig = Xcodeproj::Config.new
26
26
  yield self if block_given?
27
27
  end
@@ -67,21 +67,22 @@ module Pod
67
67
  @part_of = dependency(*name_and_version_requirements)
68
68
  end
69
69
 
70
- def source_files=(*patterns)
71
- @source_files = patterns.flatten
70
+ def source_files=(patterns)
71
+ @source_files = pattern_list(patterns)
72
72
  end
73
73
  attr_reader :source_files
74
74
 
75
- def resources=(*patterns)
76
- @resources = patterns.flatten
75
+ def resources=(patterns)
76
+ @resources = pattern_list(patterns)
77
77
  end
78
78
  attr_reader :resources
79
79
  alias_method :resource=, :resources=
80
80
 
81
- def clean_paths=(*patterns)
82
- @clean_paths = patterns.flatten.map { |p| Pathname.new(p) }
81
+ def clean_paths=(patterns)
82
+ @clean_paths = pattern_list(patterns)
83
83
  end
84
84
  attr_reader :clean_paths
85
+ alias_method :clean_path=, :clean_paths=
85
86
 
86
87
  def xcconfig=(hash)
87
88
  @xcconfig.merge!(hash)
@@ -178,13 +179,20 @@ module Pod
178
179
  false
179
180
  end
180
181
 
182
+ def pattern_list(patterns)
183
+ if patterns.is_a?(Array) && (!defined?(Rake) || !patterns.is_a?(Rake::FileList))
184
+ patterns
185
+ else
186
+ [patterns]
187
+ end
188
+ end
189
+
181
190
  # Returns all resource files of this pod, but relative to the
182
191
  # project pods root.
183
192
  def expanded_resources
184
193
  files = []
185
- [*resources].each do |pattern|
194
+ resources.each do |pattern|
186
195
  pattern = pod_destroot + pattern
187
- pattern = pattern + '*' if pattern.directory?
188
196
  pattern.glob.each do |file|
189
197
  files << file.relative_path_from(config.project_pods_root)
190
198
  end
@@ -192,11 +200,27 @@ module Pod
192
200
  files
193
201
  end
194
202
 
203
+ # Returns full paths to clean for this pod.
204
+ def expanded_clean_paths
205
+ files = []
206
+ clean_paths.each do |pattern|
207
+ pattern = pod_destroot + pattern
208
+ pattern.glob.each do |file|
209
+ files << file
210
+ end
211
+ end
212
+ files
213
+ end
214
+
195
215
  # Returns all source files of this pod including header files,
196
216
  # but relative to the project pods root.
217
+ #
218
+ # If the pattern is the path to a directory, the pattern will
219
+ # automatically glob for c, c++, Objective-C, and Objective-C++
220
+ # files.
197
221
  def expanded_source_files
198
222
  files = []
199
- [*source_files].each do |pattern|
223
+ source_files.each do |pattern|
200
224
  pattern = pod_destroot + pattern
201
225
  pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
202
226
  pattern.glob.each do |file|
@@ -320,7 +344,7 @@ module Pod
320
344
  def download!
321
345
  downloader = Downloader.for_source(pod_destroot, source)
322
346
  downloader.download
323
- downloader.clean(clean_paths) if config.clean
347
+ downloader.clean(expanded_clean_paths) if config.clean
324
348
  end
325
349
 
326
350
  # This is a convenience method which gets called after all pods have been
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Eloy Duran
@@ -56,6 +56,7 @@ files:
56
56
  - lib/cocoapods/dependency.rb
57
57
  - lib/cocoapods/downloader.rb
58
58
  - lib/cocoapods/executable.rb
59
+ - lib/cocoapods/file_list.rb
59
60
  - lib/cocoapods/installer.rb
60
61
  - lib/cocoapods/podfile.rb
61
62
  - lib/cocoapods/resolver.rb