cocoapods 0.36.0.beta.1 → 0.36.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -5
  3. data/bin/pod +11 -10
  4. data/bin/sandbox-pod +1 -1
  5. data/lib/cocoapods.rb +1 -1
  6. data/lib/cocoapods/command/lib.rb +0 -1
  7. data/lib/cocoapods/command/outdated.rb +1 -3
  8. data/lib/cocoapods/command/repo.rb +5 -267
  9. data/lib/cocoapods/command/repo/add.rb +53 -0
  10. data/lib/cocoapods/command/repo/lint.rb +73 -0
  11. data/lib/cocoapods/command/repo/list.rb +95 -0
  12. data/lib/cocoapods/command/repo/remove.rb +36 -0
  13. data/lib/cocoapods/command/repo/update.rb +27 -0
  14. data/lib/cocoapods/command/setup.rb +1 -1
  15. data/lib/cocoapods/command/spec.rb +5 -546
  16. data/lib/cocoapods/command/spec/cat.rb +51 -0
  17. data/lib/cocoapods/command/spec/create.rb +279 -0
  18. data/lib/cocoapods/command/spec/edit.rb +87 -0
  19. data/lib/cocoapods/command/spec/lint.rb +105 -0
  20. data/lib/cocoapods/command/spec/which.rb +43 -0
  21. data/lib/cocoapods/downloader.rb +0 -2
  22. data/lib/cocoapods/external_sources/podspec_source.rb +13 -3
  23. data/lib/cocoapods/gem_version.rb +1 -1
  24. data/lib/cocoapods/generator/copy_resources_script.rb +22 -11
  25. data/lib/cocoapods/generator/embed_frameworks_script.rb +3 -0
  26. data/lib/cocoapods/generator/header.rb +3 -3
  27. data/lib/cocoapods/generator/target_environment_header.rb +1 -1
  28. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +7 -7
  29. data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +1 -1
  30. data/lib/cocoapods/hooks_manager.rb +4 -4
  31. data/lib/cocoapods/installer.rb +17 -4
  32. data/lib/cocoapods/installer/analyzer.rb +19 -12
  33. data/lib/cocoapods/installer/pod_source_installer.rb +1 -1
  34. data/lib/cocoapods/installer/target_installer.rb +1 -1
  35. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +9 -8
  36. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +2 -2
  37. data/lib/cocoapods/sandbox.rb +0 -2
  38. data/lib/cocoapods/sandbox/headers_store.rb +1 -1
  39. data/lib/cocoapods/sources_manager.rb +8 -7
  40. data/lib/cocoapods/target.rb +1 -1
  41. data/lib/cocoapods/target/aggregate_target.rb +1 -0
  42. data/lib/cocoapods/target/pod_target.rb +1 -1
  43. data/lib/cocoapods/user_interface/error_report.rb +10 -0
  44. data/lib/cocoapods/validator.rb +15 -4
  45. metadata +17 -6
@@ -0,0 +1,43 @@
1
+ module Pod
2
+ class Command
3
+ class Spec < Command
4
+ class Which < Spec
5
+ self.summary = 'Prints the path of the given spec.'
6
+
7
+ self.description = <<-DESC
8
+ Prints the path of the .podspec file(s) whose name matches `QUERY`
9
+ DESC
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('QUERY', false),
13
+ ]
14
+
15
+ def self.options
16
+ [
17
+ ['--regex', 'Interpret the `QUERY` as a regular expression'],
18
+ ['--show-all', 'Print all versions of the given podspec'],
19
+ ].concat(super)
20
+ end
21
+
22
+ def initialize(argv)
23
+ @use_regex = argv.flag?('regex')
24
+ @show_all = argv.flag?('show-all')
25
+ @query = argv.shift_argument
26
+ @query = @query.gsub('.podspec', '') unless @query.nil?
27
+ super
28
+ end
29
+
30
+ def validate!
31
+ super
32
+ help! 'A podspec name is required.' unless @query
33
+ validate_regex!(@query) if @use_regex
34
+ end
35
+
36
+ def run
37
+ query = @use_regex ? @query : Regexp.escape(@query)
38
+ UI.puts get_path_of_spec(query, @show_all)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -7,7 +7,6 @@ module Pod
7
7
 
8
8
  class Base
9
9
  override_api do
10
-
11
10
  def execute_command(executable, command, raise_on_failure = false)
12
11
  Executable.execute_command(executable, command, raise_on_failure)
13
12
  rescue CLAide::InformativeError => e
@@ -56,7 +55,6 @@ module Pod
56
55
  def ui_message(message)
57
56
  UI.puts message
58
57
  end
59
-
60
58
  end
61
59
  end
62
60
  end
@@ -9,9 +9,19 @@ module Pod
9
9
  def fetch(sandbox)
10
10
  title = "Fetching podspec for `#{name}` #{description}"
11
11
  UI.titled_section(title, :verbose_prefix => '-> ') do
12
- is_json = podspec_uri.split('.').last == 'json'
13
- require 'open-uri'
14
- open(podspec_uri) { |io| store_podspec(sandbox, io.read, is_json) }
12
+ podspec_path = Pathname(podspec_uri)
13
+ is_json = podspec_path.extname == '.json'
14
+ if podspec_path.exist?
15
+ store_podspec(sandbox, podspec_path, is_json)
16
+ else
17
+ require 'open-uri'
18
+ begin
19
+ open(podspec_uri) { |io| store_podspec(sandbox, io.read, is_json) }
20
+ rescue OpenURI::HTTPError => e
21
+ status = e.io.status.join(' ')
22
+ raise Informative, "Failed to fetch podspec for `#{name}` at `#{podspec_uri}`.\n Error: #{status}"
23
+ end
24
+ end
15
25
  end
16
26
  end
17
27
 
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods command line tool.
3
3
  #
4
- VERSION = '0.36.0.beta.1' unless defined? Pod::VERSION
4
+ VERSION = '0.36.0.beta.2' unless defined? Pod::VERSION
5
5
  end
@@ -1,21 +1,22 @@
1
1
  module Pod
2
2
  module Generator
3
3
  class CopyResourcesScript
4
- # @return [Array<#to_s>] A list of files relative to the project pods
5
- # root.
4
+ # @return [Hash{String, Array{String}] A list of files relative to the
5
+ # project pods root, keyed by build configuration.
6
6
  #
7
- attr_reader :resources
7
+ attr_reader :resources_by_config
8
8
 
9
9
  # @return [Platform] The platform of the library for which the copy
10
10
  # resources script is needed.
11
11
  #
12
12
  attr_reader :platform
13
13
 
14
- # @param [Array<#to_s>] resources @see resources
14
+ # @param [Hash{String, Array{String}]
15
+ # resources_by_config @see resources_by_config
15
16
  # @param [Platform] platform @see platform
16
17
  #
17
- def initialize(resources, platform)
18
- @resources = resources
18
+ def initialize(resources_by_config, platform)
19
+ @resources_by_config = resources_by_config
19
20
  @platform = platform
20
21
  end
21
22
 
@@ -58,25 +59,35 @@ module Pod
58
59
  #
59
60
  def install_resources_function
60
61
  if use_external_strings_file?
61
- INSTALL_RESOURCES_FUCTION
62
+ INSTALL_RESOURCES_FUNCTION
62
63
  else
63
- INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '')
64
+ INSTALL_RESOURCES_FUNCTION.gsub(' --reference-external-strings-file', '')
64
65
  end
65
66
  end
66
67
 
67
68
  # @return [String] The contents of the copy resources script.
68
69
  #
69
70
  def script
71
+ # Define install function
70
72
  script = install_resources_function
71
- resources.each do |resource|
72
- script += %( install_resource "#{resource}"\n )
73
+
74
+ # Call function for each configuration-dependent resource
75
+ resources_by_config.each do |config, resources|
76
+ unless resources.empty?
77
+ script += %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
78
+ resources.each do |resource|
79
+ script += " install_resource '#{resource}'\n"
80
+ end
81
+ script += "fi\n"
82
+ end
73
83
  end
84
+
74
85
  script += RSYNC_CALL
75
86
  script += XCASSETS_COMPILE
76
87
  script
77
88
  end
78
89
 
79
- INSTALL_RESOURCES_FUCTION = <<EOS
90
+ INSTALL_RESOURCES_FUNCTION = <<EOS
80
91
  #!/bin/sh
81
92
  set -e
82
93
 
@@ -78,6 +78,9 @@ module Pod
78
78
  for lib in $swift_runtime_libs; do
79
79
  echo "rsync -av \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
80
80
  rsync -av "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
81
+ if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then
82
+ code_sign "${destination}/${lib}"
83
+ fi
81
84
  done
82
85
  }
83
86
 
@@ -37,18 +37,18 @@ module Pod
37
37
  # @return [String]
38
38
  #
39
39
  def generate
40
- result = ""
40
+ result = ''
41
41
  result << generate_platform_import_header
42
42
 
43
43
  result << "\n"
44
44
 
45
45
  imports.each do |import|
46
- result << %|#import "#{import}"\n|
46
+ result << %(#import "#{import}"\n)
47
47
  end
48
48
 
49
49
  unless module_imports.empty?
50
50
  module_imports.each do |import|
51
- result << %|\n@import #{import}|
51
+ result << %(\n@import #{import})
52
52
  end
53
53
  result << "\n"
54
54
  end
@@ -74,7 +74,7 @@ module Pod
74
74
  def common_specs(specs_by_configuration)
75
75
  result = specs_by_configuration.values.flatten.uniq
76
76
  specs_by_configuration.values.each do |configuration_specs|
77
- result = result & configuration_specs
77
+ result &= configuration_specs
78
78
  end
79
79
  result.sort_by(&:name)
80
80
  end
@@ -49,7 +49,7 @@ module Pod
49
49
  def generate
50
50
  pod_targets = target.pod_targets_for_build_configuration(@configuration_name)
51
51
  config = {
52
- 'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
52
+ 'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target),
53
53
  'OTHER_LIBTOOLFLAGS' => '$(OTHER_LDFLAGS)',
54
54
  'PODS_ROOT' => target.relative_pods_root,
55
55
  'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
@@ -62,7 +62,7 @@ module Pod
62
62
  'PODS_FRAMEWORK_BUILD_PATH' => target.configuration_build_dir,
63
63
  'FRAMEWORK_SEARCH_PATHS' => '"$PODS_FRAMEWORK_BUILD_PATH"',
64
64
  # Make headers discoverable by `import "…"`
65
- 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-iquote')
65
+ 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-iquote'),
66
66
  }
67
67
  config.merge!(build_settings)
68
68
  else
@@ -70,9 +70,9 @@ module Pod
70
70
  header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
71
71
  build_settings = {
72
72
  # by `#import "…"`
73
- 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(header_search_paths),
73
+ 'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths),
74
74
  # by `#import <…>`
75
- 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem')
75
+ 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem'),
76
76
  }
77
77
  config.merge!(build_settings)
78
78
  end
@@ -101,7 +101,7 @@ module Pod
101
101
  end
102
102
  end
103
103
 
104
- # TODO Need to decide how we are going to ensure settings like these
104
+ # TODO: Need to decide how we are going to ensure settings like these
105
105
  # are always excluded from the user's project.
106
106
  #
107
107
  # See https://github.com/CocoaPods/CocoaPods/issues/1216
@@ -125,7 +125,7 @@ module Pod
125
125
  else
126
126
  ld_runpath_search_paths << [
127
127
  "'@executable_path/Frameworks'",
128
- "'@loader_path/Frameworks'"
128
+ "'@loader_path/Frameworks'",
129
129
  ]
130
130
  end
131
131
  @xcconfig.merge!('LD_RUNPATH_SEARCH_PATHS' => ld_runpath_search_paths.join(' '))
@@ -133,6 +133,6 @@ module Pod
133
133
 
134
134
  #---------------------------------------------------------------------#
135
135
  end
136
+ end
136
137
  end
137
138
  end
138
- end
@@ -46,6 +46,6 @@ module Pod
46
46
 
47
47
  #-----------------------------------------------------------------------#
48
48
  end
49
+ end
49
50
  end
50
51
  end
51
- end
@@ -20,12 +20,12 @@ module Pod
20
20
  #
21
21
  class Hook
22
22
  # @return [String]
23
- # The name of the hook's notification.
23
+ # The name of the plugin that registered the hook.
24
24
  #
25
25
  attr_reader :plugin_name
26
26
 
27
27
  # @return [String]
28
- # The name of the plugin the hook came from.
28
+ # The name of the hook.
29
29
  #
30
30
  attr_reader :name
31
31
 
@@ -54,8 +54,8 @@ module Pod
54
54
  end
55
55
 
56
56
  class << self
57
- # @return [Hash{Symbol => Array<Proc>}] The list of the blocks that are
58
- # registered for each notification name.
57
+ # @return [Hash{Symbol => Array<Hook>}] The list of the hooks that are
58
+ # registered for each hook name.
59
59
  #
60
60
  attr_reader :registrations
61
61
 
@@ -446,8 +446,7 @@ module Pod
446
446
  target_installer.install!
447
447
  end
448
448
 
449
- # TODO
450
- # Move and add specs
449
+ # TODO: Move and add specs
451
450
  pod_targets.sort_by(&:name).each do |pod_target|
452
451
  pod_target.file_accessors.each do |file_accessor|
453
452
  file_accessor.spec_consumer.frameworks.each do |framework|
@@ -468,6 +467,9 @@ module Pod
468
467
  def set_target_dependencies
469
468
  frameworks_group = pods_project.frameworks_group
470
469
  aggregate_targets.each do |aggregate_target|
470
+ is_app_extension = aggregate_target.user_targets.map(&:symbol_type).include?(:app_extension)
471
+ configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
472
+
471
473
  aggregate_target.pod_targets.each do |pod_target|
472
474
  unless pod_target.should_build?
473
475
  pod_target.resource_bundle_targets.each do |resource_bundle_target|
@@ -478,17 +480,19 @@ module Pod
478
480
  end
479
481
 
480
482
  aggregate_target.native_target.add_dependency(pod_target.native_target)
481
- pod_target.dependencies.each do |dep|
483
+ configure_app_extension_api_only_for_target(pod_target) if is_app_extension
482
484
 
485
+ pod_target.dependencies.each do |dep|
483
486
  unless dep == pod_target.pod_name
484
487
  pod_dependency_target = aggregate_target.pod_targets.find { |target| target.pod_name == dep }
485
- # TODO remove me
488
+ # TODO: remove me
486
489
  unless pod_dependency_target
487
490
  puts "[BUG] DEP: #{dep}"
488
491
  end
489
492
 
490
493
  next unless pod_dependency_target.should_build?
491
494
  pod_target.native_target.add_dependency(pod_dependency_target.native_target)
495
+ configure_app_extension_api_only_for_target(pod_dependency_target) if is_app_extension
492
496
 
493
497
  if pod_target.requires_frameworks?
494
498
  product_ref = frameworks_group.files.find { |f| f.path == pod_dependency_target.product_name } ||
@@ -696,6 +700,15 @@ module Pod
696
700
  analysis_result.sandbox_state
697
701
  end
698
702
 
703
+ # Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
704
+ # configurations of the given target
705
+ #
706
+ def configure_app_extension_api_only_for_target(target)
707
+ target.native_target.build_configurations.each do |config|
708
+ config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
709
+ end
710
+ end
711
+
699
712
  #-------------------------------------------------------------------------#
700
713
  end
701
714
  end
@@ -101,7 +101,7 @@ module Pod
101
101
  # change in the Podfile should be locked.
102
102
  #
103
103
  def update_mode?
104
- !!update
104
+ update != nil
105
105
  end
106
106
 
107
107
  # @return [Symbol] Whether and how the dependencies in the Podfile
@@ -163,12 +163,18 @@ module Pod
163
163
  end
164
164
  end
165
165
 
166
- # Updates the source repositories unless the config indicates to skip it.
166
+ # Updates the git source repositories unless the config indicates to skip it.
167
167
  #
168
168
  def update_repositories_if_needed
169
169
  unless config.skip_repo_update?
170
170
  UI.section 'Updating spec repositories' do
171
- sources.each { |source| SourcesManager.update(source.name) }
171
+ sources.each do |source|
172
+ if SourcesManager.git_repo?(source.repo)
173
+ SourcesManager.update(source.name)
174
+ else
175
+ UI.message "Skipping `#{source.name}` update because the repository is not a git source repository."
176
+ end
177
+ end
172
178
  end
173
179
  end
174
180
  end
@@ -306,7 +312,7 @@ module Pod
306
312
  #
307
313
  # @return [void]
308
314
  #
309
- # TODO Specs
315
+ # TODO: Specs
310
316
  #
311
317
  def fetch_external_sources
312
318
  return unless allow_pre_downloads?
@@ -325,7 +331,7 @@ module Pod
325
331
  deps_with_different_sources = podfile.dependencies.group_by(&:root_name).
326
332
  select { |_root_name, dependencies| dependencies.map(&:external_source).uniq.count > 1 }
327
333
  deps_with_different_sources.each do |root_name, dependencies|
328
- raise Informative, "There are multiple dependencies with different " \
334
+ raise Informative, 'There are multiple dependencies with different ' \
329
335
  "sources for `#{root_name}` in #{UI.path podfile.defined_in_file}:" \
330
336
  "\n\n- #{dependencies.map(&:to_s).join("\n- ")}"
331
337
  end
@@ -344,7 +350,6 @@ module Pod
344
350
  def dependencies_to_fetch
345
351
  @deps_to_fetch ||= begin
346
352
  deps_to_fetch = []
347
- deps_to_fetch_if_needed = []
348
353
  deps_with_external_source = podfile.dependencies.select(&:external_source)
349
354
 
350
355
  if update_mode == :all
@@ -466,7 +471,8 @@ module Pod
466
471
 
467
472
  # Returns the sources used to query for specifications
468
473
  #
469
- # When no explicit Podfile sources are defined, this defaults to all
474
+ # When no explicit Podfile sources are defined, this defaults to the
475
+ # master spec repository.
470
476
  # available sources ({SourcesManager.all}).
471
477
  #
472
478
  # @return [Array<Source>] the sources to be used in finding
@@ -476,10 +482,11 @@ module Pod
476
482
  @sources ||= begin
477
483
  sources = podfile.sources
478
484
  if sources.empty?
479
- SourcesManager.all
485
+ url = 'https://github.com/CocoaPods/Specs.git'
486
+ [SourcesManager.find_or_create_source_with_url(url)]
480
487
  else
481
- sources.map do |url|
482
- SourcesManager.find_or_create_source_with_url(url)
488
+ sources.map do |source_url|
489
+ SourcesManager.find_or_create_source_with_url(source_url)
483
490
  end
484
491
  end
485
492
  end
@@ -647,7 +654,7 @@ module Pod
647
654
  end
648
655
 
649
656
  archs = archs.compact.uniq.sort
650
- UI.message("Using `ARCHS` setting to build architectures of " \
657
+ UI.message('Using `ARCHS` setting to build architectures of ' \
651
658
  "target `#{target_definition.label}`: " \
652
659
  "(`#{archs.join('`, `')}`)")
653
660
  archs.length > 1 ? archs : archs.first
@@ -668,7 +675,7 @@ module Pod
668
675
  project_path = compute_user_project_path(target_definition)
669
676
  user_project = Xcodeproj::Project.open(project_path)
670
677
  targets = compute_user_project_targets(target_definition, user_project)
671
- platform = compute_platform_for_target_definition(target_definition, targets)
678
+ compute_platform_for_target_definition(target_definition, targets)
672
679
  archs = compute_archs_for_target_definition(target_definition, targets)
673
680
  @archs_by_target_def[target_definition] = archs
674
681
  else
@@ -46,7 +46,7 @@ module Pod
46
46
  run_prepare_command
47
47
  rescue Informative
48
48
  raise
49
- rescue Object => e
49
+ rescue Object
50
50
  UI.notice("Error installing #{root_spec.name}")
51
51
  clean!
52
52
  raise