xcocoapods 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
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,40 @@
1
+ module Pod
2
+ class Command
3
+ class IPC < Command
4
+ class List < IPC
5
+ self.summary = 'Lists the specifications known to CocoaPods'
6
+ self.description = <<-DESC
7
+ Prints to STDOUT a YAML dictionary where the keys are the name of the
8
+ specifications and each corresponding value is a dictionary with
9
+ the following keys:
10
+ - defined_in_file
11
+ - version
12
+ - authors
13
+ - summary
14
+ - description
15
+ - platforms
16
+ DESC
17
+
18
+ def run
19
+ require 'yaml'
20
+ sets = config.sources_manager.aggregate.all_sets
21
+ result = {}
22
+ sets.each do |set|
23
+ begin
24
+ spec = set.specification
25
+ result[spec.name] = {
26
+ 'authors' => spec.authors.keys,
27
+ 'summary' => spec.summary,
28
+ 'description' => spec.description,
29
+ 'platforms' => spec.available_platforms.map { |p| p.name.to_s },
30
+ }
31
+ rescue DSLError
32
+ next
33
+ end
34
+ end
35
+ output_pipe.puts result.to_yaml
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,31 @@
1
+ module Pod
2
+ class Command
3
+ class IPC < Command
4
+ class Podfile < IPC
5
+ include ProjectDirectory
6
+
7
+ self.summary = 'Converts a Podfile to YAML'
8
+ self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
9
+ self.arguments = [
10
+ CLAide::Argument.new('PATH', true),
11
+ ]
12
+
13
+ def initialize(argv)
14
+ @path = argv.shift_argument
15
+ super
16
+ end
17
+
18
+ def validate!
19
+ super
20
+ help! 'A Podfile path is required.' unless @path
21
+ end
22
+
23
+ def run
24
+ require 'yaml'
25
+ podfile = Pod::Podfile.from_file(@path)
26
+ output_pipe.puts podfile.to_yaml
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ module Pod
2
+ class Command
3
+ class IPC < Command
4
+ class PodfileJSON < IPC
5
+ include ProjectDirectory
6
+
7
+ self.summary = 'Converts a Podfile to JSON'
8
+ self.description = 'Converts a Podfile to JSON and prints it to STDOUT.'
9
+ self.arguments = [
10
+ CLAide::Argument.new('PATH', true),
11
+ ]
12
+
13
+ def initialize(argv)
14
+ @path = argv.shift_argument
15
+ super
16
+ end
17
+
18
+ def validate!
19
+ super
20
+ help! 'A Podfile path is required.' unless @path
21
+ end
22
+
23
+ def run
24
+ podfile = Pod::Podfile.from_file(@path)
25
+ output_pipe.puts podfile.to_hash.to_json
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,51 @@
1
+ module Pod
2
+ class Command
3
+ class IPC < Command
4
+ class Repl < IPC
5
+ include ProjectDirectory
6
+
7
+ END_OF_OUTPUT_SIGNAL = "\n\r".freeze
8
+
9
+ self.summary = 'The repl listens to commands on standard input'
10
+ self.description = <<-DESC
11
+ The repl listens to commands on standard input and prints their
12
+ result to standard output.
13
+ It accepts all the other ipc subcommands. The repl will signal the
14
+ end of output with the the ASCII CR+LF `\\n\\r`.
15
+ DESC
16
+
17
+ def run
18
+ print_version
19
+ signal_end_of_output
20
+ listen
21
+ end
22
+
23
+ def print_version
24
+ output_pipe.puts "version: '#{Pod::VERSION}'"
25
+ end
26
+
27
+ def signal_end_of_output
28
+ output_pipe.puts(END_OF_OUTPUT_SIGNAL)
29
+ STDOUT.flush
30
+ end
31
+
32
+ def listen
33
+ while repl_command = STDIN.gets
34
+ execute_repl_command(repl_command)
35
+ end
36
+ end
37
+
38
+ def execute_repl_command(repl_command)
39
+ unless repl_command == '\n'
40
+ repl_commands = repl_command.split
41
+ subcommand = repl_commands.shift.capitalize
42
+ arguments = repl_commands
43
+ subcommand_class = Pod::Command::IPC.const_get(subcommand)
44
+ subcommand_class.new(CLAide::ARGV.new(arguments)).run
45
+ signal_end_of_output
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,29 @@
1
+ module Pod
2
+ class Command
3
+ class IPC < Command
4
+ class Spec < IPC
5
+ self.summary = 'Converts a podspec to JSON'
6
+ self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
7
+ self.arguments = [
8
+ CLAide::Argument.new('PATH', true),
9
+ ]
10
+
11
+ def initialize(argv)
12
+ @path = argv.shift_argument
13
+ super
14
+ end
15
+
16
+ def validate!
17
+ super
18
+ help! 'A specification path is required.' unless @path
19
+ end
20
+
21
+ def run
22
+ require 'json'
23
+ spec = Specification.from_file(@path)
24
+ output_pipe.puts(spec.to_pretty_json)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ module Pod
2
+ class Command
3
+ class IPC < Command
4
+ class UpdateSearchIndex < IPC
5
+ self.summary = 'Updates the search index'
6
+ self.description = <<-DESC
7
+ Updates the search index and prints its path to standard output.
8
+ The search index is a YAML encoded dictionary where the keys
9
+ are the names of the Pods and the values are a dictionary containing
10
+ the following information:
11
+ - version
12
+ - summary
13
+ - description
14
+ - authors
15
+ DESC
16
+
17
+ def run
18
+ config.sources_manager.updated_search_index
19
+ output_pipe.puts(config.sources_manager.search_index_path)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ require 'cocoapods/command/lib/create'
2
+ require 'cocoapods/command/lib/lint'
3
+
4
+ module Pod
5
+ class Command
6
+ class Lib < Command
7
+ self.abstract_command = true
8
+ self.summary = 'Develop pods'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,105 @@
1
+ module Pod
2
+ class Command
3
+ class Lib < Command
4
+ class Create < Lib
5
+ self.summary = 'Creates a new Pod'
6
+
7
+ self.description = <<-DESC
8
+ Creates a scaffold for the development of a new Pod named `NAME`
9
+ according to the CocoaPods best practices.
10
+ If a `TEMPLATE_URL`, pointing to a git repo containing a compatible
11
+ template, is specified, it will be used in place of the default one.
12
+ DESC
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('NAME', true),
16
+ ]
17
+
18
+ def self.options
19
+ [
20
+ ['--template-url=URL', 'The URL of the git repo containing a ' \
21
+ 'compatible template'],
22
+ ].concat(super)
23
+ end
24
+
25
+ def initialize(argv)
26
+ @name = argv.shift_argument
27
+ @template_url = argv.option('template-url', TEMPLATE_REPO)
28
+ super
29
+ @additional_args = argv.remainder!
30
+ end
31
+
32
+ def validate!
33
+ super
34
+ help! 'A name for the Pod is required.' unless @name
35
+ help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
36
+ help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
37
+ help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
38
+ end
39
+
40
+ def run
41
+ clone_template
42
+ configure_template
43
+ print_info
44
+ end
45
+
46
+ private
47
+
48
+ #----------------------------------------#
49
+
50
+ # !@group Private helpers
51
+
52
+ extend Executable
53
+ executable :git
54
+
55
+ TEMPLATE_REPO = 'https://github.com/CocoaPods/pod-template.git'.freeze
56
+ TEMPLATE_INFO_URL = 'https://github.com/CocoaPods/pod-template'.freeze
57
+ CREATE_NEW_POD_INFO_URL = 'http://guides.cocoapods.org/making/making-a-cocoapod'.freeze
58
+
59
+ # Clones the template from the remote in the working directory using
60
+ # the name of the Pod.
61
+ #
62
+ # @return [void]
63
+ #
64
+ def clone_template
65
+ UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do
66
+ git! ['clone', template_repo_url, @name]
67
+ end
68
+ end
69
+
70
+ # Runs the template configuration utilities.
71
+ #
72
+ # @return [void]
73
+ #
74
+ def configure_template
75
+ UI.section("Configuring #{@name} template.") do
76
+ Dir.chdir(@name) do
77
+ if File.exist?('configure')
78
+ system({ 'COCOAPODS_VERSION' => Pod::VERSION }, './configure', @name, *@additional_args)
79
+ else
80
+ UI.warn 'Template does not have a configure file.'
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ # Runs the template configuration utilities.
87
+ #
88
+ # @return [void]
89
+ #
90
+ def print_info
91
+ UI.puts "\nTo learn more about the template see `#{template_repo_url}`."
92
+ UI.puts "To learn more about creating a new pod, see `#{CREATE_NEW_POD_INFO_URL}`."
93
+ end
94
+
95
+ # Checks if a template URL is given else returns the TEMPLATE_REPO URL
96
+ #
97
+ # @return String
98
+ #
99
+ def template_repo_url
100
+ @template_url || TEMPLATE_REPO
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,121 @@
1
+ module Pod
2
+ class Command
3
+ class Lib < Command
4
+ class Lint < Lib
5
+ self.summary = 'Validates a Pod'
6
+
7
+ self.description = <<-DESC
8
+ Validates the Pod using the files in the working directory.
9
+ DESC
10
+
11
+ def self.options
12
+ [
13
+ ['--quick', 'Lint skips checks that would require to download and build the spec'],
14
+ ['--allow-warnings', 'Lint validates even if warnings are present'],
15
+ ['--subspec=NAME', 'Lint validates only the given subspec'],
16
+ ['--no-subspecs', 'Lint skips validation of subspecs'],
17
+ ['--no-clean', 'Lint leaves the build directory intact for inspection'],
18
+ ['--fail-fast', 'Lint stops on the first failing platform or subspec'],
19
+ ['--use-libraries', 'Lint uses static libraries to install the spec'],
20
+ ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
21
+ '(defaults to https://github.com/CocoaPods/Specs.git). ' \
22
+ 'Multiple sources must be comma-delimited.'],
23
+ ['--platforms=ios,macos', 'Lint against specific platforms' \
24
+ '(defaults to all platforms supported by the podspec).' \
25
+ 'Multiple platforms must be comma-delimited'],
26
+ ['--private', 'Lint skips checks that apply only to public specs'],
27
+ ['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
28
+ 'This takes precedence over a .swift-version file.'],
29
+ ['--skip-import-validation', 'Lint skips validating that the pod can be imported'],
30
+ ['--skip-tests', 'Lint skips building and running tests during validation'],
31
+ ].concat(super)
32
+ end
33
+
34
+ def initialize(argv)
35
+ @quick = argv.flag?('quick')
36
+ @allow_warnings = argv.flag?('allow-warnings')
37
+ @clean = argv.flag?('clean', true)
38
+ @fail_fast = argv.flag?('fail-fast', false)
39
+ @subspecs = argv.flag?('subspecs', true)
40
+ @only_subspec = argv.option('subspec')
41
+ @use_frameworks = !argv.flag?('use-libraries')
42
+ @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
43
+ @platforms = argv.option('platforms', '').split(',')
44
+ @private = argv.flag?('private', false)
45
+ @swift_version = argv.option('swift-version', nil)
46
+ @skip_import_validation = argv.flag?('skip-import-validation', false)
47
+ @skip_tests = argv.flag?('skip-tests', false)
48
+ @podspecs_paths = argv.arguments!
49
+ super
50
+ end
51
+
52
+ def validate!
53
+ super
54
+ end
55
+
56
+ def run
57
+ UI.puts
58
+ podspecs_to_lint.each do |podspec|
59
+ validator = Validator.new(podspec, @source_urls, @platforms)
60
+ validator.local = true
61
+ validator.quick = @quick
62
+ validator.no_clean = !@clean
63
+ validator.fail_fast = @fail_fast
64
+ validator.allow_warnings = @allow_warnings
65
+ validator.no_subspecs = !@subspecs || @only_subspec
66
+ validator.only_subspec = @only_subspec
67
+ validator.use_frameworks = @use_frameworks
68
+ validator.ignore_public_only_results = @private
69
+ validator.swift_version = @swift_version
70
+ validator.skip_import_validation = @skip_import_validation
71
+ validator.skip_tests = @skip_tests
72
+ validator.validate
73
+
74
+ unless @clean
75
+ UI.puts "Pods workspace available at `#{validator.validation_dir}/App.xcworkspace` for inspection."
76
+ UI.puts
77
+ end
78
+ if validator.validated?
79
+ UI.puts "#{validator.spec.name} passed validation.".green
80
+ else
81
+ spec_name = podspec
82
+ spec_name = validator.spec.name if validator.spec
83
+ message = "#{spec_name} did not pass validation, due to #{validator.failure_reason}."
84
+
85
+ if @clean
86
+ message << "\nYou can use the `--no-clean` option to inspect " \
87
+ 'any issue.'
88
+ end
89
+ raise Informative, message
90
+ end
91
+ end
92
+ end
93
+
94
+ private
95
+
96
+ #----------------------------------------#
97
+
98
+ # !@group Private helpers
99
+
100
+ # @return [Pathname] The path of the podspec found in the current
101
+ # working directory.
102
+ #
103
+ # @raise If no podspec is found.
104
+ # @raise If multiple podspecs are found.
105
+ #
106
+ def podspecs_to_lint
107
+ if !@podspecs_paths.empty?
108
+ Array(@podspecs_paths)
109
+ else
110
+ podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.json,}')
111
+ if podspecs.count.zero?
112
+ raise Informative, 'Unable to find a podspec in the working ' \
113
+ 'directory'
114
+ end
115
+ podspecs
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end