cocoapods 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,16 +53,6 @@ module Pod
53
53
  end
54
54
  attr_writer :podfile
55
55
 
56
- def ios?
57
- # TODO: deprecate in 0.7
58
- podfile.target_definitions[:default].platform == :ios if podfile
59
- end
60
-
61
- def osx?
62
- # TODO: deprecate in 0.7
63
- podfile.target_definitions[:default].platform == :osx if podfile
64
- end
65
-
66
56
  module Mixin
67
57
  def config
68
58
  Config.instance
@@ -14,13 +14,14 @@ module Pod
14
14
  super(@specification.name, @specification.version)
15
15
 
16
16
  elsif !name_and_version_requirements.empty? && block.nil?
17
+ version = name_and_version_requirements.last
17
18
  if name_and_version_requirements.last.is_a?(Hash)
18
19
  @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
20
+ elsif version.is_a?(Symbol) && version == :head || version.is_a?(Version) && version.head?
21
21
  name_and_version_requirements.pop
22
22
  @head = true
23
23
  end
24
+
24
25
  super(*name_and_version_requirements)
25
26
 
26
27
  if head? && !latest_version?
@@ -6,17 +6,23 @@ module Pod
6
6
  def download
7
7
  if options[:revision]
8
8
  download_revision
9
+ elsif options[:tag]
10
+ download_tag
9
11
  else
10
12
  download_head
11
13
  end
12
14
  end
13
15
 
14
16
  def download_head
15
- svn "checkout \"#{url}\" \"#{target_path}\""
17
+ svn %|checkout "#{url}/#{options[:folder]}" "#{target_path}"|
16
18
  end
17
19
 
18
20
  def download_revision
19
- svn "checkout \"#{url}\" -r '#{options[:revision]}' \"#{target_path}\""
21
+ svn %|checkout "#{url}/#{options[:folder]}" -r "#{options[:revision]}" "#{target_path}"|
22
+ end
23
+
24
+ def download_tag
25
+ svn %|checkout "#{url}/tags/#{options[:tag]}/#{options[:folder]}" "#{target_path}"|
20
26
  end
21
27
  end
22
28
  end
@@ -5,7 +5,7 @@ else
5
5
  end
6
6
 
7
7
  # This makes Rake::FileList usable with the Specification attributes
8
- # source_files, clean_paths, and resources.
8
+ # source_files, public_header_files, preserve_paths, and resources.
9
9
 
10
10
  module Rake
11
11
  class FileList
@@ -13,9 +13,10 @@ module Pod
13
13
  def xcconfig
14
14
  @xcconfig ||= Xcodeproj::Config.new({
15
15
  # In a workspace this is where the static library headers should be found.
16
- 'PODS_ROOT' => @target_definition.relative_pods_root,
17
- 'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
18
- 'OTHER_LDFLAGS' => default_ld_flags,
16
+ 'PODS_ROOT' => @target_definition.relative_pods_root,
17
+ 'PODS_HEADERS_SEARCH_PATHS' => '${PODS_PUBLIC_HEADERS_SEARCH_PATHS}',
18
+ 'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
19
+ 'OTHER_LDFLAGS' => default_ld_flags,
19
20
  })
20
21
  end
21
22
 
@@ -72,22 +73,25 @@ module Pod
72
73
  end
73
74
  @target.add_source_files(source_file_descriptions)
74
75
 
75
- xcconfig.merge!('HEADER_SEARCH_PATHS' => quoted(sandbox.header_search_paths).join(" "))
76
+ xcconfig.merge!('HEADER_SEARCH_PATHS' => '${PODS_HEADERS_SEARCH_PATHS}')
77
+ xcconfig.merge!('PODS_BUILD_HEADERS_SEARCH_PATHS' => quoted(sandbox.build_headers.search_paths).join(" "))
78
+ xcconfig.merge!('PODS_PUBLIC_HEADERS_SEARCH_PATHS' => quoted(sandbox.public_headers.search_paths).join(" "))
76
79
 
77
80
  support_files_group = @project.group("Targets Support Files").create_group(@target_definition.label)
78
81
  support_files_group.create_files(target_support_files)
79
82
 
80
83
  xcconfig_file = support_files_group.files.where(:path => @target_definition.xcconfig_name)
81
- configure_build_configurations(xcconfig_file)
84
+ configure_build_configurations(xcconfig_file, sandbox)
82
85
  create_files(pods, sandbox)
83
86
  end
84
87
 
85
- def configure_build_configurations(xcconfig_file)
88
+ def configure_build_configurations(xcconfig_file, sandbox)
86
89
  @target.build_configurations.each do |config|
87
90
  config.base_configuration = xcconfig_file
88
91
  config.build_settings['OTHER_LDFLAGS'] = ''
89
92
  config.build_settings['GCC_PREFIX_HEADER'] = @target_definition.prefix_header_name
90
93
  config.build_settings['PODS_ROOT'] = '${SRCROOT}'
94
+ config.build_settings['PODS_HEADERS_SEARCH_PATHS'] = '${PODS_BUILD_HEADERS_SEARCH_PATHS}'
91
95
  end
92
96
  end
93
97
 
@@ -141,7 +141,10 @@ module Pod
141
141
  end
142
142
 
143
143
  def add_pods_library
144
- pods_library = user_project.group("Frameworks").files.new_static_library(@target_definition.label)
144
+ framework_group = user_project.group("Frameworks")
145
+ raise Informative, "Cannot add pod library to project. Please check if the project have a 'Frameworks' group in the root of the project." unless framework_group
146
+
147
+ pods_library = framework_group.files.new_static_library(@target_definition.label)
145
148
  targets.each do |target|
146
149
  target.frameworks_build_phases.each { |build_phase| build_phase << pods_library }
147
150
  end
@@ -229,6 +229,24 @@ module Pod
229
229
  result
230
230
  end
231
231
 
232
+ # @return [Hash{Specification => Array<Pathname>}] The paths of the public
233
+ # header files grouped by {Specification}.
234
+ #
235
+ # @TODO: complete, fix and comment
236
+ # @TODO: decide a policy for subspecs
237
+ #
238
+ def public_header_files_by_specs
239
+ cached_header_files_by_spec = header_files_by_spec
240
+ public_header_files = paths_by_spec(:source_files, :glob => '*.h')
241
+
242
+ result = {}
243
+ public_header_files.map do |spec, paths|
244
+ result[spec] = paths.empty? ? cached_header_files_by_spec[spec] : paths
245
+ end
246
+
247
+ result
248
+ end
249
+
232
250
  # @return [Array<Pathname>] The paths of the resources.
233
251
  #
234
252
  def resource_files
@@ -322,9 +340,14 @@ module Pod
322
340
  # @return [void] Copies the pods headers to the sandbox.
323
341
  #
324
342
  def link_headers
325
- @sandbox.add_header_search_path(headers_sandbox)
343
+ @sandbox.build_headers.add_search_path(headers_sandbox)
326
344
  header_mappings.each do |namespaced_path, files|
327
- @sandbox.add_header_files(namespaced_path, files)
345
+ @sandbox.build_headers.add_files(namespaced_path, files)
346
+ end
347
+
348
+ @sandbox.public_headers.add_search_path(headers_sandbox)
349
+ public_header_mappings.each do |namespaced_path, files|
350
+ @sandbox.public_headers.add_files(namespaced_path, files)
328
351
  end
329
352
  end
330
353
 
@@ -389,6 +412,23 @@ module Pod
389
412
  mappings
390
413
  end
391
414
 
415
+ # TODO: complete, fix and comment
416
+ def public_header_mappings
417
+ mappings = {}
418
+ public_header_files_by_specs.each do |spec, paths|
419
+ paths = paths - headers_excluded_from_search_paths
420
+ paths.each do |from|
421
+ from_relative = from.relative_path_from(root)
422
+ to = headers_sandbox + (spec.header_dir) + spec.copy_header_mapping(from_relative)
423
+ (mappings[to.dirname] ||= []) << from
424
+ end
425
+ end
426
+ mappings
427
+ end
428
+
429
+ # @return <Pathname> The name of the folder where the headers of this pod
430
+ # will be namespaced.
431
+ #
392
432
  def headers_sandbox
393
433
  @headers_sandbox ||= Pathname.new(top_specification.name)
394
434
  end
@@ -3,14 +3,17 @@ require 'fileutils'
3
3
  module Pod
4
4
  class Sandbox
5
5
  attr_reader :root
6
+ attr_reader :build_headers
7
+ attr_reader :public_headers
6
8
 
7
- HEADERS_DIR = "Headers"
9
+ BUILD_HEADERS_DIR = "BuildHeaders"
10
+ PUBLIC_HEADERS_DIR = "Headers"
8
11
 
9
12
  def initialize(path)
10
13
  @root = Pathname.new(path)
11
- @header_search_paths = [HEADERS_DIR]
14
+ @build_headers = HeadersDirectory.new(self, BUILD_HEADERS_DIR)
15
+ @public_headers = HeadersDirectory.new(self, PUBLIC_HEADERS_DIR)
12
16
  @cached_local_pods = {}
13
-
14
17
  FileUtils.mkdir_p(@root)
15
18
  end
16
19
 
@@ -18,43 +21,13 @@ module Pod
18
21
  root.rmtree
19
22
  end
20
23
 
21
- def headers_root
22
- root + HEADERS_DIR
23
- end
24
-
25
24
  def project_path
26
25
  root + "Pods.xcodeproj"
27
26
  end
28
27
 
29
- def add_header_file(namespace_path, relative_header_path)
30
- namespaced_header_path = headers_root + namespace_path
31
- namespaced_header_path.mkpath unless File.exist?(namespaced_header_path)
32
- source = (root + relative_header_path).relative_path_from(namespaced_header_path)
33
- Dir.chdir(namespaced_header_path) { FileUtils.ln_sf(source, relative_header_path.basename)}
34
- @header_search_paths << namespaced_header_path.relative_path_from(root)
35
- namespaced_header_path + relative_header_path.basename
36
- end
37
-
38
- def add_header_files(namespace_path, relative_header_paths)
39
- relative_header_paths.map { |path| add_header_file(namespace_path, path) }
40
- end
41
-
42
- def header_search_paths
43
- @header_search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" }
44
- end
45
-
46
- # Adds an header search path to the sandbox.
47
- #
48
- # @param path [Pathname] The path tho add.
49
- #
50
- # @return [void]
51
- #
52
- def add_header_search_path(path)
53
- @header_search_paths << Pathname.new(HEADERS_DIR) + path
54
- end
55
-
56
28
  def prepare_for_install
57
- headers_root.rmtree if headers_root.exist?
29
+ build_headers.prepare_for_install
30
+ public_headers.prepare_for_install
58
31
  end
59
32
 
60
33
  def local_pod_for_spec(spec, platform)
@@ -79,4 +52,47 @@ module Pod
79
52
  end
80
53
  end
81
54
  end
55
+
56
+ class HeadersDirectory
57
+ def initialize(sandbox, base_dir)
58
+ @sandbox = sandbox
59
+ @base_dir = base_dir
60
+ @search_paths = [base_dir]
61
+ end
62
+
63
+ def root
64
+ @sandbox.root + @base_dir
65
+ end
66
+
67
+ def add_file(namespace_path, relative_header_path)
68
+ namespaced_header_path = root + namespace_path
69
+ namespaced_header_path.mkpath unless File.exist?(namespaced_header_path)
70
+ source = (@sandbox.root + relative_header_path).relative_path_from(namespaced_header_path)
71
+ Dir.chdir(namespaced_header_path) { FileUtils.ln_sf(source, relative_header_path.basename)}
72
+ @search_paths << namespaced_header_path.relative_path_from(@sandbox.root)
73
+ namespaced_header_path + relative_header_path.basename
74
+ end
75
+
76
+ def add_files(namespace_path, relative_header_paths)
77
+ relative_header_paths.map { |path| add_file(namespace_path, path) }
78
+ end
79
+
80
+ def search_paths
81
+ @search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" }
82
+ end
83
+
84
+ # Adds an header search path to the sandbox.
85
+ #
86
+ # @param path [Pathname] The path tho add.
87
+ #
88
+ # @return [void]
89
+ #
90
+ def add_search_path(path)
91
+ @search_paths << Pathname.new(@base_dir) + path
92
+ end
93
+
94
+ def prepare_for_install
95
+ root.rmtree if root.exist?
96
+ end
97
+ end
82
98
  end
@@ -40,6 +40,7 @@ module Pod
40
40
 
41
41
  # multi-platform attributes
42
42
  %w[ source_files
43
+ public_header_files
43
44
  resources
44
45
  preserve_paths
45
46
  exclude_header_search_paths
@@ -121,6 +122,7 @@ module Pod
121
122
  end
122
123
 
123
124
  %w{ source_files=
125
+ public_header_files=
124
126
  resource=
125
127
  resources=
126
128
  preserve_paths=
@@ -239,6 +241,7 @@ module Pod
239
241
 
240
242
 
241
243
  pltf_chained_attr_accessor :source_files, lambda {|value, current| pattern_list(value) }
244
+ pltf_chained_attr_accessor :public_header_files, lambda {|value, current| pattern_list(value) }
242
245
  pltf_chained_attr_accessor :resources, lambda {|value, current| pattern_list(value) }
243
246
  pltf_chained_attr_accessor :preserve_paths, lambda {|value, current| pattern_list(value) } # Paths that should not be cleaned
244
247
  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)
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.10.0
4
+ version: 0.11.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-29 00:00:00.000000000 Z
12
+ date: 2012-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -189,6 +189,7 @@ extra_rdoc_files: []
189
189
  files:
190
190
  - lib/cocoapods/command/error_report.rb
191
191
  - lib/cocoapods/command/install.rb
192
+ - lib/cocoapods/command/linter.rb
192
193
  - lib/cocoapods/command/list.rb
193
194
  - lib/cocoapods/command/presenter/cocoa_pod.rb
194
195
  - lib/cocoapods/command/presenter.rb
@@ -246,6 +247,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
246
247
  - - ! '>='
247
248
  - !ruby/object:Gem::Version
248
249
  version: '0'
250
+ segments:
251
+ - 0
252
+ hash: 3007268623485849260
249
253
  required_rubygems_version: !ruby/object:Gem::Requirement
250
254
  none: false
251
255
  requirements:
@@ -254,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
258
  version: '0'
255
259
  requirements: []
256
260
  rubyforge_project:
257
- rubygems_version: 1.8.23
261
+ rubygems_version: 1.8.24
258
262
  signing_key:
259
263
  specification_version: 3
260
264
  summary: An Objective-C library package manager.