cocoapods 0.33.1 → 0.34.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +171 -46
  3. data/README.md +9 -9
  4. data/bin/pod +5 -5
  5. data/bin/sandbox-pod +2 -6
  6. data/lib/cocoapods.rb +4 -4
  7. data/lib/cocoapods/command.rb +12 -10
  8. data/lib/cocoapods/command/init.rb +12 -13
  9. data/lib/cocoapods/command/inter_process_communication.rb +6 -17
  10. data/lib/cocoapods/command/lib.rb +27 -24
  11. data/lib/cocoapods/command/list.rb +9 -9
  12. data/lib/cocoapods/command/outdated.rb +4 -9
  13. data/lib/cocoapods/command/project.rb +57 -19
  14. data/lib/cocoapods/command/push.rb +0 -1
  15. data/lib/cocoapods/command/repo.rb +14 -15
  16. data/lib/cocoapods/command/repo/push.rb +24 -19
  17. data/lib/cocoapods/command/search.rb +12 -13
  18. data/lib/cocoapods/command/setup.rb +10 -9
  19. data/lib/cocoapods/command/spec.rb +67 -63
  20. data/lib/cocoapods/config.rb +21 -54
  21. data/lib/cocoapods/downloader.rb +0 -1
  22. data/lib/cocoapods/executable.rb +3 -8
  23. data/lib/cocoapods/external_sources.rb +2 -4
  24. data/lib/cocoapods/external_sources/abstract_external_source.rb +15 -10
  25. data/lib/cocoapods/external_sources/downloader_source.rb +0 -2
  26. data/lib/cocoapods/external_sources/path_source.rb +1 -4
  27. data/lib/cocoapods/external_sources/podspec_source.rb +1 -3
  28. data/lib/cocoapods/gem_version.rb +1 -2
  29. data/lib/cocoapods/generator/acknowledgements.rb +5 -8
  30. data/lib/cocoapods/generator/acknowledgements/markdown.rb +5 -7
  31. data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -10
  32. data/lib/cocoapods/generator/bridge_support.rb +1 -1
  33. data/lib/cocoapods/generator/copy_resources_script.rb +10 -14
  34. data/lib/cocoapods/generator/dummy_source.rb +3 -3
  35. data/lib/cocoapods/generator/prefix_header.rb +15 -16
  36. data/lib/cocoapods/generator/target_environment_header.rb +122 -36
  37. data/lib/cocoapods/generator/xcconfig.rb +0 -4
  38. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +74 -65
  39. data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +92 -95
  40. data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +48 -51
  41. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +10 -10
  42. data/lib/cocoapods/hooks/installer_representation.rb +15 -18
  43. data/lib/cocoapods/hooks/library_representation.rb +4 -8
  44. data/lib/cocoapods/hooks/pod_representation.rb +1 -5
  45. data/lib/cocoapods/hooks_manager.rb +63 -0
  46. data/lib/cocoapods/installer.rb +60 -47
  47. data/lib/cocoapods/installer/analyzer.rb +60 -62
  48. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +5 -8
  49. data/lib/cocoapods/installer/file_references_installer.rb +7 -10
  50. data/lib/cocoapods/installer/hooks_context.rb +74 -0
  51. data/lib/cocoapods/installer/migrator.rb +99 -0
  52. data/lib/cocoapods/installer/pod_source_installer.rb +9 -29
  53. data/lib/cocoapods/installer/target_installer.rb +7 -17
  54. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +40 -41
  55. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +43 -54
  56. data/lib/cocoapods/installer/user_project_integrator.rb +54 -10
  57. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +66 -117
  58. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +116 -0
  59. data/lib/cocoapods/open_uri.rb +1 -2
  60. data/lib/cocoapods/project.rb +34 -8
  61. data/lib/cocoapods/resolver.rb +43 -21
  62. data/lib/cocoapods/sandbox.rb +80 -75
  63. data/lib/cocoapods/sandbox/file_accessor.rb +3 -8
  64. data/lib/cocoapods/sandbox/headers_store.rb +6 -7
  65. data/lib/cocoapods/sandbox/path_list.rb +7 -10
  66. data/lib/cocoapods/sources_manager.rb +81 -49
  67. data/lib/cocoapods/target.rb +18 -12
  68. data/lib/cocoapods/target/aggregate_target.rb +43 -18
  69. data/lib/cocoapods/target/pod_target.rb +37 -4
  70. data/lib/cocoapods/user_interface.rb +19 -18
  71. data/lib/cocoapods/user_interface/error_report.rb +23 -4
  72. data/lib/cocoapods/validator.rb +30 -33
  73. metadata +100 -73
  74. data/lib/cocoapods/command/help.rb +0 -25
@@ -1,7 +1,6 @@
1
1
  module Pod
2
2
  class Installer
3
3
  class Analyzer
4
-
5
4
  # Analyze the sandbox to detect which Pods should be removed, and which
6
5
  # ones should be reinstalled.
7
6
  #
@@ -28,7 +27,6 @@ module Pod
28
27
  # - If none of the above conditions match.
29
28
  #
30
29
  class SandboxAnalyzer
31
-
32
30
  # @return [Sandbox] The sandbox to analyze.
33
31
  #
34
32
  attr_reader :sandbox
@@ -98,7 +96,7 @@ module Pod
98
96
  return :added if pod_added?(pod)
99
97
  return :deleted if pod_deleted?(pod)
100
98
  return :changed if pod_changed?(pod)
101
- return :unchanged
99
+ :unchanged
102
100
  end
103
101
 
104
102
  # Returns whether the Pod with the given name should be installed.
@@ -112,8 +110,8 @@ module Pod
112
110
  #
113
111
  def pod_added?(pod)
114
112
  return true if resolved_pods.include?(pod) && !sandbox_pods.include?(pod)
115
- return true if !folder_exist?(pod)
116
- return false
113
+ return true unless folder_exist?(pod)
114
+ false
117
115
  end
118
116
 
119
117
  # Returns whether the Pod with the given name should be removed from
@@ -126,7 +124,7 @@ module Pod
126
124
  #
127
125
  def pod_deleted?(pod)
128
126
  return true if !resolved_pods.include?(pod) && sandbox_pods.include?(pod)
129
- return false
127
+ false
130
128
  end
131
129
 
132
130
  # Returns whether the Pod with the given name should be considered
@@ -154,7 +152,7 @@ module Pod
154
152
  if update_mode
155
153
  return true if sandbox.head_pod?(pod)
156
154
  end
157
- return false
155
+ false
158
156
  end
159
157
 
160
158
  #---------------------------------------------------------------------#
@@ -254,7 +252,6 @@ module Pod
254
252
  end
255
253
 
256
254
  #---------------------------------------------------------------------#
257
-
258
255
  end
259
256
  end
260
257
  end
@@ -1,11 +1,9 @@
1
1
  module Pod
2
2
  class Installer
3
-
4
3
  # Controller class responsible of installing the file references of the
5
4
  # specifications in the Pods project.
6
5
  #
7
6
  class FileReferencesInstaller
8
-
9
7
  # @return [Sandbox] The sandbox of the installation.
10
8
  #
11
9
  attr_reader :sandbox
@@ -68,7 +66,7 @@ module Pod
68
66
  # @return [void]
69
67
  #
70
68
  def add_source_files_references
71
- UI.message "- Adding source files to Pods project" do
69
+ UI.message '- Adding source files to Pods project' do
72
70
  add_file_accessors_paths_to_pods_group(:source_files)
73
71
  end
74
72
  end
@@ -78,7 +76,7 @@ module Pod
78
76
  # @return [void]
79
77
  #
80
78
  def add_frameworks_bundles
81
- UI.message "- Adding frameworks to Pods project" do
79
+ UI.message '- Adding frameworks to Pods project' do
82
80
  add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)
83
81
  end
84
82
  end
@@ -88,7 +86,7 @@ module Pod
88
86
  # @return [void]
89
87
  #
90
88
  def add_vendored_libraries
91
- UI.message "- Adding libraries to Pods project" do
89
+ UI.message '- Adding libraries to Pods project' do
92
90
  add_file_accessors_paths_to_pods_group(:vendored_libraries, :frameworks)
93
91
  end
94
92
  end
@@ -101,7 +99,7 @@ module Pod
101
99
  # @return [void]
102
100
  #
103
101
  def add_resources
104
- UI.message "- Adding resources to Pods project" do
102
+ UI.message '- Adding resources to Pods project' do
105
103
  add_file_accessors_paths_to_pods_group(:resources, :resources)
106
104
  add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources)
107
105
  end
@@ -112,7 +110,7 @@ module Pod
112
110
  # @return [void]
113
111
  #
114
112
  def link_headers
115
- UI.message "- Linking headers" do
113
+ UI.message '- Linking headers' do
116
114
  libraries.each do |library|
117
115
  library.file_accessors.each do |file_accessor|
118
116
  headers_sandbox = Pathname.new(file_accessor.spec.root.name)
@@ -185,7 +183,7 @@ module Pod
185
183
  def header_mappings(headers_sandbox, file_accessor, headers)
186
184
  consumer = file_accessor.spec_consumer
187
185
  dir = headers_sandbox
188
- dir = dir + consumer.header_dir if consumer.header_dir
186
+ dir += consumer.header_dir if consumer.header_dir
189
187
 
190
188
  mappings = {}
191
189
  headers.each do |header|
@@ -193,7 +191,7 @@ module Pod
193
191
  if consumer.header_mappings_dir
194
192
  header_mappings_dir = file_accessor.path_list.root + consumer.header_mappings_dir
195
193
  relative_path = header.relative_path_from(header_mappings_dir)
196
- sub_dir = sub_dir + relative_path.dirname
194
+ sub_dir += relative_path.dirname
197
195
  end
198
196
  mappings[sub_dir] ||= []
199
197
  mappings[sub_dir] << header
@@ -202,7 +200,6 @@ module Pod
202
200
  end
203
201
 
204
202
  #-----------------------------------------------------------------------#
205
-
206
203
  end
207
204
  end
208
205
  end
@@ -0,0 +1,74 @@
1
+ module Pod
2
+ class Installer
3
+ # Context object designed to be used with the HooksManager which describes
4
+ # the context of the installer.
5
+ #
6
+ class HooksContext
7
+ # @return [String] The path to the sandbox root (`Pods` directory).
8
+ #
9
+ attr_accessor :sandbox_root
10
+
11
+ # @return [Array<UmbrellaTargetDescription>] The list of
12
+ # the CocoaPods umbrella targets generated by the installer.
13
+ #
14
+ attr_accessor :umbrella_targets
15
+
16
+ # @return [HooksContext] Convenience class method to generate the
17
+ # static context.
18
+ #
19
+ def self.generate(sandbox, aggregate_targets)
20
+ umbrella_targets_descriptions = []
21
+ aggregate_targets.each do |umbrella|
22
+ desc = UmbrellaTargetDescription.new
23
+ desc.user_project_path = umbrella.user_project_path
24
+ desc.user_target_uuids = umbrella.user_target_uuids
25
+ desc.specs = umbrella.specs
26
+ desc.platform_name = umbrella.platform.name
27
+ desc.platform_deployment_target = umbrella.platform.deployment_target.to_s
28
+ desc.cocoapods_target_label = umbrella.label
29
+ umbrella_targets_descriptions << desc
30
+ end
31
+
32
+ result = new
33
+ result.sandbox_root = sandbox.root.to_s
34
+ result.umbrella_targets = umbrella_targets_descriptions
35
+ result
36
+ end
37
+
38
+ # Pure data class which describes and umbrella target.
39
+ #
40
+ class UmbrellaTargetDescription
41
+ # @return [String] The path of the user project
42
+ # integrated by this target.
43
+ #
44
+ attr_accessor :user_project_path
45
+
46
+ # @return [Array<String>] The list of the UUIDs of the
47
+ # user targets integrated by this umbrella
48
+ # target. They can be used to find the
49
+ # targets opening the project They can be used
50
+ # to find the targets opening the project with
51
+ # Xcodeproj.
52
+ #
53
+ attr_accessor :user_target_uuids
54
+
55
+ # @return [Array<Specification>] The list of the
56
+ # specifications of the target.
57
+ #
58
+ attr_accessor :specs
59
+
60
+ # @return [Symbol] The platform (either `:ios` or `:osx`).
61
+ #
62
+ attr_accessor :platform_name
63
+
64
+ # @return [String] The deployment target.
65
+ #
66
+ attr_accessor :platform_deployment_target
67
+
68
+ # @return [String] The label for the target.
69
+ #
70
+ attr_accessor :cocoapods_target_label
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,99 @@
1
+ require 'fileutils'
2
+
3
+ module Pod
4
+ class Installer
5
+ # Migrates installations performed by previous versions of CocoaPods.
6
+ #
7
+ class Migrator
8
+ class << self
9
+ # Performs the migration.
10
+ #
11
+ # @param [Sandbox] The sandbox which should be migrated.
12
+ #
13
+ def migrate(sandbox)
14
+ if sandbox.manifest
15
+ migrate_to_0_34(sandbox) if installation_minor?('0.34', sandbox)
16
+ end
17
+ end
18
+
19
+ # @!group Migration Steps
20
+
21
+ # Migrates from CocoaPods versions previous to 0.34.
22
+ #
23
+ def migrate_to_0_34(sandbox)
24
+ UI.message('Migrating to CocoaPods 0.34') do
25
+ delete(sandbox.root + 'Headers')
26
+ make_path(sandbox.headers_root)
27
+
28
+ sandbox.root.children.each do |child|
29
+ relative = child.relative_path_from(sandbox.root)
30
+ case relative.to_s
31
+ when 'Manifest.lock', 'Pods.xcodeproj', 'Headers',
32
+ 'Target Support Files', 'Local Podspecs'
33
+ next
34
+ when 'BuildHeaders', 'PublicHeaders'
35
+ delete(child)
36
+ else
37
+ if child.directory? && child.extname != '.xcodeproj'
38
+ next
39
+ else
40
+ delete(child)
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ delete(Pathname(File.join(ENV['HOME'], 'Library/Caches/CocoaPods/Git')))
47
+ end
48
+
49
+ # @!group Private helpers
50
+
51
+ def installation_minor?(target_version, sandbox)
52
+ sandbox.manifest.cocoapods_version < Version.new(target_version)
53
+ end
54
+
55
+ # Makes a path creating any intermediate directory and printing an UI
56
+ # message.
57
+ #
58
+ # @path [#to_s] path
59
+ # The path.
60
+ #
61
+ def make_path(path)
62
+ return if path.exist?
63
+ UI.message "- Making path #{UI.path(path)}" do
64
+ path.mkpath
65
+ end
66
+ end
67
+
68
+ # Moves a path to another one printing an UI message.
69
+ #
70
+ # @path [#to_s] source
71
+ # The path to move.
72
+ #
73
+ # @path [#to_s] destination
74
+ # The destination path.
75
+ #
76
+ def move(source, destination)
77
+ return unless source.exist?
78
+ make_path(destination.dirname)
79
+ UI.message "- Moving #{UI.path(source)} to #{UI.path(destination)}" do
80
+ FileUtils.mv(source.to_s, destination.to_s)
81
+ end
82
+ end
83
+
84
+ # Deletes a path, including non empty directories, printing an UI
85
+ # message.
86
+ #
87
+ # @path [#to_s] path
88
+ # The path.
89
+ #
90
+ def delete(path)
91
+ return unless path.exist?
92
+ UI.message "- Deleting #{UI.path(path)}" do
93
+ FileUtils.rm_rf(path)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -2,14 +2,12 @@ require 'active_support/core_ext/string/strip'
2
2
 
3
3
  module Pod
4
4
  class Installer
5
-
6
5
  # Controller class responsible of installing the activated specifications
7
6
  # of a single Pod.
8
7
  #
9
8
  # @note This class needs to consider all the activated specs of a Pod.
10
9
  #
11
10
  class PodSourceInstaller
12
-
13
11
  # @return [Sandbox]
14
12
  #
15
13
  attr_reader :sandbox
@@ -25,8 +23,6 @@ module Pod
25
23
  def initialize(sandbox, specs_by_platform)
26
24
  @sandbox = sandbox
27
25
  @specs_by_platform = specs_by_platform
28
-
29
- @aggressive_cache = false
30
26
  end
31
27
 
32
28
  # @return [String] A string suitable for debugging.
@@ -39,21 +35,6 @@ module Pod
39
35
 
40
36
  public
41
37
 
42
- # @!group Configuration
43
-
44
- # @return [Bool] whether the downloader should always check against the
45
- # remote if issues might be generated (mostly useful to speed up
46
- # testing).
47
- #
48
- # @note This might be removed in future.
49
- #
50
- attr_accessor :aggressive_cache
51
- alias_method :aggressive_cache?, :aggressive_cache
52
-
53
- #-----------------------------------------------------------------------#
54
-
55
- public
56
-
57
38
  # @!group Installation
58
39
 
59
40
  # Creates the target in the Pods project and the relative support files.
@@ -79,7 +60,7 @@ module Pod
79
60
  # @return [void]
80
61
  #
81
62
  def clean!
82
- clean_installation if !local?
63
+ clean_installation unless local?
83
64
  end
84
65
 
85
66
  # @return [Hash]
@@ -106,9 +87,9 @@ module Pod
106
87
  @specific_source = downloader.checkout_options
107
88
  rescue RuntimeError => e
108
89
  if e.message == 'Abstract method'
109
- raise Informative, "The pod '" + root_spec.name + "' does not " +
110
- "support the :head option, as it uses a " + downloader.name +
111
- " source. Remove that option to use this pod."
90
+ raise Informative, "The pod '" + root_spec.name + "' does not " \
91
+ 'support the :head option, as it uses a ' + downloader.name +
92
+ ' source. Remove that option to use this pod.'
112
93
  else
113
94
  raise
114
95
  end
@@ -121,7 +102,7 @@ module Pod
121
102
  end
122
103
 
123
104
  if specific_source
124
- sandbox.store_checkout_source(root_spec.name, specific_source)
105
+ sandbox.store_checkout_source(root_spec.name, specific_source)
125
106
  end
126
107
  end
127
108
 
@@ -138,7 +119,7 @@ module Pod
138
119
  #
139
120
  def run_prepare_command
140
121
  return unless root_spec.prepare_command
141
- UI.section(" > Running prepare command", '', 1) do
122
+ UI.section(' > Running prepare command', '', 1) do
142
123
  Dir.chdir(root) do
143
124
  ENV.delete('CDPATH')
144
125
  prepare_command = root_spec.prepare_command.strip_heredoc.chomp
@@ -167,7 +148,7 @@ module Pod
167
148
  # source.
168
149
  #
169
150
  def downloader
170
- @downloader ||= Config.instance.downloader(root, root_spec.source.dup)
151
+ @downloader ||= Downloader.for_target(root, root_spec.source.dup)
171
152
  end
172
153
 
173
154
  #-----------------------------------------------------------------------#
@@ -254,7 +235,7 @@ module Pod
254
235
  def clean_paths
255
236
  cached_used = used_files
256
237
  glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD
257
- files = Pathname.glob(root + "**/*", glob_options).map(&:to_s)
238
+ files = Pathname.glob(root + '**/*', glob_options).map(&:to_s)
258
239
 
259
240
  files.reject! do |candidate|
260
241
  candidate = candidate.downcase
@@ -282,11 +263,10 @@ module Pod
282
263
  file_accessors.map(&:source_files),
283
264
  ]
284
265
 
285
- files.flatten.compact.map{ |path| path.to_s }.uniq
266
+ files.flatten.compact.map(&:to_s).uniq
286
267
  end
287
268
 
288
269
  #-----------------------------------------------------------------------#
289
-
290
270
  end
291
271
  end
292
272
  end
@@ -1,12 +1,10 @@
1
1
  module Pod
2
2
  class Installer
3
-
4
3
  # Controller class responsible of creating and configuring the static
5
4
  # library target in Pods project. It also creates the support file needed
6
5
  # by the target.
7
6
  #
8
7
  class TargetInstaller
9
-
10
8
  # @return [Sandbox] sandbox the sandbox where the support files should
11
9
  # be generated.
12
10
  #
@@ -47,7 +45,6 @@ module Pod
47
45
  configuration = @target.add_build_configuration(bc_name, type)
48
46
  end
49
47
 
50
-
51
48
  settings = {}
52
49
  if library.archs
53
50
  settings['ARCHS'] = library.archs
@@ -60,13 +57,10 @@ module Pod
60
57
  library.target = @target
61
58
  end
62
59
 
63
- # Creates the group that holds the references to the support files
64
- # generated by this installer.
65
- #
66
- # @return [void]
60
+ # Creates the directory where to store the support files of the target.
67
61
  #
68
- def create_suport_files_group
69
- @support_files_group = project.support_files_group.new_group(library.name)
62
+ def create_support_files_dir
63
+ library.support_files_dir.mkdir
70
64
  end
71
65
 
72
66
  # Generates a dummy source file for each target so libraries that contain
@@ -76,12 +70,10 @@ module Pod
76
70
  #
77
71
  def create_dummy_source
78
72
  path = library.dummy_source_path
79
- UI.message "- Generating dummy source file at #{UI.path(path)}" do
80
- generator = Generator::DummySource.new(library.label)
81
- generator.save_as(path)
82
- file_reference = add_file_to_support_group(path)
83
- target.source_build_phase.add_file_reference(file_reference)
84
- end
73
+ generator = Generator::DummySource.new(library.label)
74
+ generator.save_as(path)
75
+ file_reference = add_file_to_support_group(path)
76
+ target.source_build_phase.add_file_reference(file_reference)
85
77
  end
86
78
 
87
79
  # @return [PBXNativeTarget] the target generated by the installation
@@ -126,8 +118,6 @@ module Pod
126
118
  end
127
119
 
128
120
  #-----------------------------------------------------------------------#
129
-
130
121
  end
131
122
  end
132
123
  end
133
-