cocoapods 0.33.1 → 0.34.0.rc1

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.
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,117 +1,114 @@
1
1
  module Pod
2
2
  module Generator
3
3
  module XCConfig
4
-
5
- # Generates the private xcconfigs for the pod targets.
6
- #
7
- # The private xcconfig file for a Pod target merges the configuration
8
- # values of the public namespaced xcconfig with the default private
9
- # configuration values required by CocoaPods.
10
- #
11
- class PrivatePodXCConfig
12
-
13
- # @return [Target] the target represented by this xcconfig.
4
+ # Generates the private xcconfigs for the pod targets.
14
5
  #
15
- attr_reader :target
16
-
17
- # @return [Xcodeproj::Config] The public xcconfig which this one will
18
- # use.
6
+ # The private xcconfig file for a Pod target merges the configuration
7
+ # values of the public namespaced xcconfig with the default private
8
+ # configuration values required by CocoaPods.
19
9
  #
20
- attr_reader :public_xcconfig
10
+ class PrivatePodXCConfig
11
+ # @return [Target] the target represented by this xcconfig.
12
+ #
13
+ attr_reader :target
21
14
 
22
- # @param [Target] target @see target
23
- # @param [Xcodeproj::Config] public_xcconfig @see public_xcconfig
24
- #
25
- def initialize(target, public_xcconfig)
26
- @target = target
27
- @public_xcconfig = public_xcconfig
28
- end
15
+ # @return [Xcodeproj::Config] The public xcconfig which this one will
16
+ # use.
17
+ #
18
+ attr_reader :public_xcconfig
29
19
 
30
- # @return [Xcodeproj::Config] The generated xcconfig.
31
- #
32
- attr_reader :xcconfig
20
+ # @param [Target] target @see target
21
+ # @param [Xcodeproj::Config] public_xcconfig @see public_xcconfig
22
+ #
23
+ def initialize(target, public_xcconfig)
24
+ @target = target
25
+ @public_xcconfig = public_xcconfig
26
+ end
33
27
 
34
- # Generates and saves the xcconfig to the given path.
35
- #
36
- # @param [Pathname] path
37
- # the path where the prefix header should be stored.
38
- #
39
- # @return [void]
40
- #
41
- def save_as(path)
42
- generate.save_as(path)
43
- end
28
+ # @return [Xcodeproj::Config] The generated xcconfig.
29
+ #
30
+ attr_reader :xcconfig
44
31
 
45
- # Generates the xcconfig.
46
- #
47
- # @return [Xcodeproj::Config]
48
- #
49
- def generate
50
- search_paths = target.build_headers.search_paths.concat(target.sandbox.public_headers.search_paths)
51
- config = {
52
- 'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
53
- 'PODS_ROOT' => '${SRCROOT}',
54
- 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
55
- 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1',
56
- # 'USE_HEADERMAP' => 'NO'
57
- }
32
+ # Generates and saves the xcconfig to the given path.
33
+ #
34
+ # @param [Pathname] path
35
+ # the path where the prefix header should be stored.
36
+ #
37
+ # @return [void]
38
+ #
39
+ def save_as(path)
40
+ generate.save_as(path)
41
+ end
58
42
 
59
- xcconfig_hash = add_xcconfig_namespaced_keys(public_xcconfig.to_hash, config, target.xcconfig_prefix)
60
- @xcconfig = Xcodeproj::Config.new(xcconfig_hash)
61
- @xcconfig.includes = [target.name]
62
- @xcconfig
63
- end
43
+ # Generates the xcconfig.
44
+ #
45
+ # @return [Xcodeproj::Config]
46
+ #
47
+ def generate
48
+ search_paths = target.build_headers.search_paths.concat(target.sandbox.public_headers.search_paths)
49
+ config = {
50
+ 'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
51
+ 'PODS_ROOT' => '${SRCROOT}',
52
+ 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
53
+ 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
54
+ # 'USE_HEADERMAP' => 'NO'
55
+ }
64
56
 
65
- private
57
+ xcconfig_hash = add_xcconfig_namespaced_keys(public_xcconfig.to_hash, config, target.xcconfig_prefix)
58
+ @xcconfig = Xcodeproj::Config.new(xcconfig_hash)
59
+ @xcconfig.includes = [target.name]
60
+ @xcconfig
61
+ end
66
62
 
67
- #-----------------------------------------------------------------------#
63
+ private
68
64
 
69
- # !@group Private Helpers
65
+ #-----------------------------------------------------------------------#
70
66
 
71
- # Returns the hash representation of an xcconfig which inherit from the
72
- # namespaced keys of a given one.
73
- #
74
- # @param [Hash] source_config
75
- # The xcconfig whose keys need to be inherited.
76
- #
77
- # @param [Hash] destination_config
78
- # The config which should inherit the source config keys.
79
- #
80
- # @return [Hash] The inheriting xcconfig.
81
- #
82
- def add_xcconfig_namespaced_keys(source_config, destination_config, prefix)
83
- result = destination_config.dup
84
- source_config.each do |key, value|
85
- prefixed_key = prefix + conditional_less_key(key)
86
- current_value = destination_config[key]
87
- if current_value
88
- result[key] = "#{current_value} ${#{prefixed_key}}"
89
- else
90
- result[key] = "${#{prefixed_key}}"
67
+ # !@group Private Helpers
68
+
69
+ # Returns the hash representation of an xcconfig which inherit from the
70
+ # namespaced keys of a given one.
71
+ #
72
+ # @param [Hash] source_config
73
+ # The xcconfig whose keys need to be inherited.
74
+ #
75
+ # @param [Hash] destination_config
76
+ # The config which should inherit the source config keys.
77
+ #
78
+ # @return [Hash] The inheriting xcconfig.
79
+ #
80
+ def add_xcconfig_namespaced_keys(source_config, destination_config, prefix)
81
+ result = destination_config.dup
82
+ source_config.each do |key, _value|
83
+ prefixed_key = prefix + conditional_less_key(key)
84
+ current_value = destination_config[key]
85
+ if current_value
86
+ result[key] = "#{current_value} ${#{prefixed_key}}"
87
+ else
88
+ result[key] = "${#{prefixed_key}}"
89
+ end
91
90
  end
91
+ result
92
92
  end
93
- result
94
- end
95
93
 
96
- # Strips the [*]-syntax from the given xcconfig key.
97
- #
98
- # @param [String] key
99
- # The key to strip.
100
- #
101
- # @return [String] The stripped key.
102
- #
103
- def conditional_less_key(key)
104
- brackets_index = key.index('[')
105
- if brackets_index
106
- key[0...brackets_index]
107
- else
108
- key
94
+ # Strips the [*]-syntax from the given xcconfig key.
95
+ #
96
+ # @param [String] key
97
+ # The key to strip.
98
+ #
99
+ # @return [String] The stripped key.
100
+ #
101
+ def conditional_less_key(key)
102
+ brackets_index = key.index('[')
103
+ if brackets_index
104
+ key[0...brackets_index]
105
+ else
106
+ key
107
+ end
109
108
  end
110
- end
111
-
112
- #-----------------------------------------------------------------------#
113
109
 
114
- end
110
+ #-----------------------------------------------------------------------#
111
+ end
115
112
  end
116
113
  end
117
114
  end
@@ -1,62 +1,59 @@
1
1
  module Pod
2
2
  module Generator
3
3
  module XCConfig
4
+ # Generates the public xcconfigs for the pod targets.
5
+ #
6
+ # The public xcconfig file for a Pod is completely namespaced to prevent
7
+ # configuration value collision with the build settings of other Pods. This
8
+ # xcconfig includes the standard podspec defined values including
9
+ # libraries, frameworks, weak frameworks and xcconfig overrides.
10
+ #
11
+ class PublicPodXCConfig
12
+ # @return [Target] the target represented by this xcconfig.
13
+ #
14
+ attr_reader :target
15
+
16
+ # @param [Target] target @see target
17
+ #
18
+ def initialize(target)
19
+ @target = target
20
+ end
4
21
 
5
- # Generates the public xcconfigs for the pod targets.
6
- #
7
- # The public xcconfig file for a Pod is completely namespaced to prevent
8
- # configuration value collision with the build settings of other Pods. This
9
- # xcconfig includes the standard podspec defined values including
10
- # libraries, frameworks, weak frameworks and xcconfig overrides.
11
- #
12
- class PublicPodXCConfig
13
-
14
- # @return [Target] the target represented by this xcconfig.
15
- #
16
- attr_reader :target
17
-
18
- # @param [Target] target @see target
19
- #
20
- def initialize(target)
21
- @target = target
22
- end
23
-
24
- # @return [Xcodeproj::Config] The generated xcconfig.
25
- #
26
- attr_reader :xcconfig
27
-
28
- # Generates and saves the xcconfig to the given path.
29
- #
30
- # @param [Pathname] path
31
- # the path where the prefix header should be stored.
32
- #
33
- # @return [void]
34
- #
35
- def save_as(path)
36
- generate.save_as(path, target.xcconfig_prefix)
37
- end
22
+ # @return [Xcodeproj::Config] The generated xcconfig.
23
+ #
24
+ attr_reader :xcconfig
25
+
26
+ # Generates and saves the xcconfig to the given path.
27
+ #
28
+ # @param [Pathname] path
29
+ # the path where the prefix header should be stored.
30
+ #
31
+ # @return [void]
32
+ #
33
+ def save_as(path)
34
+ generate.save_as(path, target.xcconfig_prefix)
35
+ end
38
36
 
39
- # Generates the xcconfig for the target.
40
- #
41
- # @return [Xcodeproj::Config]
42
- #
43
- def generate
44
- @xcconfig = Xcodeproj::Config.new
45
- target.file_accessors.each do |file_accessor|
46
- XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
47
- file_accessor.vendored_frameworks.each do |vendored_framework|
48
- XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
49
- end
50
- file_accessor.vendored_libraries.each do |vendored_library|
51
- XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
37
+ # Generates the xcconfig for the target.
38
+ #
39
+ # @return [Xcodeproj::Config]
40
+ #
41
+ def generate
42
+ @xcconfig = Xcodeproj::Config.new
43
+ target.file_accessors.each do |file_accessor|
44
+ XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, @xcconfig)
45
+ file_accessor.vendored_frameworks.each do |vendored_framework|
46
+ XCConfigHelper.add_framework_build_settings(vendored_framework, @xcconfig, target.sandbox.root)
47
+ end
48
+ file_accessor.vendored_libraries.each do |vendored_library|
49
+ XCConfigHelper.add_library_build_settings(vendored_library, @xcconfig, target.sandbox.root)
50
+ end
52
51
  end
52
+ @xcconfig
53
53
  end
54
- @xcconfig
55
- end
56
54
 
57
- #-----------------------------------------------------------------------#
58
-
59
- end
55
+ #-----------------------------------------------------------------------#
56
+ end
60
57
  end
61
58
  end
62
59
  end
@@ -1,11 +1,9 @@
1
1
  module Pod
2
2
  module Generator
3
3
  module XCConfig
4
-
5
4
  # Stores the shared logic of the classes of the XCConfig module.
6
5
  #
7
6
  module XCConfigHelper
8
-
9
7
  # Converts an array of strings to a single string where the each string
10
8
  # is surrounded by double quotes and separated by a space. Used to
11
9
  # represent strings in a xcconfig file.
@@ -19,7 +17,7 @@ module Pod
19
17
  #
20
18
  def self.quote(strings, prefix = nil)
21
19
  prefix = "#{prefix} " if prefix
22
- strings.sort.map { |s| %W|#{prefix}"#{s}"| }.join(" ")
20
+ strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ')
23
21
  end
24
22
 
25
23
  # @return [String] the default linker flags. `-ObjC` is always included
@@ -28,8 +26,8 @@ module Pod
28
26
  #
29
27
  def self.default_ld_flags(target)
30
28
  ld_flags = '-ObjC'
31
- if target.target_definition.podfile.set_arc_compatibility_flag? and
32
- target.spec_consumers.any? { |consumer| consumer.requires_arc? }
29
+ if target.target_definition.podfile.set_arc_compatibility_flag? &&
30
+ target.spec_consumers.any?(&:requires_arc?)
33
31
  ld_flags << ' -fobjc-arc'
34
32
  end
35
33
  ld_flags
@@ -62,11 +60,11 @@ module Pod
62
60
  # The xcconfig to edit.
63
61
  #
64
62
  def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root)
65
- name = File.basename(framework_path, ".framework")
63
+ name = File.basename(framework_path, '.framework')
66
64
  dirname = '$(PODS_ROOT)/' + framework_path.dirname.relative_path_from(sandbox_root).to_s
67
65
  build_settings = {
68
66
  'OTHER_LDFLAGS' => "-framework #{name}",
69
- 'FRAMEWORK_SEARCH_PATHS' => quote([dirname])
67
+ 'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
70
68
  }
71
69
  xcconfig.merge!(build_settings)
72
70
  end
@@ -81,11 +79,11 @@ module Pod
81
79
  # The xcconfig to edit.
82
80
  #
83
81
  def self.add_library_build_settings(library_path, xcconfig, sandbox_root)
84
- name = File.basename(library_path, ".a").sub(/\Alib/, '')
82
+ name = File.basename(library_path, '.a').sub(/\Alib/, '')
85
83
  dirname = '$(PODS_ROOT)/' + library_path.dirname.relative_path_from(sandbox_root).to_s
86
84
  build_settings = {
87
85
  'OTHER_LDFLAGS' => "-l#{name}",
88
- 'LIBRARY_SEARCH_PATHS' => quote([dirname])
86
+ 'LIBRARY_SEARCH_PATHS' => quote([dirname]),
89
87
  }
90
88
  xcconfig.merge!(build_settings)
91
89
  end
@@ -101,7 +99,7 @@ module Pod
101
99
  # @return [void]
102
100
  #
103
101
  def self.add_developers_frameworks_if_needed(xcconfig, platform)
104
- matched_frameworks = xcconfig.frameworks & ['XCTest', 'SenTestingKit']
102
+ matched_frameworks = xcconfig.frameworks & %w(XCTest SenTestingKit)
105
103
  unless matched_frameworks.empty?
106
104
  search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
107
105
  search_paths_to_add = []
@@ -111,6 +109,8 @@ module Pod
111
109
  else
112
110
  search_paths_to_add << '"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
113
111
  end
112
+ frameworks_path = '"$(PLATFORM_DIR)/Developer/Library/Frameworks"'
113
+ search_paths_to_add << frameworks_path
114
114
  search_paths_to_add.each do |search_path|
115
115
  unless search_paths.include?(search_path)
116
116
  search_paths << ' ' unless search_paths.empty?
@@ -1,28 +1,27 @@
1
1
  module Pod
2
-
2
+ # @todo: Remove by CocoaPods 1.0
3
+ #
3
4
  class Podfile
4
5
  def config
5
- UI.warn "Podfile#config is deprecated. The config is accessible from " \
6
- "the parameter passed to the hooks"
6
+ UI.warn 'Podfile#config is deprecated. The config is accessible from ' \
7
+ 'the parameter passed to the hooks'
7
8
  Config.instance
8
9
  end
9
- end
10
10
 
11
- class Podfile::TargetDefinition
12
- def copy_resources_script_name
13
- UI.warn "TargetDefinition#copy_resources_script_name is deprecated. " \
14
- "The value is accessible directly from the representation of the " \
15
- "library using the #copy_resources_script_path method."
16
- Config.instance.sandbox.root + "#{label}-resources.sh"
11
+ class TargetDefinition
12
+ def copy_resources_script_name
13
+ UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \
14
+ 'The value is accessible directly from the representation of the ' \
15
+ 'library using the #copy_resources_script_path method.'
16
+ Config.instance.sandbox.root + "#{label}-resources.sh"
17
+ end
17
18
  end
18
19
  end
19
20
 
20
21
  module Hooks
21
-
22
22
  # The installer representation to pass to the hooks.
23
23
  #
24
24
  class InstallerRepresentation
25
-
26
25
  public
27
26
 
28
27
  # @!group Public Hooks API
@@ -79,15 +78,16 @@ module Pod
79
78
  end
80
79
 
81
80
  #-----------------------------------------------------------------------#
81
+
82
82
  public
83
83
 
84
84
  # @!group Compatibility
85
85
  #
86
86
  # The following aliases provides compatibility with CP < 0.17
87
87
 
88
- alias :target_installers :libraries
89
- alias :specs_by_target :specs_by_lib
90
- alias :local_pods_by_target :pods_by_lib
88
+ alias_method :target_installers, :libraries
89
+ alias_method :specs_by_target, :specs_by_lib
90
+ alias_method :local_pods_by_target, :pods_by_lib
91
91
 
92
92
  #-----------------------------------------------------------------------#
93
93
 
@@ -126,9 +126,6 @@ module Pod
126
126
  end
127
127
 
128
128
  #-----------------------------------------------------------------------#
129
-
130
129
  end
131
130
  end
132
131
  end
133
-
134
-