cocoapods 0.39.0.beta.1 → 0.39.0.beta.2

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/lib/cocoapods/gem_version.rb +1 -1
  4. metadata +35 -63
  5. data/lib/cocoapods/command/cache/clean.rb +0 -90
  6. data/lib/cocoapods/command/cache/list.rb +0 -69
  7. data/lib/cocoapods/command/repo/add.rb +0 -53
  8. data/lib/cocoapods/command/repo/lint.rb +0 -77
  9. data/lib/cocoapods/command/repo/list.rb +0 -93
  10. data/lib/cocoapods/command/repo/push.rb +0 -223
  11. data/lib/cocoapods/command/repo/remove.rb +0 -36
  12. data/lib/cocoapods/command/repo/update.rb +0 -27
  13. data/lib/cocoapods/command/spec/cat.rb +0 -51
  14. data/lib/cocoapods/command/spec/create.rb +0 -279
  15. data/lib/cocoapods/command/spec/edit.rb +0 -94
  16. data/lib/cocoapods/command/spec/lint.rb +0 -119
  17. data/lib/cocoapods/command/spec/which.rb +0 -43
  18. data/lib/cocoapods/generator/acknowledgements/markdown.rb +0 -38
  19. data/lib/cocoapods/generator/acknowledgements/plist.rb +0 -80
  20. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
  21. data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -83
  22. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -213
  23. data/lib/cocoapods/installer/analyzer/analysis_result.rb +0 -46
  24. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +0 -79
  25. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +0 -262
  26. data/lib/cocoapods/installer/analyzer/specs_state.rb +0 -76
  27. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +0 -41
  28. data/lib/cocoapods/installer/analyzer/target_inspector.rb +0 -203
  29. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -186
  30. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -297
  31. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +0 -318
  32. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +0 -173
@@ -1,119 +0,0 @@
1
- module Pod
2
- class Command
3
- class Spec < Command
4
- class Lint < Spec
5
- self.summary = 'Validates a spec file.'
6
-
7
- self.description = <<-DESC
8
- Validates `NAME.podspec`. If a `DIRECTORY` is provided, it validates
9
- the podspec files found, including subfolders. In case
10
- the argument is omitted, it defaults to the current working dir.
11
- DESC
12
-
13
- self.arguments = [
14
- CLAide::Argument.new(%w(NAME.podspec DIRECTORY http://PATH/NAME.podspec), false, true),
15
- ]
16
-
17
- def self.options
18
- [
19
- ['--quick', 'Lint skips checks that would require to download and build the spec'],
20
- ['--allow-warnings', 'Lint validates even if warnings are present'],
21
- ['--subspec=NAME', 'Lint validates only the given subspec'],
22
- ['--no-subspecs', 'Lint skips validation of subspecs'],
23
- ['--no-clean', 'Lint leaves the build directory intact for inspection'],
24
- ['--fail-fast', 'Lint stops on the first failing platform or subspec'],
25
- ['--use-libraries', 'Lint uses static libraries to install the spec'],
26
- ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
27
- '(defaults to https://github.com/CocoaPods/Specs.git). ' \
28
- 'Multiple sources must be comma-delimited.'],
29
- ['--private', 'Lint skips checks that apply only to public specs'],
30
- ].concat(super)
31
- end
32
-
33
- def initialize(argv)
34
- @quick = argv.flag?('quick')
35
- @allow_warnings = argv.flag?('allow-warnings')
36
- @clean = argv.flag?('clean', true)
37
- @fail_fast = argv.flag?('fail-fast', false)
38
- @subspecs = argv.flag?('subspecs', true)
39
- @only_subspec = argv.option('subspec')
40
- @use_frameworks = !argv.flag?('use-libraries')
41
- @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
42
- @private = argv.flag?('private', false)
43
- @podspecs_paths = argv.arguments!
44
- super
45
- end
46
-
47
- def run
48
- UI.puts
49
- failure_reasons = []
50
- podspecs_to_lint.each do |podspec|
51
- validator = Validator.new(podspec, @source_urls)
52
- validator.quick = @quick
53
- validator.no_clean = !@clean
54
- validator.fail_fast = @fail_fast
55
- validator.allow_warnings = @allow_warnings
56
- validator.no_subspecs = !@subspecs || @only_subspec
57
- validator.only_subspec = @only_subspec
58
- validator.use_frameworks = @use_frameworks
59
- validator.ignore_public_only_results = @private
60
- validator.validate
61
- failure_reasons << validator.failure_reason
62
-
63
- unless @clean
64
- UI.puts "Pods project available at `#{validator.validation_dir}/Pods/Pods.xcodeproj` for inspection."
65
- UI.puts
66
- end
67
- end
68
-
69
- count = podspecs_to_lint.count
70
- UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n"
71
-
72
- failure_reasons.compact!
73
- if failure_reasons.empty?
74
- lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : 'All the specs passed validation.'
75
- UI.puts lint_passed_message.green << "\n\n"
76
- else
77
- raise Informative, if count == 1
78
- "The spec did not pass validation, due to #{failure_reasons.first}."
79
- else
80
- "#{failure_reasons.count} out of #{count} specs failed validation."
81
- end
82
- end
83
- podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist?
84
- end
85
-
86
- private
87
-
88
- def podspecs_to_lint
89
- @podspecs_to_lint ||= begin
90
- files = []
91
- @podspecs_paths << '.' if @podspecs_paths.empty?
92
- @podspecs_paths.each do |path|
93
- if path =~ %r{https?://}
94
- require 'open-uri'
95
- output_path = podspecs_tmp_dir + File.basename(path)
96
- output_path.dirname.mkpath
97
- open(path) do |io|
98
- output_path.open('w') { |f| f << io.read }
99
- end
100
- files << output_path
101
- elsif (pathname = Pathname.new(path)).directory?
102
- files += Pathname.glob(pathname + '**/*.podspec{.json,}')
103
- raise Informative, 'No specs found in the current directory.' if files.empty?
104
- else
105
- files << (pathname = Pathname.new(path))
106
- raise Informative, "Unable to find a spec named `#{path}'." unless pathname.exist? && path.include?('.podspec')
107
- end
108
- end
109
- files
110
- end
111
- end
112
-
113
- def podspecs_tmp_dir
114
- Pathname.new(Dir.tmpdir) + 'CocoaPods/Lint_podspec'
115
- end
116
- end
117
- end
118
- end
119
- end
@@ -1,43 +0,0 @@
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
@@ -1,38 +0,0 @@
1
- module Pod
2
- module Generator
3
- class Markdown < Acknowledgements
4
- def self.path_from_basepath(path)
5
- Pathname.new(path.dirname + "#{path.basename}.markdown")
6
- end
7
-
8
- def save_as(path)
9
- file = File.new(path, 'w')
10
- file.write(licenses)
11
- file.close
12
- end
13
-
14
- def title_from_string(string, level)
15
- unless string.empty?
16
- '#' * level << " #{string}"
17
- end
18
- end
19
-
20
- def string_for_spec(spec)
21
- if (license_text = license_text(spec))
22
- "\n" << title_from_string(spec.name, 2) << "\n\n" << license_text << "\n"
23
- end
24
- end
25
-
26
- def licenses
27
- licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
28
- specs.each do |spec|
29
- if (license = string_for_spec(spec))
30
- license = license.force_encoding('UTF-8') if license.respond_to?(:force_encoding)
31
- licenses_string += license
32
- end
33
- end
34
- licenses_string += "#{title_from_string(footnote_title, 2)}#{footnote_text}\n"
35
- end
36
- end
37
- end
38
- end
@@ -1,80 +0,0 @@
1
- module Pod
2
- module Generator
3
- class Plist < Acknowledgements
4
- def self.path_from_basepath(path)
5
- Pathname.new(path.dirname + "#{path.basename}.plist")
6
- end
7
-
8
- def save_as(path)
9
- Xcodeproj::PlistHelper.write(plist, path)
10
- end
11
-
12
- def plist
13
- {
14
- :Title => plist_title,
15
- :StringsTable => plist_title,
16
- :PreferenceSpecifiers => licenses,
17
- }
18
- end
19
-
20
- def plist_title
21
- 'Acknowledgements'
22
- end
23
-
24
- def licenses
25
- licences_array = [header_hash]
26
- specs.each do |spec|
27
- if (hash = hash_for_spec(spec))
28
- licences_array << hash
29
- end
30
- end
31
- licences_array << footnote_hash
32
- end
33
-
34
- def hash_for_spec(spec)
35
- if (license = license_text(spec))
36
- {
37
- :Type => 'PSGroupSpecifier',
38
- :Title => sanitize_encoding(spec.name),
39
- :FooterText => sanitize_encoding(license),
40
- }
41
- end
42
- end
43
-
44
- def header_hash
45
- {
46
- :Type => 'PSGroupSpecifier',
47
- :Title => sanitize_encoding(header_title),
48
- :FooterText => sanitize_encoding(header_text),
49
- }
50
- end
51
-
52
- def footnote_hash
53
- {
54
- :Type => 'PSGroupSpecifier',
55
- :Title => sanitize_encoding(footnote_title),
56
- :FooterText => sanitize_encoding(footnote_text),
57
- }
58
- end
59
-
60
- #-----------------------------------------------------------------------#
61
-
62
- private
63
-
64
- # !@group Private methods
65
-
66
- # Returns the sanitized text with UTF-8 invalid characters eliminated.
67
- #
68
- # @param [String] text
69
- # the text we want to sanitize.
70
- #
71
- # @return [String] The sanitized UTF-8 text.
72
- #
73
- def sanitize_encoding(text)
74
- text.encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => '')
75
- end
76
-
77
- #-----------------------------------------------------------------------#
78
- end
79
- end
80
- end
@@ -1,260 +0,0 @@
1
- module Pod
2
- module Generator
3
- module XCConfig
4
- # Generates the xcconfigs for the aggregate targets.
5
- #
6
- class AggregateXCConfig
7
- # @return [Target] the target represented by this xcconfig.
8
- #
9
- attr_reader :target
10
-
11
- # @return [String] the name of the build configuration to generate this
12
- # xcconfig for.
13
- #
14
- attr_reader :configuration_name
15
-
16
- # Initialize a new instance
17
- #
18
- # @param [Target] target @see target
19
- #
20
- # @param [String] configuration_name @see configuration_name
21
- #
22
- def initialize(target, configuration_name)
23
- @target = target
24
- @configuration_name = configuration_name
25
- end
26
-
27
- # @return [Xcodeproj::Config] The generated xcconfig.
28
- #
29
- attr_reader :xcconfig
30
-
31
- # Generates and saves the xcconfig to the given path.
32
- #
33
- # @param [Pathname] path
34
- # the path where the xcconfig should be stored.
35
- #
36
- # @return [void]
37
- #
38
- def save_as(path)
39
- generate.save_as(path)
40
- end
41
-
42
- # Generates the xcconfig.
43
- #
44
- # @note The xcconfig file for a Pods integration target includes the
45
- # namespaced xcconfig files for each spec target dependency.
46
- # Each namespaced configuration value is merged into the Pod
47
- # xcconfig file.
48
- #
49
- # @todo This doesn't include the specs xcconfigs anymore and now the
50
- # logic is duplicated.
51
- #
52
- # @return [Xcodeproj::Config]
53
- #
54
- def generate
55
- includes_static_libs = !target.requires_frameworks?
56
- includes_static_libs ||= pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.vendored_static_artifacts.empty? }
57
- config = {
58
- 'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target, includes_static_libs),
59
- 'PODS_ROOT' => target.relative_pods_root,
60
- 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
61
- 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
62
- }
63
- @xcconfig = Xcodeproj::Config.new(config)
64
-
65
- @xcconfig.merge!(merged_user_target_xcconfigs)
66
-
67
- generate_settings_to_import_pod_targets
68
-
69
- XCConfigHelper.add_target_specific_settings(target, @xcconfig)
70
-
71
- generate_vendored_build_settings
72
- generate_other_ld_flags
73
-
74
- # TODO: Need to decide how we are going to ensure settings like these
75
- # are always excluded from the user's project.
76
- #
77
- # See https://github.com/CocoaPods/CocoaPods/issues/1216
78
- @xcconfig.attributes.delete('USE_HEADERMAP')
79
-
80
- generate_ld_runpath_search_paths if target.requires_frameworks?
81
-
82
- @xcconfig
83
- end
84
-
85
- #---------------------------------------------------------------------#
86
-
87
- private
88
-
89
- # Add build settings, which ensure that the pod targets can be imported
90
- # from the integrating target by all sort of imports, which are:
91
- # - `#import <…>`
92
- # - `#import "…"`
93
- # - `@import …;` / `import …`
94
- #
95
- def generate_settings_to_import_pod_targets
96
- if target.requires_frameworks?
97
- framework_header_search_paths = pod_targets.select(&:should_build?).map do |target|
98
- if target.scoped?
99
- "$PODS_FRAMEWORK_BUILD_PATH/#{target.product_name}/Headers"
100
- else
101
- "$CONFIGURATION_BUILD_DIR/#{target.product_name}/Headers"
102
- end
103
- end
104
- build_settings = {
105
- 'PODS_FRAMEWORK_BUILD_PATH' => target.scoped_configuration_build_dir,
106
- # Make framework headers discoverable by `import "…"`
107
- 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(framework_header_search_paths, '-iquote'),
108
- }
109
- if pod_targets.any? { |t| !t.should_build? }
110
- # Make library headers discoverable by `#import "…"`
111
- library_header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
112
- build_settings['HEADER_SEARCH_PATHS'] = '$(inherited) ' + XCConfigHelper.quote(library_header_search_paths)
113
- build_settings['OTHER_CFLAGS'] += ' ' + XCConfigHelper.quote(library_header_search_paths, '-isystem')
114
- end
115
- if pod_targets.any? { |t| t.should_build? && t.scoped? }
116
- build_settings['FRAMEWORK_SEARCH_PATHS'] = '"$PODS_FRAMEWORK_BUILD_PATH"'
117
- end
118
- @xcconfig.merge!(build_settings)
119
- else
120
- # Make headers discoverable from $PODS_ROOT/Headers directory
121
- header_search_paths = target.sandbox.public_headers.search_paths(target.platform)
122
- build_settings = {
123
- # by `#import "…"`
124
- 'HEADER_SEARCH_PATHS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths),
125
- # by `#import <…>`
126
- 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_paths, '-isystem'),
127
- }
128
- @xcconfig.merge!(build_settings)
129
- end
130
- end
131
-
132
- # Add custom build settings and required build settings to link to
133
- # vendored libraries and frameworks.
134
- #
135
- # @note
136
- # In case of generated pod targets, which require frameworks, the
137
- # vendored frameworks and libraries are already linked statically
138
- # into the framework binary and must not be linked again to the
139
- # user target.
140
- #
141
- def generate_vendored_build_settings
142
- pod_targets.each do |pod_target|
143
- unless pod_target.should_build? && pod_target.requires_frameworks?
144
- XCConfigHelper.add_settings_for_file_accessors_of_target(pod_target, @xcconfig)
145
- end
146
- end
147
- end
148
-
149
- # Add pod target to list of frameworks / libraries that are linked
150
- # with the user’s project.
151
- #
152
- def generate_other_ld_flags
153
- other_ld_flags = pod_targets.select(&:should_build?).map do |pod_target|
154
- if pod_target.requires_frameworks?
155
- %(-framework "#{pod_target.product_basename}")
156
- else
157
- %(-l "#{pod_target.product_basename}")
158
- end
159
- end
160
-
161
- @xcconfig.merge!('OTHER_LDFLAGS' => other_ld_flags.join(' '))
162
- end
163
-
164
- # Ensure to add the default linker run path search paths as they could
165
- # be not present due to being historically absent in the project or
166
- # target template or just being removed by being superficial when
167
- # linking third-party dependencies exclusively statically. This is not
168
- # something a project needs specifically for the integration with
169
- # CocoaPods, but makes sure that it is self-contained for the given
170
- # constraints.
171
- #
172
- def generate_ld_runpath_search_paths
173
- ld_runpath_search_paths = ['$(inherited)']
174
- if target.platform.symbolic_name == :osx
175
- ld_runpath_search_paths << "'@executable_path/../Frameworks'"
176
- ld_runpath_search_paths << \
177
- if target.native_target.symbol_type == :unit_test_bundle
178
- "'@loader_path/../Frameworks'"
179
- else
180
- "'@loader_path/Frameworks'"
181
- end
182
- else
183
- ld_runpath_search_paths << [
184
- "'@executable_path/Frameworks'",
185
- "'@loader_path/Frameworks'",
186
- ]
187
- end
188
- @xcconfig.merge!('LD_RUNPATH_SEARCH_PATHS' => ld_runpath_search_paths.join(' '))
189
- end
190
-
191
- private
192
-
193
- #---------------------------------------------------------------------#
194
-
195
- # !@group Private Helpers
196
-
197
- # Returns the {PodTarget}s which are active for the current
198
- # configuration name.
199
- #
200
- # @return [Array<PodTarget>]
201
- #
202
- def pod_targets
203
- target.pod_targets_for_build_configuration(configuration_name)
204
- end
205
-
206
- # Returns the +user_target_xcconfig+ for all pod targets and their spec
207
- # consumers grouped by keys
208
- #
209
- # @return [Hash{String,Hash{Target,String}]
210
- #
211
- def user_target_xcconfig_values_by_consumer_by_key
212
- pod_targets.each_with_object({}) do |target, hash|
213
- target.spec_consumers.each do |spec_consumer|
214
- spec_consumer.user_target_xcconfig.each do |k, v|
215
- (hash[k] ||= {})[spec_consumer] = v
216
- end
217
- end
218
- end
219
- end
220
-
221
- # Merges the +user_target_xcconfig+ for all pod targets into the
222
- # #xcconfig and warns on conflicting definitions.
223
- #
224
- # @return [Hash{String, String}]
225
- #
226
- def merged_user_target_xcconfigs
227
- settings = user_target_xcconfig_values_by_consumer_by_key
228
- settings.each_with_object({}) do |(key, values_by_consumer), xcconfig|
229
- uniq_values = values_by_consumer.values.uniq
230
- values_are_bools = uniq_values.all? { |v| v =~ /(yes|no)/i }
231
- if values_are_bools
232
- # Boolean build settings
233
- if uniq_values.count > 1
234
- UI.warn 'Can\'t merge user_target_xcconfig for pod targets: ' \
235
- "#{values_by_consumer.keys.map(&:name)}. Boolean build "\
236
- "setting #{key} has different values."
237
- else
238
- xcconfig[key] = uniq_values.first
239
- end
240
- elsif key =~ /S$/
241
- # Plural build settings
242
- xcconfig[key] = uniq_values.join(' ')
243
- else
244
- # Singular build settings
245
- if uniq_values.count > 1
246
- UI.warn 'Can\'t merge user_target_xcconfig for pod targets: ' \
247
- "#{values_by_consumer.keys.map(&:name)}. Singular build "\
248
- "setting #{key} has different values."
249
- else
250
- xcconfig[key] = uniq_values.first
251
- end
252
- end
253
- end
254
- end
255
-
256
- #---------------------------------------------------------------------#
257
- end
258
- end
259
- end
260
- end