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
@@ -3,7 +3,6 @@ require 'cocoapods-downloader'
3
3
  module Pod
4
4
  module Downloader
5
5
  class Base
6
-
7
6
  override_api do
8
7
 
9
8
  def execute_command(executable, command, raise_on_failure = false)
@@ -1,5 +1,4 @@
1
1
  module Pod
2
-
3
2
  # Module which provides support for running executables.
4
3
  #
5
4
  # In a class it can be used as:
@@ -12,7 +11,6 @@ module Pod
12
11
  # output of the command.
13
12
  #
14
13
  module Executable
15
-
16
14
  # Creates the methods for the executable with the given name.
17
15
  #
18
16
  # @param [Symbol] name
@@ -21,12 +19,11 @@ module Pod
21
19
  # @return [void]
22
20
  #
23
21
  def executable(name)
24
-
25
22
  define_method(name) do |command|
26
23
  Executable.execute_command(name, command, false)
27
24
  end
28
25
 
29
- define_method(name.to_s + "!") do |command|
26
+ define_method(name.to_s + '!') do |command|
30
27
  Executable.execute_command(name, command, true)
31
28
  end
32
29
  end
@@ -51,7 +48,6 @@ module Pod
51
48
  # @todo Find a way to display the live output of the commands.
52
49
  #
53
50
  def self.execute_command(executable, command, raise_on_failure)
54
-
55
51
  bin = `which #{executable}`.strip
56
52
  raise Informative, "Unable to locate the executable `#{executable}`" if bin.empty?
57
53
 
@@ -66,7 +62,7 @@ module Pod
66
62
  stdout, stderr = Indenter.new, Indenter.new
67
63
  end
68
64
 
69
- options = {:stdout => stdout, :stderr => stderr, :status => true}
65
+ options = { :stdout => stdout, :stderr => stderr, :status => true }
70
66
  status = Open4.spawn(full_command, options)
71
67
  output = stdout.join("\n") + stderr.join("\n")
72
68
  unless status.success?
@@ -82,10 +78,9 @@ module Pod
82
78
  #-------------------------------------------------------------------------#
83
79
 
84
80
  # Helper class that allows to write to an {IO} instance taking into account
85
- # the UI indentation lever.
81
+ # the UI indentation level.
86
82
  #
87
83
  class Indenter < ::Array
88
-
89
84
  # @return [Fixnum] The indentation level of the UI.
90
85
  #
91
86
  attr_accessor :indent
@@ -4,12 +4,10 @@ require 'cocoapods/external_sources/path_source'
4
4
  require 'cocoapods/external_sources/podspec_source'
5
5
 
6
6
  module Pod
7
-
8
7
  # Provides support for initializing the correct concrete class of an external
9
8
  # source.
10
9
  #
11
10
  module ExternalSources
12
-
13
11
  # @return [AbstractExternalSource] an initialized instance of the concrete
14
12
  # external source class associated with the option specified in the
15
13
  # hash.
@@ -34,8 +32,8 @@ module Pod
34
32
  elsif params.key?(:path)
35
33
  PathSource
36
34
  elsif params.key?(:local)
37
- UI.warn "The `:local` option of the Podfile has been " \
38
- "renamed to `:path` and it is deprecated."
35
+ UI.warn 'The `:local` option of the Podfile has been ' \
36
+ 'renamed to `:path` and it is deprecated.'
39
37
  PathSource
40
38
  elsif Downloader.strategy_from_options(params)
41
39
  DownloaderSource
@@ -1,10 +1,8 @@
1
1
  module Pod
2
2
  module ExternalSources
3
-
4
3
  # Abstract class that defines the common behaviour of external sources.
5
4
  #
6
5
  class AbstractExternalSource
7
-
8
6
  # @return [String] the name of the Pod described by this external source.
9
7
  #
10
8
  attr_reader :name
@@ -48,14 +46,14 @@ module Pod
48
46
  #
49
47
  # @return [void]
50
48
  #
51
- def fetch(sandbox)
52
- raise "Abstract method"
49
+ def fetch(_sandbox)
50
+ raise 'Abstract method'
53
51
  end
54
52
 
55
53
  # @return [String] a string representation of the source suitable for UI.
56
54
  #
57
55
  def description
58
- raise "Abstract method"
56
+ raise 'Abstract method'
59
57
  end
60
58
 
61
59
  protected
@@ -98,12 +96,20 @@ module Pod
98
96
  #
99
97
  def pre_download(sandbox)
100
98
  title = "Pre-downloading: `#{name}` #{description}"
101
- UI.titled_section(title, { :verbose_prefix => "-> " }) do
102
- target = sandbox.root + name
99
+ UI.titled_section(title, :verbose_prefix => '-> ') do
100
+ target = sandbox.pod_dir(name)
103
101
  target.rmtree if target.exist?
104
- downloader = Config.instance.downloader(target, params)
102
+ downloader = Downloader.for_target(target, params)
105
103
  downloader.download
106
- store_podspec(sandbox, target + "#{name}.podspec")
104
+
105
+ podspec_path = target + "#{name}.podspec"
106
+ json = false
107
+ unless Pathname(podspec_path).exist?
108
+ podspec_path = target + "#{name}.podspec.json"
109
+ json = true
110
+ end
111
+
112
+ store_podspec(sandbox, target + podspec_path, json)
107
113
  sandbox.store_pre_downloaded_pod(name)
108
114
  if downloader.options_specific?
109
115
  source = params
@@ -137,4 +143,3 @@ module Pod
137
143
  end
138
144
  end
139
145
  end
140
-
@@ -1,6 +1,5 @@
1
1
  module Pod
2
2
  module ExternalSources
3
-
4
3
  # Provides support for fetching a specification file from a source handled
5
4
  # by the downloader. Supports all the options of the downloader
6
5
  #
@@ -8,7 +7,6 @@ module Pod
8
7
  # name matching the one of the dependency.
9
8
  #
10
9
  class DownloaderSource < AbstractExternalSource
11
-
12
10
  # @see AbstractExternalSource#fetch
13
11
  #
14
12
  def fetch(sandbox)
@@ -1,18 +1,16 @@
1
1
  module Pod
2
2
  module ExternalSources
3
-
4
3
  # Provides support for fetching a specification file from a path local to
5
4
  # the machine running the installation.
6
5
  #
7
6
  # Works with the {LocalPod::LocalSourcedPod} class.
8
7
  #
9
8
  class PathSource < AbstractExternalSource
10
-
11
9
  # @see AbstractExternalSource#fetch
12
10
  #
13
11
  def fetch(sandbox)
14
12
  title = "Fetching podspec for `#{name}` #{description}"
15
- UI.titled_section(title, { :verbose_prefix => "-> " }) do
13
+ UI.titled_section(title, :verbose_prefix => '-> ') do
16
14
  podspec = podspec_path
17
15
  unless podspec.exist?
18
16
  raise Informative, "No podspec found for `#{name}` in " \
@@ -55,4 +53,3 @@ module Pod
55
53
  end
56
54
  end
57
55
  end
58
-
@@ -1,16 +1,14 @@
1
1
  module Pod
2
2
  module ExternalSources
3
-
4
3
  # Provides support for fetching a specification file from an URL. Can be
5
4
  # http, file, etc.
6
5
  #
7
6
  class PodspecSource < AbstractExternalSource
8
-
9
7
  # @see AbstractExternalSource#fetch
10
8
  #
11
9
  def fetch(sandbox)
12
10
  title = "Fetching podspec for `#{name}` #{description}"
13
- UI.titled_section(title, { :verbose_prefix => "-> " }) do
11
+ UI.titled_section(title, :verbose_prefix => '-> ') do
14
12
  is_json = podspec_uri.split('.').last == 'json'
15
13
  require 'open-uri'
16
14
  open(podspec_uri) { |io| store_podspec(sandbox, io.read, is_json) }
@@ -1,6 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods command line tool.
3
3
  #
4
- VERSION = '0.33.1' unless defined? Pod::VERSION
4
+ VERSION = '0.34.0.rc1' unless defined? Pod::VERSION
5
5
  end
6
-
@@ -1,8 +1,6 @@
1
1
  module Pod
2
2
  module Generator
3
-
4
3
  class Acknowledgements
5
-
6
4
  # @return [Array<Class>] The classes of the acknowledgements generator
7
5
  # subclasses.
8
6
  #
@@ -29,25 +27,25 @@ module Pod
29
27
  # @return [String] The title of the acknowledgements file.
30
28
  #
31
29
  def header_title
32
- "Acknowledgements"
30
+ 'Acknowledgements'
33
31
  end
34
32
 
35
33
  # @return [String] A text to present before listing the acknowledgements.
36
34
  #
37
35
  def header_text
38
- "This application makes use of the following third party libraries:"
36
+ 'This application makes use of the following third party libraries:'
39
37
  end
40
38
 
41
39
  # @return [String] The title of the foot notes.
42
40
  #
43
41
  def footnote_title
44
- ""
42
+ ''
45
43
  end
46
44
 
47
45
  # @return [String] the foot notes.
48
46
  #
49
47
  def footnote_text
50
- "Generated by CocoaPods - http://cocoapods.org"
48
+ 'Generated by CocoaPods - http://cocoapods.org'
51
49
  end
52
50
 
53
51
  #-----------------------------------------------------------------------#
@@ -60,7 +58,7 @@ module Pod
60
58
  # acknowledgements should be generated.
61
59
  #
62
60
  def specs
63
- file_accessors.map{ |accessor| accessor.spec.root }.uniq
61
+ file_accessors.map { |accessor| accessor.spec.root }.uniq
64
62
  end
65
63
 
66
64
  # Returns the text of the license for the given spec.
@@ -101,7 +99,6 @@ module Pod
101
99
  end
102
100
 
103
101
  #-----------------------------------------------------------------------#
104
-
105
102
  end
106
103
  end
107
104
  end
@@ -1,21 +1,19 @@
1
1
  module Pod
2
2
  module Generator
3
-
4
3
  class Markdown < Acknowledgements
5
-
6
4
  def self.path_from_basepath(path)
7
- Pathname.new(path.dirname + "#{path.basename.to_s}.markdown")
5
+ Pathname.new(path.dirname + "#{path.basename}.markdown")
8
6
  end
9
7
 
10
8
  def save_as(path)
11
- file = File.new(path, "w")
9
+ file = File.new(path, 'w')
12
10
  file.write(licenses)
13
11
  file.close
14
12
  end
15
13
 
16
14
  def title_from_string(string, level)
17
- if !string.empty?
18
- "#" * level << " #{string}"
15
+ unless string.empty?
16
+ '#' * level << " #{string}"
19
17
  end
20
18
  end
21
19
 
@@ -29,7 +27,7 @@ module Pod
29
27
  licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
30
28
  specs.each do |spec|
31
29
  if (license = string_for_spec(spec))
32
- license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
30
+ license = license.force_encoding('UTF-8') if license.respond_to?(:force_encoding)
33
31
  licenses_string += license
34
32
  end
35
33
  end
@@ -1,9 +1,8 @@
1
1
  module Pod
2
2
  module Generator
3
-
4
3
  class Plist < Acknowledgements
5
4
  def self.path_from_basepath(path)
6
- Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
5
+ Pathname.new(path.dirname + "#{path.basename}.plist")
7
6
  end
8
7
 
9
8
  def save_as(path)
@@ -15,12 +14,12 @@ module Pod
15
14
  {
16
15
  :Title => plist_title,
17
16
  :StringsTable => plist_title,
18
- :PreferenceSpecifiers => licenses
17
+ :PreferenceSpecifiers => licenses,
19
18
  }
20
19
  end
21
20
 
22
21
  def plist_title
23
- "Acknowledgements"
22
+ 'Acknowledgements'
24
23
  end
25
24
 
26
25
  def licenses
@@ -36,26 +35,26 @@ module Pod
36
35
  def hash_for_spec(spec)
37
36
  if (license = license_text(spec))
38
37
  {
39
- :Type => "PSGroupSpecifier",
38
+ :Type => 'PSGroupSpecifier',
40
39
  :Title => spec.name,
41
- :FooterText => license
40
+ :FooterText => license,
42
41
  }
43
42
  end
44
43
  end
45
44
 
46
45
  def header_hash
47
46
  {
48
- :Type => "PSGroupSpecifier",
47
+ :Type => 'PSGroupSpecifier',
49
48
  :Title => header_title,
50
- :FooterText => header_text
49
+ :FooterText => header_text,
51
50
  }
52
51
  end
53
52
 
54
53
  def footnote_hash
55
54
  {
56
- :Type => "PSGroupSpecifier",
55
+ :Type => 'PSGroupSpecifier',
57
56
  :Title => footnote_title,
58
- :FooterText => footnote_text
57
+ :FooterText => footnote_text,
59
58
  }
60
59
  end
61
60
  end
@@ -15,7 +15,7 @@ module Pod
15
15
  end
16
16
 
17
17
  def save_as(pathname)
18
- gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
18
+ gen_bridge_metadata %(-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}')
19
19
  end
20
20
  end
21
21
  end
@@ -1,7 +1,6 @@
1
1
  module Pod
2
2
  module Generator
3
3
  class CopyResourcesScript
4
-
5
4
  # @return [Array<#to_s>] A list of files relative to the project pods
6
5
  # root.
7
6
  #
@@ -44,7 +43,7 @@ module Pod
44
43
  #
45
44
  EXTERNAL_STRINGS_FILE_MIMINUM_DEPLOYMENT_TARGET = {
46
45
  :ios => Version.new('6.0'),
47
- :osx => Version.new('10.8')
46
+ :osx => Version.new('10.8'),
48
47
  }
49
48
 
50
49
  # @return [Bool] Whether the external strings file is supported by the
@@ -58,11 +57,11 @@ module Pod
58
57
  # @return [String] The install resources shell function.
59
58
  #
60
59
  def install_resources_function
61
- if use_external_strings_file?
62
- INSTALL_RESOURCES_FUCTION
63
- else
64
- INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '')
65
- end
60
+ if use_external_strings_file?
61
+ INSTALL_RESOURCES_FUCTION
62
+ else
63
+ INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '')
64
+ end
66
65
  end
67
66
 
68
67
  # @return [String] The contents of the copy resources script.
@@ -70,14 +69,13 @@ module Pod
70
69
  def script
71
70
  script = install_resources_function
72
71
  resources.each do |resource|
73
- script += %Q[install_resource "#{resource}"\n]
72
+ script += %( install_resource "#{resource}"\n )
74
73
  end
75
74
  script += RSYNC_CALL
76
75
  script += XCASSETS_COMPILE
77
76
  script
78
77
  end
79
78
 
80
-
81
79
  INSTALL_RESOURCES_FUCTION = <<EOS
82
80
  #!/bin/sh
83
81
  set -e
@@ -124,7 +122,6 @@ install_resource()
124
122
  }
125
123
  EOS
126
124
 
127
-
128
125
  RSYNC_CALL = <<EOS
129
126
 
130
127
  rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
@@ -134,12 +131,11 @@ fi
134
131
  rm -f "$RESOURCES_TO_COPY"
135
132
  EOS
136
133
 
137
-
138
134
  XCASSETS_COMPILE = <<EOS
139
135
 
140
136
  if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ]
141
137
  then
142
- case "${TARGETED_DEVICE_FAMILY}" in
138
+ case "${TARGETED_DEVICE_FAMILY}" in
143
139
  1,2)
144
140
  TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
145
141
  ;;
@@ -151,8 +147,8 @@ then
151
147
  ;;
152
148
  *)
153
149
  TARGET_DEVICE_ARGS="--target-device mac"
154
- ;;
155
- esac
150
+ ;;
151
+ esac
156
152
  find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
157
153
  fi
158
154
  EOS