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
@@ -16,8 +16,8 @@ module Pod
16
16
 
17
17
  def self.options
18
18
  [
19
- ["--no-shallow", "Clone full history so push will work"],
20
- ["--push", "Use this option to enable push access once granted"],
19
+ ['--no-shallow', 'Clone full history so push will work'],
20
+ ['--push', 'Use this option to enable push access once granted'],
21
21
  ].concat(super)
22
22
  end
23
23
 
@@ -31,7 +31,7 @@ module Pod
31
31
  end
32
32
 
33
33
  def run
34
- UI.section "Setting up CocoaPods master repo" do
34
+ UI.section 'Setting up CocoaPods master repo' do
35
35
  if master_repo_dir.exist?
36
36
  set_master_repo_url
37
37
  set_master_repo_branch
@@ -43,7 +43,7 @@ module Pod
43
43
  end
44
44
  end
45
45
 
46
- access_type = push? ? "push" : "read-only"
46
+ access_type = push? ? 'push' : 'read-only'
47
47
  UI.puts "Setup completed (#{access_type} access)".green
48
48
  end
49
49
 
@@ -51,16 +51,17 @@ module Pod
51
51
 
52
52
  # @!group Setup steps
53
53
 
54
- # Migrates any repos from the old directory structure to the new directory
55
- # structure.
54
+ # Migrates any repos from the old directory structure to the new
55
+ # directory structure.
56
+ #
57
+ # @todo: Remove by 1.0
56
58
  #
57
- # @return [void]
58
59
  def migrate_repos
59
60
  config.repos_dir.mkpath
60
61
  Dir.foreach old_master_repo_dir.parent do |repo_dir|
61
62
  source_repo_dir = old_master_repo_dir.parent + repo_dir
62
63
  target_repo_dir = config.repos_dir + repo_dir
63
- if not repo_dir =~ /\.+/ and source_repo_dir != config.repos_dir
64
+ if repo_dir !~ /\.+/ && source_repo_dir != config.repos_dir
64
65
  FileUtils.mv source_repo_dir, target_repo_dir
65
66
  end
66
67
  end
@@ -103,7 +104,7 @@ module Pod
103
104
  #
104
105
  def set_master_repo_branch
105
106
  Dir.chdir(master_repo_dir) do
106
- git("checkout master")
107
+ git('checkout master')
107
108
  end
108
109
  end
109
110
 
@@ -19,7 +19,7 @@ module Pod
19
19
  DESC
20
20
 
21
21
  self.arguments = [
22
- ['NAME | https://github.com/USER/REPO', :optional]
22
+ CLAide::Argument.new(%w(NAME https://github.com/USER/REPO), false),
23
23
  ]
24
24
 
25
25
  def initialize(argv)
@@ -29,7 +29,7 @@ module Pod
29
29
 
30
30
  def validate!
31
31
  super
32
- help! "A pod name or repo URL is required." unless @name_or_url
32
+ help! 'A pod name or repo URL is required.' unless @name_or_url
33
33
  end
34
34
 
35
35
  def run
@@ -53,21 +53,21 @@ module Pod
53
53
  self.summary = 'Validates a spec file.'
54
54
 
55
55
  self.description = <<-DESC
56
- Validates `NAME.podspec'. If a directory is provided it validates
56
+ Validates `NAME.podspec`. If a `DIRECTORY` is provided, it validates
57
57
  the podspec files found, including subfolders. In case
58
58
  the argument is omitted, it defaults to the current working dir.
59
59
  DESC
60
60
 
61
61
  self.arguments = [
62
- ['NAME.podspec | DIRECTORY | http://PATH/NAME.podspec, ...', :optional]
62
+ CLAide::Argument.new(%w(NAME.podspec DIRECTORY http://PATH/NAME.podspec), false, true),
63
63
  ]
64
64
 
65
65
  def self.options
66
- [ ["--quick", "Lint skips checks that would require to download and build the spec"],
67
- ["--only-errors", "Lint validates even if warnings are present"],
68
- ["--subspec=NAME","Lint validates only the given subspec"],
69
- ["--no-subspecs", "Lint skips validation of subspecs"],
70
- ["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super)
66
+ [['--quick', 'Lint skips checks that would require to download and build the spec'],
67
+ ['--only-errors', 'Lint validates even if warnings are present'],
68
+ ['--subspec=NAME', 'Lint validates only the given subspec'],
69
+ ['--no-subspecs', 'Lint skips validation of subspecs'],
70
+ ['--no-clean', 'Lint leaves the build directory intact for inspection']].concat(super)
71
71
  end
72
72
 
73
73
  def initialize(argv)
@@ -102,10 +102,10 @@ module Pod
102
102
  count = podspecs_to_lint.count
103
103
  UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n"
104
104
  if invalid_count == 0
105
- lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : "All the specs passed validation."
105
+ lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : 'All the specs passed validation.'
106
106
  UI.puts lint_passed_message.green << "\n\n"
107
107
  else
108
- raise Informative, count == 1 ? "The spec did not pass validation." : "#{invalid_count} out of #{count} specs failed validation."
108
+ raise Informative, count == 1 ? 'The spec did not pass validation.' : "#{invalid_count} out of #{count} specs failed validation."
109
109
  end
110
110
  podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist?
111
111
  end
@@ -114,32 +114,32 @@ module Pod
114
114
 
115
115
  def podspecs_to_lint
116
116
  @podspecs_to_lint ||= begin
117
- files = []
118
- @podspecs_paths << '.' if @podspecs_paths.empty?
119
- @podspecs_paths.each do |path|
120
- if path =~ /https?:\/\//
121
- require 'open-uri'
122
- output_path = podspecs_tmp_dir + File.basename(path)
123
- output_path.dirname.mkpath
124
- open(path) do |io|
125
- output_path.open('w') { |f| f << io.read }
126
- end
127
- files << output_path
128
- else if (pathname = Pathname.new(path)).directory?
129
- files += Pathname.glob(pathname + '**/*.podspec{.json,}')
130
- raise Informative, "No specs found in the current directory." if files.empty?
131
- else
132
- files << (pathname = Pathname.new(path))
133
- raise Informative, "Unable to find a spec named `#{path}'." unless pathname.exist? && path.include?('.podspec')
117
+ files = []
118
+ @podspecs_paths << '.' if @podspecs_paths.empty?
119
+ @podspecs_paths.each do |path|
120
+ if path =~ /https?:\/\//
121
+ require 'open-uri'
122
+ output_path = podspecs_tmp_dir + File.basename(path)
123
+ output_path.dirname.mkpath
124
+ open(path) do |io|
125
+ output_path.open('w') { |f| f << io.read }
134
126
  end
127
+ files << output_path
128
+ else if (pathname = Pathname.new(path)).directory?
129
+ files += Pathname.glob(pathname + '**/*.podspec{.json,}')
130
+ raise Informative, 'No specs found in the current directory.' if files.empty?
131
+ else
132
+ files << (pathname = Pathname.new(path))
133
+ raise Informative, "Unable to find a spec named `#{path}'." unless pathname.exist? && path.include?('.podspec')
135
134
  end
136
135
  end
136
+ end
137
137
  files
138
138
  end
139
139
  end
140
140
 
141
141
  def podspecs_tmp_dir
142
- Pathname.new(File.join(Pathname.new('/tmp').realpath, '/CocoaPods/Lint_podspec'))
142
+ Pathname(File.join(Pathname.new('/tmp').realpath, '/CocoaPods/Lint_podspec'))
143
143
  end
144
144
  end
145
145
 
@@ -153,11 +153,13 @@ module Pod
153
153
  DESC
154
154
 
155
155
  self.arguments = [
156
- ['NAME', :optional]
156
+ CLAide::Argument.new('NAME', false),
157
157
  ]
158
158
 
159
159
  def self.options
160
- [["--show-all", "Print all versions of the given podspec"]].concat(super)
160
+ [
161
+ ['--show-all', 'Print all versions of the given podspec'],
162
+ ].concat(super)
161
163
  end
162
164
 
163
165
  def initialize(argv)
@@ -169,7 +171,7 @@ module Pod
169
171
 
170
172
  def validate!
171
173
  super
172
- help! "A podspec name is required." unless @spec
174
+ help! 'A podspec name is required.' unless @spec
173
175
  end
174
176
 
175
177
  def run
@@ -187,11 +189,11 @@ module Pod
187
189
  DESC
188
190
 
189
191
  self.arguments = [
190
- ['NAME', :optional]
192
+ CLAide::Argument.new('NAME', false),
191
193
  ]
192
194
 
193
195
  def self.options
194
- [["--show-all", "Pick from all versions of the given podspec"]].concat(super)
196
+ [['--show-all', 'Pick from all versions of the given podspec']].concat(super)
195
197
  end
196
198
 
197
199
  def initialize(argv)
@@ -203,14 +205,14 @@ module Pod
203
205
 
204
206
  def validate!
205
207
  super
206
- help! "A podspec name is required." unless @spec
208
+ help! 'A podspec name is required.' unless @spec
207
209
  end
208
210
 
209
211
  def run
210
212
  filepath = if @show_all
211
- specs = get_path_of_spec(@spec, @show_all).split(/\n/)
212
- index = choose_from_array(specs, "Which spec would you like to print [1-#{ specs.count }]? ")
213
- specs[index]
213
+ specs = get_path_of_spec(@spec, @show_all).split(/\n/)
214
+ index = choose_from_array(specs, "Which spec would you like to print [1-#{ specs.count }]? ")
215
+ specs[index]
214
216
  else
215
217
  get_path_of_spec(@spec)
216
218
  end
@@ -229,11 +231,12 @@ module Pod
229
231
  DESC
230
232
 
231
233
  self.arguments = [
232
- ['NAME', :optional]
234
+ CLAide::Argument.new('NAME', false),
233
235
  ]
234
236
 
235
237
  def self.options
236
- [["--show-all", "Pick which spec to edit from all available versions of the given podspec"]].concat(super)
238
+ [['--show-all', 'Pick which spec to edit from all available' \
239
+ 'versions of the given podspec']].concat(super)
237
240
  end
238
241
 
239
242
  def initialize(argv)
@@ -245,19 +248,20 @@ module Pod
245
248
 
246
249
  def validate!
247
250
  super
248
- help! "A podspec name is required." unless @spec
251
+ help! 'A podspec name is required.' unless @spec
249
252
  end
250
253
 
251
254
  def run
252
- filepath = if @show_all
255
+ if @show_all
253
256
  specs = get_path_of_spec(@spec, @show_all).split(/\n/)
254
- index = choose_from_array(specs, "Which spec would you like to edit [1-#{ specs.count }]? ")
255
- specs[index]
257
+ message = "Which spec would you like to edit [1-#{specs.count}]? "
258
+ index = choose_from_array(specs, message)
259
+ filepath = specs[index]
256
260
  else
257
- get_path_of_spec(@spec)
261
+ filepath = get_path_of_spec(@spec)
258
262
  end
259
263
 
260
- exec_editor(filepath.to_s) if File.exists? filepath
264
+ exec_editor(filepath.to_s) if File.exist? filepath
261
265
  raise Informative, "#{ filepath } doesn't exist."
262
266
  end
263
267
 
@@ -284,7 +288,7 @@ module Pod
284
288
  raise Informative, "Failed to open editor. Set your 'EDITOR' environment variable."
285
289
  end
286
290
 
287
- def exec_editor *args
291
+ def exec_editor(*args)
288
292
  return if args.to_s.empty?
289
293
  safe_exec(which_editor, *args)
290
294
  end
@@ -292,7 +296,7 @@ module Pod
292
296
  def safe_exec(cmd, *args)
293
297
  # This buys us proper argument quoting and evaluation
294
298
  # of environment variables in the cmd parameter.
295
- exec "/bin/sh", "-i", "-c", cmd + ' "$@"', "--", *args
299
+ exec('/bin/sh', '-i', '-c', cmd + ' "$@"', '--', *args)
296
300
  end
297
301
  end
298
302
 
@@ -337,7 +341,7 @@ module Pod
337
341
  elsif sets.map(&:name).include?(spec)
338
342
  set = sets.find { |s| s.name == spec }
339
343
  else
340
- names = sets.collect(&:name) * ', '
344
+ names = sets.map(&:name) * ', '
341
345
  raise Informative, "More than one spec found for '#{ spec }':\n#{ names }"
342
346
  end
343
347
 
@@ -346,19 +350,19 @@ module Pod
346
350
  return pathname_from_spec(best_spec, spec_source)
347
351
  end
348
352
 
349
- return all_paths_from_set(set)
353
+ all_paths_from_set(set)
350
354
  end
351
355
 
352
356
  # @return [Pathname] the absolute path of the given spec and source
353
357
  #
354
- def pathname_from_spec(spec, source)
358
+ def pathname_from_spec(spec, _source)
355
359
  Pathname(spec.defined_in_file)
356
360
  end
357
361
 
358
362
  # @return [String] of spec paths one on each line
359
363
  #
360
364
  def all_paths_from_set(set)
361
- paths = ""
365
+ paths = ''
362
366
 
363
367
  sources = set.sources
364
368
 
@@ -384,18 +388,18 @@ module Pod
384
388
  sources.each do |source|
385
389
  versions = source.versions(set.name)
386
390
  versions.each do |version|
387
- if !best_version or version > best_version
391
+ if !best_version || version > best_version
388
392
  best_source = source
389
393
  best_version = version
390
394
  end
391
395
  end
392
396
  end
393
397
 
394
- if !best_source or !best_version
398
+ if !best_source || !best_version
395
399
  raise Informative, "Unable to locate highest known specification for `#{ set.name }'"
396
400
  end
397
401
 
398
- return best_source.specification(set.name, best_version), best_source
402
+ [best_source.specification(set.name, best_version), best_source]
399
403
  end
400
404
 
401
405
  #--------------------------------------#
@@ -427,7 +431,7 @@ module Pod
427
431
 
428
432
  data[:name] = repo['name']
429
433
  data[:summary] = (repo['description'] || '').gsub(/["]/, '\"')
430
- data[:homepage] = (repo['homepage'] && !repo['homepage'].empty? ) ? repo['homepage'] : repo['html_url']
434
+ data[:homepage] = (repo['homepage'] && !repo['homepage'].empty?) ? repo['homepage'] : repo['html_url']
431
435
  data[:author_name] = user['name'] || user['login']
432
436
  data[:author_email] = user['email'] || 'email@address.com'
433
437
  data[:source_url] = repo['clone_url']
@@ -436,18 +440,18 @@ module Pod
436
440
  end
437
441
 
438
442
  def suggested_ref_and_version(repo)
439
- tags = GitHub.tags(repo['html_url']).map {|tag| tag["name"]}
443
+ tags = GitHub.tags(repo['html_url']).map { |tag| tag['name'] }
440
444
  versions_tags = {}
441
445
  tags.each do |tag|
442
- clean_tag = tag.gsub(/^v(er)? ?/,'')
446
+ clean_tag = tag.gsub(/^v(er)? ?/, '')
443
447
  versions_tags[Gem::Version.new(clean_tag)] = tag if Gem::Version.correct?(clean_tag)
444
448
  end
445
449
  version = versions_tags.keys.sort.last || '0.0.1'
446
- data = {:version => version}
450
+ data = { :version => version }
447
451
  if version == '0.0.1'
448
452
  branches = GitHub.branches(repo['html_url'])
449
453
  master_name = repo['master_branch'] || 'master'
450
- master = branches.find {|branch| branch['name'] == master_name }
454
+ master = branches.find { |branch| branch['name'] == master_name }
451
455
  data[:ref_type] = ':commit'
452
456
  data[:ref] = master['commit']['sha']
453
457
  else
@@ -458,7 +462,7 @@ module Pod
458
462
  end
459
463
 
460
464
  def spec_template(data)
461
- return <<-SPEC
465
+ <<-SPEC
462
466
  #
463
467
  # Be sure to run `pod spec lint #{data[:name]}.podspec' to ensure this is a
464
468
  # valid spec and to remove all comments including this before submitting the spec.
@@ -513,7 +517,7 @@ Pod::Spec.new do |s|
513
517
  # Specify a social_media_url where others can refer to, for example a twitter
514
518
  # profile URL.
515
519
  #
516
-
520
+
517
521
  s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" }
518
522
  # Or just: s.author = "#{data[:author_name]}"
519
523
  # s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" }
@@ -599,7 +603,7 @@ end
599
603
  end
600
604
 
601
605
  def semantic_versioning_notice(repo_id, repo)
602
- return <<-EOS
606
+ <<-EOS
603
607
 
604
608
  #{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
605
609
 
@@ -1,9 +1,7 @@
1
1
  module Pod
2
-
3
2
  # Stores the global configuration of CocoaPods.
4
3
  #
5
4
  class Config
6
-
7
5
  # The default settings for the configuration.
8
6
  #
9
7
  # Users can specify custom settings in `~/.cocoapods/config.yaml`.
@@ -23,8 +21,6 @@ module Pod
23
21
  :new_version_message => true,
24
22
 
25
23
  :cache_root => Pathname.new(File.join(ENV['HOME'], 'Library/Caches/CocoaPods')),
26
- :max_cache_size => 500,
27
- :aggressive_cache => false,
28
24
  }
29
25
 
30
26
  public
@@ -37,18 +33,18 @@ module Pod
37
33
  # performed actions.
38
34
  #
39
35
  attr_accessor :verbose
40
- alias_method :verbose?, :verbose
36
+ alias_method :verbose?, :verbose
41
37
 
42
38
  # @return [Bool] Whether CocoaPods should produce not output.
43
39
  #
44
40
  attr_accessor :silent
45
- alias_method :silent?, :silent
41
+ alias_method :silent?, :silent
46
42
 
47
43
  # @return [Bool] Whether a message should be printed when a new version of
48
44
  # CocoaPods is available.
49
45
  #
50
46
  attr_accessor :new_version_message
51
- alias_method :new_version_message?, :new_version_message
47
+ alias_method :new_version_message?, :new_version_message
52
48
 
53
49
  #-------------------------------------------------------------------------#
54
50
 
@@ -57,19 +53,18 @@ module Pod
57
53
  # @return [Bool] Whether the installer should clean after the installation.
58
54
  #
59
55
  attr_accessor :clean
60
- alias_method :clean?, :clean
56
+ alias_method :clean?, :clean
61
57
 
62
58
  # @return [Bool] Whether CocoaPods should integrate a user target and build
63
59
  # the workspace or just create the Pods project.
64
60
  #
65
61
  attr_accessor :integrate_targets
66
- alias_method :integrate_targets?, :integrate_targets
67
-
62
+ alias_method :integrate_targets?, :integrate_targets
68
63
 
69
64
  # @return [Bool] Whether the installer should skip the repos update.
70
65
  #
71
66
  attr_accessor :skip_repo_update
72
- alias_method :skip_repo_update?, :skip_repo_update
67
+ alias_method :skip_repo_update?, :skip_repo_update
73
68
 
74
69
  public
75
70
 
@@ -77,10 +72,6 @@ module Pod
77
72
 
78
73
  # @!group Cache
79
74
 
80
- # @return [Fixnum] The maximum size for the cache expressed in Mb.
81
- #
82
- attr_accessor :max_cache_size
83
-
84
75
  # @return [Pathname] The directory where CocoaPods should cache remote data
85
76
  # and other expensive to compute information.
86
77
  #
@@ -91,21 +82,6 @@ module Pod
91
82
  @cache_root
92
83
  end
93
84
 
94
- # Allows to set whether the downloader should use more aggressive caching
95
- # options.
96
- #
97
- # @note The aggressive cache has lead to issues if a tag is updated to
98
- # point to another commit.
99
- #
100
- attr_writer :aggressive_cache
101
-
102
- # @return [Bool] Whether the downloader should use more aggressive caching
103
- # options.
104
- #
105
- def aggressive_cache?
106
- @aggressive_cache || (ENV['CP_AGGRESSIVE_CACHE'] == 'TRUE')
107
- end
108
-
109
85
  public
110
86
 
111
87
  #-------------------------------------------------------------------------#
@@ -136,13 +112,13 @@ module Pod
136
112
  # files are stored.
137
113
  #
138
114
  def home_dir
139
- @home_dir ||= Pathname.new(ENV['CP_HOME_DIR'] || "~/.cocoapods").expand_path
115
+ @home_dir ||= Pathname.new(ENV['CP_HOME_DIR'] || '~/.cocoapods').expand_path
140
116
  end
141
117
 
142
118
  # @return [Pathname] the directory where the CocoaPods sources are stored.
143
119
  #
144
120
  def repos_dir
145
- @repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || "~/.cocoapods/repos").expand_path
121
+ @repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || '~/.cocoapods/repos').expand_path
146
122
  end
147
123
 
148
124
  attr_writer :repos_dir
@@ -150,7 +126,7 @@ module Pod
150
126
  # @return [Pathname] the directory where the CocoaPods templates are stored.
151
127
  #
152
128
  def templates_dir
153
- @templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || "~/.cocoapods/templates").expand_path
129
+ @templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || '~/.cocoapods/templates').expand_path
154
130
  end
155
131
 
156
132
  # @return [Pathname] the root of the CocoaPods installation where the
@@ -159,7 +135,7 @@ module Pod
159
135
  def installation_root
160
136
  current_path = Pathname.pwd
161
137
  unless @installation_root
162
- while(!current_path.root?)
138
+ until current_path.root?
163
139
  if podfile_path_in_dir(current_path)
164
140
  @installation_root = current_path
165
141
  unless current_path == Pathname.pwd
@@ -176,7 +152,7 @@ module Pod
176
152
  end
177
153
 
178
154
  attr_writer :installation_root
179
- alias :project_root :installation_root
155
+ alias_method :project_root, :installation_root
180
156
 
181
157
  # @return [Pathname] The root of the sandbox.
182
158
  #
@@ -185,7 +161,7 @@ module Pod
185
161
  end
186
162
 
187
163
  attr_writer :sandbox_root
188
- alias :project_pods_root :sandbox_root
164
+ alias_method :project_pods_root, :sandbox_root
189
165
 
190
166
  # @return [Sandbox] The sandbox of the current project.
191
167
  #
@@ -236,7 +212,7 @@ module Pod
236
212
  # @return [Pathname]
237
213
  #
238
214
  def default_podfile_path
239
- @default_podfile_path ||= templates_dir + "Podfile.default"
215
+ @default_podfile_path ||= templates_dir + 'Podfile.default'
240
216
  end
241
217
 
242
218
  # Returns the path of the default Podfile test pods.
@@ -246,7 +222,7 @@ module Pod
246
222
  # @return [Pathname]
247
223
  #
248
224
  def default_test_podfile_path
249
- @default_test_podfile_path ||= templates_dir + "Podfile.test"
225
+ @default_test_podfile_path ||= templates_dir + 'Podfile.test'
250
226
  end
251
227
 
252
228
  # @return [Pathname] The file to use a cache of the statistics provider.
@@ -255,7 +231,7 @@ module Pod
255
231
  cache_root + 'statistics.yml'
256
232
  end
257
233
 
258
- # @return [Pathname] The file to use to cache the search data.
234
+ # @return [Pathname] The file to use to cache the search data.
259
235
  #
260
236
  def search_index_file
261
237
  cache_root + 'search_index.yaml'
@@ -267,17 +243,6 @@ module Pod
267
243
 
268
244
  # @!group Dependency Injection
269
245
 
270
- # @return [Downloader] The downloader to use for the retrieving remote
271
- # source.
272
- #
273
- def downloader(target_path, options)
274
- downloader = Downloader.for_target(target_path, options)
275
- downloader.cache_root = cache_root
276
- downloader.max_cache_size = max_cache_size
277
- downloader.aggressive_cache = aggressive_cache?
278
- downloader
279
- end
280
-
281
246
  # @return [Specification::Set::Statistics] The statistic provider to use
282
247
  # for specifications.
283
248
  #
@@ -294,7 +259,7 @@ module Pod
294
259
  # @return [Pathname] The path of the file which contains the user settings.
295
260
  #
296
261
  def user_settings_file
297
- home_dir + "config.yaml"
262
+ home_dir + 'config.yaml'
298
263
  end
299
264
 
300
265
  # Sets the values of the attributes with the given hash.
@@ -307,7 +272,7 @@ module Pod
307
272
  def configure_with(values_by_key)
308
273
  return unless values_by_key
309
274
  values_by_key.each do |key, value|
310
- self.instance_variable_set("@#{key}", value)
275
+ instance_variable_set("@#{key}", value)
311
276
  end
312
277
  end
313
278
 
@@ -320,6 +285,8 @@ module Pod
320
285
  'Podfile',
321
286
  ]
322
287
 
288
+ public
289
+
323
290
  # Returns the path of the Podfile in the given dir if any exists.
324
291
  #
325
292
  # @param [Pathname] dir
@@ -357,8 +324,8 @@ module Pod
357
324
  #
358
325
  # @return [void]
359
326
  #
360
- def self.instance=(instance)
361
- @instance = instance
327
+ class << self
328
+ attr_writer :instance
362
329
  end
363
330
 
364
331
  # Provides support for accessing the configuration instance in other