xcocoapods 1.5.3

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 (124) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +6303 -0
  3. data/LICENSE +28 -0
  4. data/README.md +80 -0
  5. data/bin/pod +56 -0
  6. data/bin/sandbox-pod +168 -0
  7. data/lib/cocoapods.rb +73 -0
  8. data/lib/cocoapods/command.rb +175 -0
  9. data/lib/cocoapods/command/cache.rb +28 -0
  10. data/lib/cocoapods/command/cache/clean.rb +90 -0
  11. data/lib/cocoapods/command/cache/list.rb +69 -0
  12. data/lib/cocoapods/command/env.rb +66 -0
  13. data/lib/cocoapods/command/init.rb +128 -0
  14. data/lib/cocoapods/command/install.rb +45 -0
  15. data/lib/cocoapods/command/ipc.rb +19 -0
  16. data/lib/cocoapods/command/ipc/list.rb +40 -0
  17. data/lib/cocoapods/command/ipc/podfile.rb +31 -0
  18. data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
  19. data/lib/cocoapods/command/ipc/repl.rb +51 -0
  20. data/lib/cocoapods/command/ipc/spec.rb +29 -0
  21. data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
  22. data/lib/cocoapods/command/lib.rb +11 -0
  23. data/lib/cocoapods/command/lib/create.rb +105 -0
  24. data/lib/cocoapods/command/lib/lint.rb +121 -0
  25. data/lib/cocoapods/command/list.rb +39 -0
  26. data/lib/cocoapods/command/options/project_directory.rb +36 -0
  27. data/lib/cocoapods/command/options/repo_update.rb +34 -0
  28. data/lib/cocoapods/command/outdated.rb +140 -0
  29. data/lib/cocoapods/command/repo.rb +29 -0
  30. data/lib/cocoapods/command/repo/add.rb +103 -0
  31. data/lib/cocoapods/command/repo/lint.rb +82 -0
  32. data/lib/cocoapods/command/repo/list.rb +93 -0
  33. data/lib/cocoapods/command/repo/push.rb +281 -0
  34. data/lib/cocoapods/command/repo/remove.rb +36 -0
  35. data/lib/cocoapods/command/repo/update.rb +28 -0
  36. data/lib/cocoapods/command/setup.rb +103 -0
  37. data/lib/cocoapods/command/spec.rb +112 -0
  38. data/lib/cocoapods/command/spec/cat.rb +51 -0
  39. data/lib/cocoapods/command/spec/create.rb +283 -0
  40. data/lib/cocoapods/command/spec/edit.rb +87 -0
  41. data/lib/cocoapods/command/spec/env_spec.rb +53 -0
  42. data/lib/cocoapods/command/spec/lint.rb +137 -0
  43. data/lib/cocoapods/command/spec/which.rb +43 -0
  44. data/lib/cocoapods/command/update.rb +101 -0
  45. data/lib/cocoapods/config.rb +347 -0
  46. data/lib/cocoapods/core_overrides.rb +1 -0
  47. data/lib/cocoapods/downloader.rb +190 -0
  48. data/lib/cocoapods/downloader/cache.rb +233 -0
  49. data/lib/cocoapods/downloader/request.rb +86 -0
  50. data/lib/cocoapods/downloader/response.rb +16 -0
  51. data/lib/cocoapods/executable.rb +222 -0
  52. data/lib/cocoapods/external_sources.rb +57 -0
  53. data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
  54. data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
  55. data/lib/cocoapods/external_sources/path_source.rb +55 -0
  56. data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
  57. data/lib/cocoapods/gem_version.rb +5 -0
  58. data/lib/cocoapods/generator/acknowledgements.rb +107 -0
  59. data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
  60. data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
  61. data/lib/cocoapods/generator/app_target_helper.rb +244 -0
  62. data/lib/cocoapods/generator/bridge_support.rb +22 -0
  63. data/lib/cocoapods/generator/constant.rb +19 -0
  64. data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
  65. data/lib/cocoapods/generator/dummy_source.rb +31 -0
  66. data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
  67. data/lib/cocoapods/generator/header.rb +103 -0
  68. data/lib/cocoapods/generator/info_plist_file.rb +116 -0
  69. data/lib/cocoapods/generator/module_map.rb +99 -0
  70. data/lib/cocoapods/generator/prefix_header.rb +60 -0
  71. data/lib/cocoapods/generator/umbrella_header.rb +46 -0
  72. data/lib/cocoapods/hooks_manager.rb +132 -0
  73. data/lib/cocoapods/installer.rb +703 -0
  74. data/lib/cocoapods/installer/analyzer.rb +972 -0
  75. data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
  76. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
  77. data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
  78. data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
  79. data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
  80. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
  81. data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
  82. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
  83. data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
  84. data/lib/cocoapods/installer/installation_options.rb +158 -0
  85. data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
  86. data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
  87. data/lib/cocoapods/installer/podfile_validator.rb +139 -0
  88. data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
  89. data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
  90. data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
  91. data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
  92. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
  93. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
  94. data/lib/cocoapods/installer/xcode.rb +8 -0
  95. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
  96. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
  97. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
  98. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
  99. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
  100. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
  101. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
  102. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
  103. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
  104. data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
  105. data/lib/cocoapods/open-uri.rb +33 -0
  106. data/lib/cocoapods/project.rb +414 -0
  107. data/lib/cocoapods/resolver.rb +585 -0
  108. data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
  109. data/lib/cocoapods/sandbox.rb +404 -0
  110. data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
  111. data/lib/cocoapods/sandbox/headers_store.rb +146 -0
  112. data/lib/cocoapods/sandbox/path_list.rb +220 -0
  113. data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
  114. data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
  115. data/lib/cocoapods/sources_manager.rb +157 -0
  116. data/lib/cocoapods/target.rb +261 -0
  117. data/lib/cocoapods/target/aggregate_target.rb +338 -0
  118. data/lib/cocoapods/target/build_settings.rb +1075 -0
  119. data/lib/cocoapods/target/pod_target.rb +559 -0
  120. data/lib/cocoapods/user_interface.rb +459 -0
  121. data/lib/cocoapods/user_interface/error_report.rb +187 -0
  122. data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
  123. data/lib/cocoapods/validator.rb +981 -0
  124. metadata +533 -0
@@ -0,0 +1,39 @@
1
+ module Pod
2
+ class Command
3
+ class List < Command
4
+ self.summary = 'List pods'
5
+ self.description = 'Lists all available pods.'
6
+
7
+ def self.options
8
+ [
9
+ ['--update', 'Run `pod repo update` before listing'],
10
+ ['--stats', 'Show additional stats (like GitHub watchers and forks)'],
11
+ ].concat(super)
12
+ end
13
+
14
+ def initialize(argv)
15
+ @update = argv.flag?('update')
16
+ @stats = argv.flag?('stats')
17
+ super
18
+ end
19
+
20
+ def run
21
+ update_if_necessary!
22
+
23
+ sets = config.sources_manager.aggregate.all_sets
24
+ sets.each { |set| UI.pod(set, :name_and_version) }
25
+ UI.puts "\n#{sets.count} pods were found"
26
+ end
27
+
28
+ def update_if_necessary!
29
+ if @update && config.verbose?
30
+ UI.section("\nUpdating Spec Repositories\n".yellow) do
31
+ Repo.new(ARGV.new(['update'])).run
32
+ end
33
+ end
34
+ end
35
+
36
+ #-----------------------------------------------------------------------#
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,36 @@
1
+ module Pod
2
+ class Command
3
+ module Options
4
+ # Provides support for commands to take a user-specified `project directory`
5
+ #
6
+ module ProjectDirectory
7
+ module Options
8
+ def options
9
+ [
10
+ ['--project-directory=/project/dir/', 'The path to the root of the project directory'],
11
+ ].concat(super)
12
+ end
13
+ end
14
+
15
+ def self.included(base)
16
+ base.extend(Options)
17
+ end
18
+
19
+ def initialize(argv)
20
+ if project_directory = argv.option('project-directory')
21
+ @project_directory = Pathname.new(project_directory).expand_path
22
+ end
23
+ config.installation_root = @project_directory
24
+ super
25
+ end
26
+
27
+ def validate!
28
+ super
29
+ if @project_directory && !@project_directory.directory?
30
+ raise Informative, "`#{@project_directory}` is not a valid directory."
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,34 @@
1
+ module Pod
2
+ class Command
3
+ module Options
4
+ # Provides support for commands to skip updating the spec repositories.
5
+ #
6
+ module RepoUpdate
7
+ module Options
8
+ def options
9
+ [
10
+ ['--no-repo-update', 'Skip running `pod repo update` before install'],
11
+ ].concat(super)
12
+ end
13
+ end
14
+
15
+ def self.included(base)
16
+ base.extend(Options)
17
+ end
18
+
19
+ def repo_update?(default: false)
20
+ if @repo_update.nil?
21
+ default
22
+ else
23
+ @repo_update
24
+ end
25
+ end
26
+
27
+ def initialize(argv)
28
+ @repo_update = argv.flag?('repo-update')
29
+ super
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,140 @@
1
+ module Pod
2
+ class Command
3
+ class Outdated < Command
4
+ include RepoUpdate
5
+ include ProjectDirectory
6
+
7
+ self.summary = 'Show outdated project dependencies'
8
+
9
+ self.description = <<-DESC
10
+ Shows the outdated pods in the current Podfile.lock, but only those from
11
+ spec repos, not those from local/external sources.
12
+ DESC
13
+
14
+ # Run the command
15
+ #
16
+ def run
17
+ if updates.empty?
18
+ UI.puts 'No pod updates are available.'.yellow
19
+ else
20
+ UI.section 'The color indicates what happens when you run `pod update`' do
21
+ UI.puts "#{'<green>'.green}\t - Will be updated to the newest version"
22
+ UI.puts "#{'<blue>'.blue}\t - Will be updated, but not to the newest version because of specified version in Podfile"
23
+ UI.puts "#{'<red>'.red}\t - Will not be updated because of specified version in Podfile"
24
+ UI.puts ''
25
+ end
26
+ UI.section 'The following pod updates are available:' do
27
+ updates.each do |(name, from_version, matching_version, to_version)|
28
+ color = :blue
29
+ if matching_version == to_version
30
+ color = :green
31
+ elsif from_version == matching_version
32
+ color = :red
33
+ end
34
+ # For the specs, its necessary that to_s is called here even though it is redundant
35
+ # https://github.com/CocoaPods/CocoaPods/pull/7204#issuecomment-342512015
36
+ UI.puts "- #{name} #{from_version.to_s.send(color)} -> #{matching_version.to_s.send(color)} " \
37
+ "(latest version #{to_version.to_s})" # rubocop:disable Lint/StringConversionInInterpolation
38
+ end
39
+ end
40
+ end
41
+
42
+ if deprecated_pods.any?
43
+ UI.section 'The following pods are deprecated:' do
44
+ deprecated_pods.each do |spec|
45
+ if spec.deprecated_in_favor_of
46
+ UI.puts "- #{spec.name}" \
47
+ " (in favor of #{spec.deprecated_in_favor_of})"
48
+ else
49
+ UI.puts "- #{spec.name}"
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ def analyzer
59
+ @analyzer ||= begin
60
+ verify_podfile_exists!
61
+ Installer::Analyzer.new(config.sandbox, config.podfile, config.lockfile)
62
+ end
63
+ end
64
+
65
+ def updates
66
+ @updates ||= begin
67
+ ensure_external_podspecs_present!
68
+ spec_sets.map do |set|
69
+ spec = set.specification
70
+ source_version = set.versions.first
71
+ pod_name = spec.root.name
72
+ lockfile_version = lockfile.version(pod_name)
73
+ if source_version > lockfile_version
74
+ matching_spec = unlocked_pods.find { |s| s.name == pod_name }
75
+ matching_version =
76
+ matching_spec ? matching_spec.version : '(unused)'
77
+ [pod_name, lockfile_version, matching_version, source_version]
78
+ end
79
+ end.compact.uniq
80
+ end
81
+ end
82
+
83
+ def unlocked_pods
84
+ @unlocked_pods ||= begin
85
+ pods = []
86
+ UI.titled_section('Analyzing dependencies') do
87
+ pods = Installer::Analyzer.new(config.sandbox, config.podfile).
88
+ analyze(false).
89
+ specs_by_target.values.flatten.uniq
90
+ end
91
+ pods
92
+ end
93
+ end
94
+
95
+ def deprecated_pods
96
+ @deprecated_pods ||= begin
97
+ spec_sets.map(&:specification).select do |spec|
98
+ spec.deprecated || spec.deprecated_in_favor_of
99
+ end.compact.uniq
100
+ end
101
+ end
102
+
103
+ def spec_sets
104
+ @spec_sets ||= begin
105
+ analyzer.send(:update_repositories) if repo_update?(:default => true)
106
+ aggregate = Source::Aggregate.new(analyzer.sources)
107
+ installed_pods.map do |pod_name|
108
+ aggregate.search(Dependency.new(pod_name))
109
+ end.compact.uniq
110
+ end
111
+ end
112
+
113
+ def installed_pods
114
+ @installed_pods ||= begin
115
+ verify_podfile_exists!
116
+
117
+ lockfile.pod_names
118
+ end
119
+ end
120
+
121
+ def lockfile
122
+ @lockfile ||= begin
123
+ verify_lockfile_exists!
124
+ config.lockfile
125
+ end
126
+ end
127
+
128
+ def ensure_external_podspecs_present!
129
+ return unless config.podfile
130
+ config.podfile.dependencies.each do |dep|
131
+ next if dep.external_source.nil?
132
+ unless config.sandbox.specification(dep.root_name)
133
+ raise Informative, 'You must run `pod install` first to ensure that the ' \
134
+ "podspec for `#{dep.root_name}` has been fetched."
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,29 @@
1
+ require 'fileutils'
2
+ require 'cocoapods/command/repo/add'
3
+ require 'cocoapods/command/repo/lint'
4
+ require 'cocoapods/command/repo/list'
5
+ require 'cocoapods/command/repo/push'
6
+ require 'cocoapods/command/repo/remove'
7
+ require 'cocoapods/command/repo/update'
8
+
9
+ module Pod
10
+ class Command
11
+ class Repo < Command
12
+ self.abstract_command = true
13
+
14
+ # @todo should not show a usage banner!
15
+ #
16
+ self.summary = 'Manage spec-repositories'
17
+ self.default_subcommand = 'list'
18
+
19
+ #-----------------------------------------------------------------------#
20
+
21
+ extend Executable
22
+ executable :git
23
+
24
+ def dir
25
+ config.repos_dir + @name
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,103 @@
1
+ module Pod
2
+ class Command
3
+ class Repo < Command
4
+ class Add < Repo
5
+ self.summary = 'Add a spec repo'
6
+
7
+ self.description = <<-DESC
8
+ Clones `URL` in the local spec-repos directory at `#{Config.instance.repos_dir}`. The
9
+ remote can later be referred to by `NAME`.
10
+ DESC
11
+
12
+ self.arguments = [
13
+ CLAide::Argument.new('NAME', true),
14
+ CLAide::Argument.new('URL', true),
15
+ CLAide::Argument.new('BRANCH', false),
16
+ ]
17
+
18
+ def self.options
19
+ [
20
+ ['--progress', 'Show the progress of cloning the spec repository'],
21
+ ].concat(super)
22
+ end
23
+
24
+ def initialize(argv)
25
+ @name = argv.shift_argument
26
+ @url = argv.shift_argument
27
+ @branch = argv.shift_argument
28
+ @progress = argv.flag?('progress')
29
+ super
30
+ end
31
+
32
+ def validate!
33
+ super
34
+ unless @name && @url
35
+ help! 'Adding a repo needs a `NAME` and a `URL`.'
36
+ end
37
+ if @name == 'master' || @url =~ %r{github.com[:/]+cocoapods/specs}i
38
+ raise Informative,
39
+ 'To setup the master specs repo, please run `pod setup`.'
40
+ end
41
+ end
42
+
43
+ def run
44
+ section = "Cloning spec repo `#{@name}` from `#{@url}`"
45
+ section << " (branch `#{@branch}`)" if @branch
46
+ UI.section(section) do
47
+ create_repos_dir
48
+ clone_repo
49
+ checkout_branch
50
+ config.sources_manager.sources([dir.basename.to_s]).each(&:verify_compatibility!)
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ # Creates the repos directory specified in the configuration by
57
+ # `config.repos_dir`.
58
+ #
59
+ # @return [void]
60
+ #
61
+ # @raise If the directory cannot be created due to a system error.
62
+ #
63
+ def create_repos_dir
64
+ config.repos_dir.mkpath
65
+ rescue => e
66
+ raise Informative, "Could not create '#{config.repos_dir}', the CocoaPods repo cache directory.\n" \
67
+ "#{e.class.name}: #{e.message}"
68
+ end
69
+
70
+ # Clones the git spec-repo according to parameters passed to the
71
+ # command.
72
+ #
73
+ # @return [void]
74
+ #
75
+ def clone_repo
76
+ changes = if @progress
77
+ { :verbose => true }
78
+ else
79
+ {}
80
+ end
81
+
82
+ config.with_changes(changes) do
83
+ Dir.chdir(config.repos_dir) do
84
+ command = ['clone', @url, @name]
85
+ if @progress
86
+ command << '--progress'
87
+ end
88
+ git!(command)
89
+ end
90
+ end
91
+ end
92
+
93
+ # Checks out the branch of the git spec-repo if provided.
94
+ #
95
+ # @return [void]
96
+ #
97
+ def checkout_branch
98
+ Dir.chdir(dir) { git!('checkout', @branch) } if @branch
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,82 @@
1
+ module Pod
2
+ class Command
3
+ class Repo < Command
4
+ class Lint < Repo
5
+ self.summary = 'Validates all specs in a repo'
6
+
7
+ self.description = <<-DESC
8
+ Lints the spec-repo `NAME`. If a directory is provided it is assumed
9
+ to be the root of a repo. Finally, if `NAME` is not provided this
10
+ will lint all the spec-repos known to CocoaPods.
11
+ DESC
12
+
13
+ self.arguments = [
14
+ CLAide::Argument.new(%w(NAME DIRECTORY), false),
15
+ ]
16
+
17
+ def self.options
18
+ [
19
+ ['--only-errors', 'Lint presents only the errors'],
20
+ ].concat(super)
21
+ end
22
+
23
+ def initialize(argv)
24
+ @name = argv.shift_argument
25
+ @only_errors = argv.flag?('only-errors')
26
+ super
27
+ end
28
+
29
+ # Run the command
30
+ #
31
+ # @todo Part of this logic needs to be ported to cocoapods-core so web
32
+ # services can validate the repo.
33
+ #
34
+ # @todo add UI.print and enable print statements again.
35
+ #
36
+ def run
37
+ sources = if @name
38
+ if File.exist?(@name)
39
+ [Source.new(Pathname(@name))]
40
+ else
41
+ config.sources_manager.sources([@name])
42
+ end
43
+ else
44
+ config.sources_manager.all
45
+ end
46
+
47
+ sources.each do |source|
48
+ source.verify_compatibility!
49
+ UI.puts "\nLinting spec repo `#{source.name}`\n".yellow
50
+
51
+ validator = Source::HealthReporter.new(source.repo)
52
+ validator.pre_check do |_name, _version|
53
+ UI.print '.'
54
+ end
55
+ report = validator.analyze
56
+ UI.puts
57
+ UI.puts
58
+
59
+ report.pods_by_warning.each do |message, versions_by_name|
60
+ UI.puts "-> #{message}".yellow
61
+ versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
62
+ UI.puts
63
+ end
64
+
65
+ report.pods_by_error.each do |message, versions_by_name|
66
+ UI.puts "-> #{message}".red
67
+ versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
68
+ UI.puts
69
+ end
70
+
71
+ UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
72
+ if report.pods_by_error.count.zero?
73
+ UI.puts 'All the specs passed validation.'.green << "\n\n"
74
+ else
75
+ raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end