cocoapods 1.0.1 → 1.1.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +107 -0
  3. data/lib/cocoapods/command.rb +1 -0
  4. data/lib/cocoapods/command/repo/push.rb +26 -5
  5. data/lib/cocoapods/command/setup.rb +2 -1
  6. data/lib/cocoapods/downloader.rb +20 -0
  7. data/lib/cocoapods/downloader/cache.rb +1 -0
  8. data/lib/cocoapods/gem_version.rb +1 -1
  9. data/lib/cocoapods/generator/acknowledgements/plist.rb +1 -0
  10. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +9 -2
  11. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +5 -4
  12. data/lib/cocoapods/installer.rb +41 -205
  13. data/lib/cocoapods/installer/analyzer.rb +65 -1
  14. data/lib/cocoapods/installer/analyzer/pod_variant.rb +9 -3
  15. data/lib/cocoapods/installer/analyzer/target_inspector.rb +24 -0
  16. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +23 -6
  17. data/lib/cocoapods/installer/xcode.rb +7 -0
  18. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +265 -0
  19. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +202 -0
  20. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +314 -0
  21. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +397 -0
  22. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +214 -0
  23. data/lib/cocoapods/resolver.rb +1 -2
  24. data/lib/cocoapods/target/aggregate_target.rb +19 -0
  25. data/lib/cocoapods/target/pod_target.rb +15 -2
  26. data/lib/cocoapods/user_interface.rb +6 -1
  27. data/lib/cocoapods/user_interface/error_report.rb +7 -0
  28. data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
  29. data/lib/cocoapods/validator.rb +15 -7
  30. metadata +42 -19
  31. data/lib/cocoapods/installer/file_references_installer.rb +0 -310
  32. data/lib/cocoapods/installer/target_installer.rb +0 -210
  33. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -191
  34. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -389
@@ -389,7 +389,6 @@ module Pod
389
389
  error.conflicts.each do |name, conflict|
390
390
  local_pod_parent = conflict.requirement_trees.flatten.reverse.find(&:local?)
391
391
  lockfile_reqs = conflict.requirements[name_for_locking_dependency_source]
392
-
393
392
  if lockfile_reqs && lockfile_reqs.last && lockfile_reqs.last.prerelease? && !conflict.existing
394
393
  message = 'Due to the previous naïve CocoaPods resolver, ' \
395
394
  "you were using a pre-release version of `#{name}`, " \
@@ -398,7 +397,7 @@ module Pod
398
397
  'version requirement to your Podfile ' \
399
398
  "(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \
400
399
  "or revert to a stable version by running `pod update #{name}`."
401
- elsif local_pod_parent && !specifications_for_dependency(conflict.requirement).empty?
400
+ elsif local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? && !conflict.possibility
402
401
  # Conflict was caused by a requirement from a local dependency.
403
402
  # Tell user to use `pod update`.
404
403
  message << "\n\nIt seems like you've changed the constraints of dependency `#{name}` " \
@@ -7,6 +7,9 @@ module Pod
7
7
  # generated this target.
8
8
  attr_reader :target_definition
9
9
 
10
+ # Product types where the product's frameworks must be embedded in a host target
11
+ EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :messages_extension, :watch_extension].freeze
12
+
10
13
  # Initialize a new instance
11
14
  #
12
15
  # @param [TargetDefinition] target_definition @see target_definition
@@ -23,6 +26,22 @@ module Pod
23
26
  @xcconfigs = {}
24
27
  end
25
28
 
29
+ # @return [Boolean] True if the user_target's pods are
30
+ # for an extension and must be embedded in a host,
31
+ # target, otherwise false.
32
+ #
33
+ def requires_host_target?
34
+ # If we don't have a user_project, then we can't
35
+ # glean any info about how this target is going to
36
+ # be integrated, so return false since we can't know
37
+ # for sure that this target refers to an extension
38
+ # target that would require a host target
39
+ return false if user_project.nil?
40
+ symbol_types = user_targets.map(&:symbol_type).uniq
41
+ raise ArgumentError, "Expected single kind of user_target for #{name}. Found #{symbol_types.join(', ')}." unless symbol_types.count == 1
42
+ EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? symbol_types[0]
43
+ end
44
+
26
45
  # @return [String] the label for the target.
27
46
  #
28
47
  def label
@@ -65,6 +65,7 @@ module Pod
65
65
  target.native_target = native_target
66
66
  target.archs = archs
67
67
  target.dependent_targets = dependent_targets.flat_map { |pt| pt.scoped(cache) }.select { |pt| pt.target_definitions == [target_definition] }
68
+ target.host_requires_frameworks = host_requires_frameworks
68
69
  cache[cache_key] = target
69
70
  end
70
71
  end
@@ -80,6 +81,12 @@ module Pod
80
81
  end
81
82
  end
82
83
 
84
+ # @return [String] the Swift version for the target.
85
+ #
86
+ def swift_version
87
+ target_definitions.map(&:swift_version).compact.uniq.first
88
+ end
89
+
83
90
  # @note The deployment target for the pod target is the maximum of all
84
91
  # the deployment targets for the current platform of the target
85
92
  # (or the minimum required to support the current installation
@@ -188,8 +195,14 @@ module Pod
188
195
  # dependency upon.
189
196
  #
190
197
  def recursive_dependent_targets
191
- targets = dependent_targets + dependent_targets.flat_map(&:recursive_dependent_targets)
192
- targets.uniq!
198
+ targets = dependent_targets.clone
199
+
200
+ targets.each do |target|
201
+ target.dependent_targets.each do |t|
202
+ targets.push(t) unless t == self || targets.include?(t)
203
+ end
204
+ end
205
+
193
206
  targets
194
207
  end
195
208
 
@@ -1,4 +1,5 @@
1
1
  require 'cocoapods/user_interface/error_report'
2
+ require 'cocoapods/user_interface/inspector_reporter'
2
3
 
3
4
  module Pod
4
5
  # Provides support for UI output. It provides support for nested sections of
@@ -184,7 +185,11 @@ module Pod
184
185
  if pathname
185
186
  from_path = config.podfile_path.dirname if config.podfile_path
186
187
  from_path ||= Pathname.pwd
187
- path = Pathname(pathname).relative_path_from(from_path)
188
+ path = begin
189
+ Pathname(pathname).relative_path_from(from_path)
190
+ rescue
191
+ pathname
192
+ end
188
193
  "`#{path}`"
189
194
  else
190
195
  ''
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rbconfig'
4
4
  require 'cgi'
5
+ require 'gh_inspector'
5
6
 
6
7
  module Pod
7
8
  module UserInterface
@@ -112,6 +113,12 @@ EOS
112
113
  EOS
113
114
  end
114
115
 
116
+ def search_for_exceptions(exception)
117
+ inspector = GhInspector::Inspector.new 'cocoapods', 'cocoapods'
118
+ message_delegate = UserInterface::InspectorReporter.new
119
+ inspector.search_exception exception, message_delegate
120
+ end
121
+
115
122
  private
116
123
 
117
124
  def `(other)
@@ -0,0 +1,109 @@
1
+ require 'uri'
2
+
3
+ module Pod
4
+ module UserInterface
5
+ # Redirects GH-issues delegate callbacks to CocoaPods UI methods.
6
+ #
7
+ class InspectorReporter
8
+ # Called just as the investigation has begun.
9
+ # Lets the user know that it's looking for an issue.
10
+ #
11
+ # @param [query] String unused
12
+ #
13
+ # @param [GhInspector::Inspector] inspector
14
+ # The current inspector
15
+ #
16
+ # @return [void]
17
+ #
18
+ def inspector_started_query(_, inspector)
19
+ UI.puts "Looking for related issues on #{inspector.repo_owner}/#{inspector.repo_name}..."
20
+ end
21
+
22
+ # Called once the inspector has recieved a report with more than one issue,
23
+ # showing the top 3 issues, and offering a link to see more.
24
+ #
25
+ # @param [GhInspector::InspectionReport] report
26
+ # Report a list of the issues
27
+ #
28
+ # @param [GhInspector::Inspector] inspector
29
+ # The current inspector
30
+ #
31
+ # @return [void]
32
+ #
33
+ def inspector_successfully_recieved_report(report, _)
34
+ report.issues[0..2].each { |issue| print_issue_full(issue) }
35
+
36
+ if report.issues.count > 3
37
+ UI.puts "and #{report.total_results - 3} more at:"
38
+ UI.puts report.url
39
+ end
40
+ end
41
+
42
+ # Called once the report has been recieved, but when there are no issues found.
43
+ #
44
+ # @param [GhInspector::InspectionReport] report
45
+ # An empty report
46
+ #
47
+ # @param [GhInspector::Inspector] inspector
48
+ # The current inspector
49
+ #
50
+ # @return [void]
51
+ #
52
+ def inspector_recieved_empty_report(_, inspector)
53
+ UI.puts 'Found no similar issues. To create a new issue, please visit:'
54
+ UI.puts "https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new"
55
+ end
56
+
57
+ # Called when there have been networking issues in creating the report.
58
+ #
59
+ # @param [Error] error
60
+ # The error returned during networking
61
+ #
62
+ # @param [String] query
63
+ # The original search query
64
+ #
65
+ # @param [GhInspector::Inspector] inspector
66
+ # The current inspector
67
+ #
68
+ # @return [void]
69
+ #
70
+ def inspector_could_not_create_report(error, query, inspector)
71
+ safe_query = URI.escape query
72
+ UI.puts 'Could not access the GitHub API, you may have better luck via the website.'
73
+ UI.puts "https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/search?q=#{safe_query}&type=Issues&utf8=✓"
74
+ UI.puts "Error: #{error.name}"
75
+ end
76
+
77
+ private
78
+
79
+ def print_issue_full(issue)
80
+ safe_url = URI.escape issue.html_url
81
+ UI.puts " - #{issue.title}"
82
+ UI.puts " #{safe_url} [#{issue.state}] [#{issue.comments} comment#{issue.comments == 1 ? '' : 's'}]"
83
+ UI.puts " #{pretty_date(issue.updated_at)}"
84
+ UI.puts ''
85
+ end
86
+
87
+ # Taken from http://stackoverflow.com/questions/195740/how-do-you-do-relative-time-in-rails
88
+ def pretty_date(date_string)
89
+ date = Time.parse(date_string)
90
+ a = (Time.now - date).to_i
91
+
92
+ case a
93
+ when 0 then 'just now'
94
+ when 1 then 'a second ago'
95
+ when 2..59 then a.to_s + ' seconds ago'
96
+ when 60..119 then 'a minute ago' # 120 = 2 minutes
97
+ when 120..3540 then (a / 60).to_i.to_s + ' minutes ago'
98
+ when 3541..7100 then 'an hour ago' # 3600 = 1 hour
99
+ when 7101..82_800 then ((a + 99) / 3600).to_i.to_s + ' hours ago'
100
+ when 82_801..172_000 then 'a day ago' # 86400 = 1 day
101
+ when 172_001..518_400 then ((a + 800) / (60 * 60 * 24)).to_i.to_s + ' days ago'
102
+ when 518_400..1_036_800 then 'a week ago'
103
+ when 1_036_801..4_147_204 then ((a + 180_000) / (60 * 60 * 24 * 7)).to_i.to_s + ' weeks ago'
104
+ else date.strftime('%d %b %Y')
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -1,8 +1,6 @@
1
1
  require 'active_support/core_ext/array'
2
2
  require 'active_support/core_ext/string/inflections'
3
3
 
4
- autoload :Fourflusher, 'fourflusher'
5
-
6
4
  module Pod
7
5
  # Validates a Specification.
8
6
  #
@@ -388,10 +386,19 @@ module Pod
388
386
 
389
387
  source_file = write_app_import_source_file(pod_target)
390
388
  source_file_ref = app_project.new_group('App', 'App').new_file(source_file)
391
- app_project.targets.first.add_file_references([source_file_ref])
389
+ app_target = app_project.targets.first
390
+ app_target.add_file_references([source_file_ref])
391
+ add_xctest(app_target) if @installer.pod_targets.any? { |pt| pt.spec_consumers.any? { |c| c.frameworks.include?('XCTest') } }
392
392
  app_project.save
393
393
  end
394
394
 
395
+ def add_xctest(app_target)
396
+ app_target.build_configurations.each do |configuration|
397
+ search_paths = configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= '$(inherited)'
398
+ search_paths << ' "$(PLATFORM_DIR)/Developer/Library/Frameworks"'
399
+ end
400
+ end
401
+
395
402
  def write_app_import_source_file(pod_target)
396
403
  language = pod_target.uses_swift? ? :swift : :objc
397
404
 
@@ -427,7 +434,7 @@ module Pod
427
434
  # for all available platforms with xcodebuild.
428
435
  #
429
436
  def install_pod
430
- %i(verify_no_duplicate_framework_names
437
+ %i(verify_no_duplicate_framework_and_library_names
431
438
  verify_no_static_framework_transitive_dependencies
432
439
  verify_framework_usage generate_pods_project integrate_user_project
433
440
  perform_post_install_actions).each { |m| @installer.send(m) }
@@ -710,17 +717,18 @@ module Pod
710
717
  # returns its output (both STDOUT and STDERR).
711
718
  #
712
719
  def xcodebuild
720
+ require 'fourflusher'
713
721
  command = %w(clean build -workspace App.xcworkspace -scheme App -configuration Release)
714
722
  case consumer.platform_name
715
723
  when :ios
716
724
  command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
717
- command += Fourflusher::SimControl.new.destination('iPhone 4s', deployment_target)
725
+ command += Fourflusher::SimControl.new.destination(:oldest, 'iOS', deployment_target)
718
726
  when :watchos
719
727
  command += %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator)
720
- command += Fourflusher::SimControl.new.destination('Apple Watch - 38mm', deployment_target)
728
+ command += Fourflusher::SimControl.new.destination(:oldest, 'watchOS', deployment_target)
721
729
  when :tvos
722
730
  command += %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator)
723
- command += Fourflusher::SimControl.new.destination('Apple TV 1080p', deployment_target)
731
+ command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target)
724
732
  end
725
733
 
726
734
  output, status = Dir.chdir(validation_dir) { _xcodebuild(command) }
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: 1.0.1
4
+ version: 1.1.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-06-02 00:00:00.000000000 Z
14
+ date: 2016-07-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cocoapods-core
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.0.1
22
+ version: 1.1.0.beta.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.1
29
+ version: 1.1.0.beta.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: claide
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +73,7 @@ dependencies:
73
73
  requirements:
74
74
  - - '>='
75
75
  - !ruby/object:Gem::Version
76
- version: 1.0.0
76
+ version: 1.1.0
77
77
  - - <
78
78
  - !ruby/object:Gem::Version
79
79
  version: '2.0'
@@ -83,7 +83,7 @@ dependencies:
83
83
  requirements:
84
84
  - - '>='
85
85
  - !ruby/object:Gem::Version
86
- version: 1.0.0
86
+ version: 1.1.0
87
87
  - - <
88
88
  - !ruby/object:Gem::Version
89
89
  version: '2.0'
@@ -173,7 +173,7 @@ dependencies:
173
173
  requirements:
174
174
  - - '>='
175
175
  - !ruby/object:Gem::Version
176
- version: 1.0.0
176
+ version: 1.1.0
177
177
  - - <
178
178
  - !ruby/object:Gem::Version
179
179
  version: '2.0'
@@ -183,7 +183,7 @@ dependencies:
183
183
  requirements:
184
184
  - - '>='
185
185
  - !ruby/object:Gem::Version
186
- version: 1.0.0
186
+ version: 1.1.0
187
187
  - - <
188
188
  - !ruby/object:Gem::Version
189
189
  version: '2.0'
@@ -193,21 +193,21 @@ dependencies:
193
193
  requirements:
194
194
  - - ~>
195
195
  - !ruby/object:Gem::Version
196
- version: 0.4.5
196
+ version: 0.5.0
197
197
  type: :runtime
198
198
  prerelease: false
199
199
  version_requirements: !ruby/object:Gem::Requirement
200
200
  requirements:
201
201
  - - ~>
202
202
  - !ruby/object:Gem::Version
203
- version: 0.4.5
203
+ version: 0.5.0
204
204
  - !ruby/object:Gem::Dependency
205
205
  name: xcodeproj
206
206
  requirement: !ruby/object:Gem::Requirement
207
207
  requirements:
208
208
  - - '>='
209
209
  - !ruby/object:Gem::Version
210
- version: 1.1.0
210
+ version: 1.2.0
211
211
  - - <
212
212
  - !ruby/object:Gem::Version
213
213
  version: '2.0'
@@ -217,7 +217,7 @@ dependencies:
217
217
  requirements:
218
218
  - - '>='
219
219
  - !ruby/object:Gem::Version
220
- version: 1.1.0
220
+ version: 1.2.0
221
221
  - - <
222
222
  - !ruby/object:Gem::Version
223
223
  version: '2.0'
@@ -228,6 +228,9 @@ dependencies:
228
228
  - - '>='
229
229
  - !ruby/object:Gem::Version
230
230
  version: 4.0.2
231
+ - - <
232
+ - !ruby/object:Gem::Version
233
+ version: '5'
231
234
  type: :runtime
232
235
  prerelease: false
233
236
  version_requirements: !ruby/object:Gem::Requirement
@@ -235,6 +238,9 @@ dependencies:
235
238
  - - '>='
236
239
  - !ruby/object:Gem::Version
237
240
  version: 4.0.2
241
+ - - <
242
+ - !ruby/object:Gem::Version
243
+ version: '5'
238
244
  - !ruby/object:Gem::Dependency
239
245
  name: colored
240
246
  requirement: !ruby/object:Gem::Requirement
@@ -269,14 +275,28 @@ dependencies:
269
275
  requirements:
270
276
  - - ~>
271
277
  - !ruby/object:Gem::Version
272
- version: 0.3.0
278
+ version: 1.0.1
273
279
  type: :runtime
274
280
  prerelease: false
275
281
  version_requirements: !ruby/object:Gem::Requirement
276
282
  requirements:
277
283
  - - ~>
278
284
  - !ruby/object:Gem::Version
279
- version: 0.3.0
285
+ version: 1.0.1
286
+ - !ruby/object:Gem::Dependency
287
+ name: gh_inspector
288
+ requirement: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - ~>
291
+ - !ruby/object:Gem::Version
292
+ version: '1.0'
293
+ type: :runtime
294
+ prerelease: false
295
+ version_requirements: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ~>
298
+ - !ruby/object:Gem::Version
299
+ version: '1.0'
280
300
  - !ruby/object:Gem::Dependency
281
301
  name: nap
282
302
  requirement: !ruby/object:Gem::Requirement
@@ -432,7 +452,6 @@ files:
432
452
  - lib/cocoapods/installer/analyzer/specs_state.rb
433
453
  - lib/cocoapods/installer/analyzer/target_inspection_result.rb
434
454
  - lib/cocoapods/installer/analyzer/target_inspector.rb
435
- - lib/cocoapods/installer/file_references_installer.rb
436
455
  - lib/cocoapods/installer/installation_options.rb
437
456
  - lib/cocoapods/installer/migrator.rb
438
457
  - lib/cocoapods/installer/pod_source_installer.rb
@@ -441,12 +460,15 @@ files:
441
460
  - lib/cocoapods/installer/post_install_hooks_context.rb
442
461
  - lib/cocoapods/installer/pre_install_hooks_context.rb
443
462
  - lib/cocoapods/installer/source_provider_hooks_context.rb
444
- - lib/cocoapods/installer/target_installer.rb
445
- - lib/cocoapods/installer/target_installer/aggregate_target_installer.rb
446
- - lib/cocoapods/installer/target_installer/pod_target_installer.rb
447
463
  - lib/cocoapods/installer/user_project_integrator.rb
448
464
  - lib/cocoapods/installer/user_project_integrator/target_integrator.rb
449
465
  - lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb
466
+ - lib/cocoapods/installer/xcode.rb
467
+ - lib/cocoapods/installer/xcode/pods_project_generator.rb
468
+ - lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb
469
+ - lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb
470
+ - lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb
471
+ - lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb
450
472
  - lib/cocoapods/open-uri.rb
451
473
  - lib/cocoapods/project.rb
452
474
  - lib/cocoapods/resolver.rb
@@ -463,6 +485,7 @@ files:
463
485
  - lib/cocoapods/target/pod_target.rb
464
486
  - lib/cocoapods/user_interface.rb
465
487
  - lib/cocoapods/user_interface/error_report.rb
488
+ - lib/cocoapods/user_interface/inspector_reporter.rb
466
489
  - lib/cocoapods/validator.rb
467
490
  homepage: https://github.com/CocoaPods/CocoaPods
468
491
  licenses:
@@ -484,7 +507,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
484
507
  version: '0'
485
508
  requirements: []
486
509
  rubyforge_project:
487
- rubygems_version: 2.6.3
510
+ rubygems_version: 2.6.5
488
511
  signing_key:
489
512
  specification_version: 3
490
513
  summary: The Cocoa library package manager.