cocoapods 0.16.4 → 0.17.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +108 -0
  3. data/README.md +3 -3
  4. data/bin/pod +1 -1
  5. data/lib/cocoapods.rb +31 -31
  6. data/lib/cocoapods/command.rb +62 -107
  7. data/lib/cocoapods/command/inter_process_communication.rb +103 -0
  8. data/lib/cocoapods/command/list.rb +45 -44
  9. data/lib/cocoapods/command/outdated.rb +28 -25
  10. data/lib/cocoapods/command/project.rb +90 -0
  11. data/lib/cocoapods/command/push.rb +50 -32
  12. data/lib/cocoapods/command/repo.rb +125 -155
  13. data/lib/cocoapods/command/search.rb +23 -12
  14. data/lib/cocoapods/command/setup.rb +103 -64
  15. data/lib/cocoapods/command/spec.rb +329 -90
  16. data/lib/cocoapods/config.rb +197 -44
  17. data/lib/cocoapods/downloader.rb +47 -34
  18. data/lib/cocoapods/executable.rb +98 -41
  19. data/lib/cocoapods/external_sources.rb +325 -0
  20. data/lib/cocoapods/file_list.rb +8 -1
  21. data/lib/cocoapods/gem_version.rb +7 -0
  22. data/lib/cocoapods/generator/acknowledgements.rb +71 -7
  23. data/lib/cocoapods/generator/acknowledgements/markdown.rb +10 -9
  24. data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -8
  25. data/lib/cocoapods/generator/copy_resources_script.rb +2 -2
  26. data/lib/cocoapods/generator/documentation.rb +153 -37
  27. data/lib/cocoapods/generator/prefix_header.rb +82 -0
  28. data/lib/cocoapods/generator/target_header.rb +58 -0
  29. data/lib/cocoapods/generator/xcconfig.rb +130 -0
  30. data/lib/cocoapods/hooks/installer_representation.rb +123 -0
  31. data/lib/cocoapods/hooks/library_representation.rb +79 -0
  32. data/lib/cocoapods/hooks/pod_representation.rb +74 -0
  33. data/lib/cocoapods/installer.rb +398 -147
  34. data/lib/cocoapods/installer/analyzer.rb +556 -0
  35. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
  36. data/lib/cocoapods/installer/file_references_installer.rb +179 -0
  37. data/lib/cocoapods/installer/pod_source_installer.rb +289 -0
  38. data/lib/cocoapods/installer/target_installer.rb +307 -112
  39. data/lib/cocoapods/installer/user_project_integrator.rb +140 -176
  40. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +193 -0
  41. data/lib/cocoapods/library.rb +195 -0
  42. data/lib/cocoapods/open_uri.rb +16 -14
  43. data/lib/cocoapods/project.rb +175 -52
  44. data/lib/cocoapods/resolver.rb +151 -164
  45. data/lib/cocoapods/sandbox.rb +276 -54
  46. data/lib/cocoapods/sandbox/file_accessor.rb +210 -0
  47. data/lib/cocoapods/sandbox/headers_store.rb +96 -0
  48. data/lib/cocoapods/sandbox/path_list.rb +178 -0
  49. data/lib/cocoapods/sources_manager.rb +218 -0
  50. data/lib/cocoapods/user_interface.rb +82 -18
  51. data/lib/cocoapods/{command → user_interface}/error_report.rb +5 -5
  52. data/lib/cocoapods/validator.rb +379 -0
  53. metadata +74 -55
  54. data/lib/cocoapods/command/install.rb +0 -55
  55. data/lib/cocoapods/command/linter.rb +0 -317
  56. data/lib/cocoapods/command/update.rb +0 -25
  57. data/lib/cocoapods/dependency.rb +0 -285
  58. data/lib/cocoapods/downloader/git.rb +0 -276
  59. data/lib/cocoapods/downloader/http.rb +0 -99
  60. data/lib/cocoapods/downloader/mercurial.rb +0 -26
  61. data/lib/cocoapods/downloader/subversion.rb +0 -42
  62. data/lib/cocoapods/local_pod.rb +0 -620
  63. data/lib/cocoapods/lockfile.rb +0 -274
  64. data/lib/cocoapods/platform.rb +0 -127
  65. data/lib/cocoapods/podfile.rb +0 -551
  66. data/lib/cocoapods/source.rb +0 -223
  67. data/lib/cocoapods/specification.rb +0 -579
  68. data/lib/cocoapods/specification/set.rb +0 -175
  69. data/lib/cocoapods/specification/statistics.rb +0 -112
  70. data/lib/cocoapods/user_interface/ui_pod.rb +0 -130
  71. data/lib/cocoapods/version.rb +0 -26
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.4
5
- prerelease:
4
+ version: 0.17.0.rc1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eloy Duran
@@ -10,12 +9,53 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-02-25 00:00:00.000000000 Z
12
+ date: 2013-02-26 00:00:00.000000000 Z
14
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: cocoapods-core
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.17.0.rc1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 0.17.0.rc1
28
+ - !ruby/object:Gem::Dependency
29
+ name: claide
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.2.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: 0.2.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: cocoapods-downloader
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: 0.1.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 0.1.0
15
56
  - !ruby/object:Gem::Dependency
16
57
  name: xcodeproj
17
58
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
59
  requirements:
20
60
  - - ~>
21
61
  - !ruby/object:Gem::Version
@@ -23,7 +63,6 @@ dependencies:
23
63
  type: :runtime
24
64
  prerelease: false
25
65
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
66
  requirements:
28
67
  - - ~>
29
68
  - !ruby/object:Gem::Version
@@ -31,7 +70,6 @@ dependencies:
31
70
  - !ruby/object:Gem::Dependency
32
71
  name: faraday
33
72
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
73
  requirements:
36
74
  - - ~>
37
75
  - !ruby/object:Gem::Version
@@ -39,7 +77,6 @@ dependencies:
39
77
  type: :runtime
40
78
  prerelease: false
41
79
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
80
  requirements:
44
81
  - - ~>
45
82
  - !ruby/object:Gem::Version
@@ -47,7 +84,6 @@ dependencies:
47
84
  - !ruby/object:Gem::Dependency
48
85
  name: octokit
49
86
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
87
  requirements:
52
88
  - - ~>
53
89
  - !ruby/object:Gem::Version
@@ -55,7 +91,6 @@ dependencies:
55
91
  type: :runtime
56
92
  prerelease: false
57
93
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
94
  requirements:
60
95
  - - ~>
61
96
  - !ruby/object:Gem::Version
@@ -63,7 +98,6 @@ dependencies:
63
98
  - !ruby/object:Gem::Dependency
64
99
  name: colored
65
100
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
101
  requirements:
68
102
  - - ~>
69
103
  - !ruby/object:Gem::Version
@@ -71,7 +105,6 @@ dependencies:
71
105
  type: :runtime
72
106
  prerelease: false
73
107
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
108
  requirements:
76
109
  - - ~>
77
110
  - !ruby/object:Gem::Version
@@ -79,7 +112,6 @@ dependencies:
79
112
  - !ruby/object:Gem::Dependency
80
113
  name: escape
81
114
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
115
  requirements:
84
116
  - - ~>
85
117
  - !ruby/object:Gem::Version
@@ -87,7 +119,6 @@ dependencies:
87
119
  type: :runtime
88
120
  prerelease: false
89
121
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
122
  requirements:
92
123
  - - ~>
93
124
  - !ruby/object:Gem::Version
@@ -95,7 +126,6 @@ dependencies:
95
126
  - !ruby/object:Gem::Dependency
96
127
  name: json
97
128
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
129
  requirements:
100
130
  - - ~>
101
131
  - !ruby/object:Gem::Version
@@ -103,7 +133,6 @@ dependencies:
103
133
  type: :runtime
104
134
  prerelease: false
105
135
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
136
  requirements:
108
137
  - - ~>
109
138
  - !ruby/object:Gem::Version
@@ -111,7 +140,6 @@ dependencies:
111
140
  - !ruby/object:Gem::Dependency
112
141
  name: open4
113
142
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
143
  requirements:
116
144
  - - ~>
117
145
  - !ruby/object:Gem::Version
@@ -119,7 +147,6 @@ dependencies:
119
147
  type: :runtime
120
148
  prerelease: false
121
149
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
150
  requirements:
124
151
  - - ~>
125
152
  - !ruby/object:Gem::Version
@@ -127,7 +154,6 @@ dependencies:
127
154
  - !ruby/object:Gem::Dependency
128
155
  name: rake
129
156
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
157
  requirements:
132
158
  - - ~>
133
159
  - !ruby/object:Gem::Version
@@ -135,7 +161,6 @@ dependencies:
135
161
  type: :runtime
136
162
  prerelease: false
137
163
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
164
  requirements:
140
165
  - - ~>
141
166
  - !ruby/object:Gem::Version
@@ -143,7 +168,6 @@ dependencies:
143
168
  - !ruby/object:Gem::Dependency
144
169
  name: activesupport
145
170
  requirement: !ruby/object:Gem::Requirement
146
- none: false
147
171
  requirements:
148
172
  - - ~>
149
173
  - !ruby/object:Gem::Version
@@ -151,7 +175,6 @@ dependencies:
151
175
  type: :runtime
152
176
  prerelease: false
153
177
  version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
178
  requirements:
156
179
  - - ~>
157
180
  - !ruby/object:Gem::Version
@@ -159,7 +182,6 @@ dependencies:
159
182
  - !ruby/object:Gem::Dependency
160
183
  name: bacon
161
184
  requirement: !ruby/object:Gem::Requirement
162
- none: false
163
185
  requirements:
164
186
  - - ~>
165
187
  - !ruby/object:Gem::Version
@@ -167,21 +189,16 @@ dependencies:
167
189
  type: :development
168
190
  prerelease: false
169
191
  version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
192
  requirements:
172
193
  - - ~>
173
194
  - !ruby/object:Gem::Version
174
195
  version: '1.1'
175
- description: ! 'CocoaPods manages library dependencies for your Xcode project.
176
-
177
-
178
- You specify the dependencies for your project in one easy text file. CocoaPods resolves
179
- dependencies between libraries, fetches source code for the dependencies, and creates
180
- and maintains an Xcode workspace to build your project.
196
+ description: |-
197
+ CocoaPods manages library dependencies for your Xcode project.
181
198
 
199
+ You specify the dependencies for your project in one easy text file. CocoaPods resolves dependencies between libraries, fetches source code for the dependencies, and creates and maintains an Xcode workspace to build your project.
182
200
 
183
- Ultimately, the goal is to improve discoverability of, and engagement in, third
184
- party open-source libraries, by creating a more centralized ecosystem.'
201
+ Ultimately, the goal is to improve discoverability of, and engagement in, third party open-source libraries, by creating a more centralized ecosystem.
185
202
  email:
186
203
  - eloy.de.enige@gmail.com
187
204
  - fabiopelosin@gmail.com
@@ -190,27 +207,22 @@ executables:
190
207
  extensions: []
191
208
  extra_rdoc_files: []
192
209
  files:
193
- - lib/cocoapods/command/error_report.rb
194
- - lib/cocoapods/command/install.rb
195
- - lib/cocoapods/command/linter.rb
210
+ - lib/cocoapods/command/inter_process_communication.rb
196
211
  - lib/cocoapods/command/list.rb
197
212
  - lib/cocoapods/command/outdated.rb
213
+ - lib/cocoapods/command/project.rb
198
214
  - lib/cocoapods/command/push.rb
199
215
  - lib/cocoapods/command/repo.rb
200
216
  - lib/cocoapods/command/search.rb
201
217
  - lib/cocoapods/command/setup.rb
202
218
  - lib/cocoapods/command/spec.rb
203
- - lib/cocoapods/command/update.rb
204
219
  - lib/cocoapods/command.rb
205
220
  - lib/cocoapods/config.rb
206
- - lib/cocoapods/dependency.rb
207
- - lib/cocoapods/downloader/git.rb
208
- - lib/cocoapods/downloader/http.rb
209
- - lib/cocoapods/downloader/mercurial.rb
210
- - lib/cocoapods/downloader/subversion.rb
211
221
  - lib/cocoapods/downloader.rb
212
222
  - lib/cocoapods/executable.rb
223
+ - lib/cocoapods/external_sources.rb
213
224
  - lib/cocoapods/file_list.rb
225
+ - lib/cocoapods/gem_version.rb
214
226
  - lib/cocoapods/generator/acknowledgements/markdown.rb
215
227
  - lib/cocoapods/generator/acknowledgements/plist.rb
216
228
  - lib/cocoapods/generator/acknowledgements.rb
@@ -218,24 +230,32 @@ files:
218
230
  - lib/cocoapods/generator/copy_resources_script.rb
219
231
  - lib/cocoapods/generator/documentation.rb
220
232
  - lib/cocoapods/generator/dummy_source.rb
233
+ - lib/cocoapods/generator/prefix_header.rb
234
+ - lib/cocoapods/generator/target_header.rb
235
+ - lib/cocoapods/generator/xcconfig.rb
236
+ - lib/cocoapods/hooks/installer_representation.rb
237
+ - lib/cocoapods/hooks/library_representation.rb
238
+ - lib/cocoapods/hooks/pod_representation.rb
239
+ - lib/cocoapods/installer/analyzer/sandbox_analyzer.rb
240
+ - lib/cocoapods/installer/analyzer.rb
241
+ - lib/cocoapods/installer/file_references_installer.rb
242
+ - lib/cocoapods/installer/pod_source_installer.rb
221
243
  - lib/cocoapods/installer/target_installer.rb
244
+ - lib/cocoapods/installer/user_project_integrator/target_integrator.rb
222
245
  - lib/cocoapods/installer/user_project_integrator.rb
223
246
  - lib/cocoapods/installer.rb
224
- - lib/cocoapods/local_pod.rb
225
- - lib/cocoapods/lockfile.rb
247
+ - lib/cocoapods/library.rb
226
248
  - lib/cocoapods/open_uri.rb
227
- - lib/cocoapods/platform.rb
228
- - lib/cocoapods/podfile.rb
229
249
  - lib/cocoapods/project.rb
230
250
  - lib/cocoapods/resolver.rb
251
+ - lib/cocoapods/sandbox/file_accessor.rb
252
+ - lib/cocoapods/sandbox/headers_store.rb
253
+ - lib/cocoapods/sandbox/path_list.rb
231
254
  - lib/cocoapods/sandbox.rb
232
- - lib/cocoapods/source.rb
233
- - lib/cocoapods/specification/set.rb
234
- - lib/cocoapods/specification/statistics.rb
235
- - lib/cocoapods/specification.rb
236
- - lib/cocoapods/user_interface/ui_pod.rb
255
+ - lib/cocoapods/sources_manager.rb
256
+ - lib/cocoapods/user_interface/error_report.rb
237
257
  - lib/cocoapods/user_interface.rb
238
- - lib/cocoapods/version.rb
258
+ - lib/cocoapods/validator.rb
239
259
  - lib/cocoapods.rb
240
260
  - bin/pod
241
261
  - README.md
@@ -244,25 +264,24 @@ files:
244
264
  homepage: https://github.com/CocoaPods/CocoaPods
245
265
  licenses:
246
266
  - MIT
267
+ metadata: {}
247
268
  post_install_message:
248
269
  rdoc_options: []
249
270
  require_paths:
250
271
  - lib
251
272
  required_ruby_version: !ruby/object:Gem::Requirement
252
- none: false
253
273
  requirements:
254
- - - ! '>='
274
+ - - '>='
255
275
  - !ruby/object:Gem::Version
256
276
  version: '0'
257
277
  required_rubygems_version: !ruby/object:Gem::Requirement
258
- none: false
259
278
  requirements:
260
- - - ! '>='
279
+ - - '>='
261
280
  - !ruby/object:Gem::Version
262
281
  version: '0'
263
282
  requirements: []
264
283
  rubyforge_project:
265
- rubygems_version: 1.8.23
284
+ rubygems_version: 2.0.0
266
285
  signing_key:
267
286
  specification_version: 3
268
287
  summary: An Objective-C library package manager.
@@ -1,55 +0,0 @@
1
- module Pod
2
- class Command
3
- class Install < Command
4
- def self.banner
5
- %{Installing dependencies of a project:
6
-
7
- $ pod install
8
-
9
- Downloads all dependencies defined in `Podfile' and creates an Xcode
10
- Pods library project in `./Pods'.
11
-
12
- The Xcode project file should be specified in your `Podfile` like this:
13
-
14
- xcodeproj 'path/to/XcodeProject'
15
-
16
- If no xcodeproj is specified, then a search for an Xcode project will
17
- be made. If more than one Xcode project is found, the command will
18
- raise an error.
19
-
20
- This will configure the project to reference the Pods static library,
21
- add a build configuration file, and add a post build script to copy
22
- Pod resources.}
23
- end
24
-
25
- def self.options
26
- [
27
- ["--no-clean", "Leave SCM dirs like `.git' and `.svn' intact after downloading"],
28
- ["--no-doc", "Skip documentation generation with appledoc"],
29
- ["--no-integrate", "Skip integration of the Pods libraries in the Xcode project(s)"],
30
- ["--no-update", "Skip running `pod repo update` before install"],
31
- ].concat(super)
32
- end
33
-
34
- def initialize(argv)
35
- config.clean = !argv.option('--no-clean')
36
- config.generate_docs = !argv.option('--no-doc')
37
- config.integrate_targets = !argv.option('--no-integrate')
38
- config.skip_repo_update = argv.option('--no-update')
39
- super unless argv.empty?
40
- end
41
-
42
- def run_install_with_update(update)
43
- sandbox = Sandbox.new(config.project_pods_root)
44
- resolver = Resolver.new(config.podfile, config.lockfile, sandbox)
45
- resolver.update_mode = update
46
- Installer.new(resolver).install!
47
- end
48
-
49
- def run
50
- verify_podfile_exists!
51
- run_install_with_update(false)
52
- end
53
- end
54
- end
55
- end
@@ -1,317 +0,0 @@
1
- module Pod
2
- class Command
3
- class Linter
4
- include Config::Mixin
5
-
6
- # TODO: Add check to ensure that attributes inherited by subspecs are not duplicated ?
7
-
8
- attr_accessor :quick, :no_clean, :repo_path
9
-
10
- # @return [Bool] Wether the lint should be performed against the root of
11
- # the podspec instead to its original source. Uses the `:local` option
12
- # of the Podfile.
13
- #
14
- attr_accessor :local
15
- alias :local? :local
16
-
17
- attr_reader :spec, :file
18
- attr_reader :errors, :warnings, :notes
19
-
20
- def initialize(podspec)
21
- @file = podspec
22
- end
23
-
24
- def spec_name
25
- name = file.basename('.*').to_s
26
- if @spec
27
- name << " (#{spec.version})"
28
- elsif @repo_path
29
- name << " (#{file.dirname.basename})"
30
- end
31
- name
32
- end
33
-
34
- # Takes an array of podspec files and lints them all
35
- #
36
- # It returns true if the spec passed validation
37
- #
38
- def lint
39
- @errors, @warnings, @notes = [], [], []
40
- @platform_errors, @platform_warnings, @platform_notes = {}, {}, {}
41
-
42
- if !deprecation_errors.empty?
43
- @errors = deprecation_errors
44
- @errors << "#{spec_name} [!] Fatal errors found skipping the rest of the validation"
45
- else
46
- @spec = Specification.from_file(file)
47
- platforms = spec.available_platforms
48
-
49
- if @repo_path
50
- expected_path = "#{@spec.name}/#{@spec.version}/#{@spec.name}.podspec"
51
- path = file.relative_path_from(@repo_path).to_s
52
- @errors << "Incorrect path, the path is `#{file}` and should be `#{expected_path}`" unless path.end_with?(expected_path)
53
- end
54
-
55
- platforms.each do |platform|
56
- @platform_errors[platform], @platform_warnings[platform], @platform_notes[platform] = [], [], []
57
-
58
- spec.activate_platform(platform)
59
- @platform = platform
60
- puts "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed if config.verbose? && !@quick
61
-
62
- # Skip validation if there are errors in the podspec as it would result in a crash
63
- if !podspec_errors.empty?
64
- @platform_errors[platform] += podspec_errors
65
- @platform_notes[platform] << "#{platform.name} [!] Fatal errors found skipping the rest of the validation"
66
- else
67
- @platform_warnings[platform] += podspec_warnings
68
- peform_extensive_analysis unless quick
69
- end
70
- end
71
-
72
- # Get common messages
73
- @errors += @platform_errors.values.reduce(:&)
74
- @warnings += @platform_warnings.values.reduce(:&)
75
- @notes += @platform_notes.values.reduce(:&)
76
-
77
- platforms.each do |platform|
78
- # Mark platform specific messages
79
- @errors += (@platform_errors[platform] - @errors).map {|m| "[#{platform}] #{m}"}
80
- @warnings += (@platform_warnings[platform] - @warnings).map {|m| "[#{platform}] #{m}"}
81
- @notes += (@platform_notes[platform] - @notes).map {|m| "[#{platform}] #{m}"}
82
- end
83
- end
84
- end
85
-
86
- def result_type
87
- return :error unless errors.empty?
88
- return :warning unless warnings.empty?
89
- return :note unless notes.empty?
90
- :success
91
- end
92
-
93
- # Performs platform specific analysis.
94
- # It requires to download the source at each iteration
95
- #
96
- def peform_extensive_analysis
97
- set_up_lint_environment
98
- install_pod
99
- if `which xcodebuild`.strip.empty?
100
- puts "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow if config.verbose?
101
- else
102
- puts "\nBuilding with xcodebuild.\n".yellow if config.verbose?
103
- # treat xcodebuild warnings as notes because the spec maintainer might not be the author of the library
104
- xcodebuild_output.each { |msg| ( msg.include?('error: ') ? @platform_errors[@platform] : @platform_notes[@platform] ) << msg }
105
- end
106
- @platform_errors[@platform] += file_patterns_errors
107
- @platform_warnings[@platform] += file_patterns_warnings
108
- tear_down_lint_environment
109
- end
110
-
111
- def install_pod
112
- podfile = podfile_from_spec
113
- config.verbose
114
- config.skip_repo_update = true
115
- sandbox = Sandbox.new(config.project_pods_root)
116
- resolver = Resolver.new(podfile, nil, sandbox)
117
- installer = Installer.new(resolver)
118
- installer.install!
119
- @pod = installer.pods.find { |pod| pod.top_specification == spec }
120
- config.silent
121
- end
122
-
123
- def podfile_from_spec
124
- name = spec.name
125
- podspec = file.realpath
126
- platform = @platform
127
- local = local?
128
- podfile = Pod::Podfile.new do
129
- platform(platform.to_sym, platform.deployment_target)
130
- if (local)
131
- pod name, :local => podspec.dirname.to_s
132
- else
133
- pod name, :podspec => podspec.to_s
134
- end
135
- end
136
- podfile
137
- end
138
-
139
- def set_up_lint_environment
140
- tmp_dir.rmtree if tmp_dir.exist?
141
- tmp_dir.mkpath
142
- @original_config = Config.instance.clone
143
- config.project_root = tmp_dir
144
- config.project_pods_root = tmp_dir + 'Pods'
145
- config.silent = !config.verbose
146
- config.integrate_targets = false
147
- config.generate_docs = false
148
- end
149
-
150
- def tear_down_lint_environment
151
- tmp_dir.rmtree unless no_clean
152
- Config.instance = @original_config
153
- end
154
-
155
- def tmp_dir
156
- Pathname.new('/tmp/CocoaPods/Lint')
157
- end
158
-
159
- def pod_dir
160
- tmp_dir + 'Pods' + spec.name
161
- end
162
-
163
- # It reads a podspec file and checks for strings corresponding
164
- # to features that are or will be deprecated
165
- #
166
- # @return [Array<String>]
167
- #
168
- def deprecation_errors
169
- text = @file.read
170
- deprecations = []
171
- deprecations << "`config.ios?' and `config.osx?' are deprecated" if text. =~ /config\..?os.?/
172
- deprecations << "clean_paths are deprecated and ignored (use preserve_paths)" if text. =~ /clean_paths/
173
- deprecations
174
- end
175
-
176
- # @return [Array<String>] List of the fatal defects detected in a podspec
177
- def podspec_errors
178
- messages = []
179
- messages << "The name of the spec should match the name of the file" unless names_match?
180
- messages << "Unrecognized platfrom" unless platform_valid?
181
- messages << "Missing name" unless spec.name
182
- messages << "Missing version" unless spec.version
183
- messages << "Missing summary" if !spec.summary || spec.summary.empty?
184
- messages << "Missing homepage" unless spec.homepage
185
- messages << "Missing author(s)" unless spec.authors
186
- messages << "Missing or invalid source: #{spec.source}" unless source_valid?
187
- messages << "The summary should be short use `description` (max 140 characters)." if spec.summary && spec.summary.length > 140
188
-
189
- # attributes with multiplatform values
190
- return messages unless platform_valid?
191
- messages << "The spec appears to be empty (no source files, resources, or preserve paths)" if spec.source_files.empty? && spec.subspecs.empty? && spec.resources.empty? && spec.preserve_paths.empty?
192
- messages += paths_starting_with_a_slash_errors
193
- messages += deprecation_errors
194
- messages
195
- end
196
-
197
- def names_match?
198
- return true unless spec.name
199
- root_name = spec.name.match(/[^\/]*/)[0]
200
- file.basename.to_s == root_name + '.podspec'
201
- end
202
-
203
- def platform_valid?
204
- !spec.platform || [:ios, :osx].include?(spec.platform.name)
205
- end
206
-
207
- def source_valid?
208
- spec.source && !(spec.source =~ /http:\/\/EXAMPLE/)
209
- end
210
-
211
- def paths_starting_with_a_slash_errors
212
- messages = []
213
- %w[source_files public_header_files resources clean_paths].each do |accessor|
214
- patterns = spec.send(accessor.to_sym)
215
- # Some values are multiplaform
216
- patterns = patterns.is_a?(Hash) ? patterns.values.flatten(1) : patterns
217
- patterns = patterns.compact # some patterns may be nil (public_header_files, for instance)
218
- patterns.each do |pattern|
219
- # Skip FileList that would otherwise be resolved from the working directory resulting
220
- # in a potentially very expensi operation
221
- next if pattern.is_a?(FileList)
222
- invalid = pattern.is_a?(Array) ? pattern.any? { |path| path.start_with?('/') } : pattern.start_with?('/')
223
- if invalid
224
- messages << "Paths cannot start with a slash (#{accessor})"
225
- break
226
- end
227
- end
228
- end
229
- messages
230
- end
231
-
232
- # @return [Array<String>] List of the **non** fatal defects detected in a podspec
233
- def podspec_warnings
234
- license = spec.license || {}
235
- source = spec.source || {}
236
- text = @file.read
237
- messages = []
238
- messages << "Missing license type" unless license[:type]
239
- messages << "Sample license type" if license[:type] && license[:type] =~ /\(example\)/
240
- messages << "Invalid license type" if license[:type] && license[:type] =~ /\n/
241
- messages << "The summary is not meaningful" if spec.summary =~ /A short description of/
242
- messages << "The description is not meaningful" if spec.description && spec.description =~ /An optional longer description of/
243
- messages << "The summary should end with a dot" if spec.summary !~ /.*\./
244
- messages << "The description should end with a dot" if spec.description !~ /.*\./ && spec.description != spec.summary
245
- messages << "The summary should end with a dot" if spec.summary !~ /.*\./
246
- messages << "Comments must be deleted" if text.scan(/^\s*#/).length > 24
247
- messages << "Warnings must not be disabled (`-Wno' compiler flags)" if spec.compiler_flags.split(' ').any? {|flag| flag.start_with?('-Wno') }
248
-
249
- if (git_source = source[:git])
250
- messages << "Git sources should specify either a tag or a commit" unless source[:commit] || source[:tag]
251
- if spec.version.to_s != '0.0.1'
252
- messages << "The version of the spec should be part of the git tag (not always applicable)" if source[:tag] && !source[:tag].include?(spec.version.to_s)
253
- messages << "Git sources without tag should be marked as 0.0.1 (not always applicable)" if !source[:tag]
254
- end
255
- if git_source.include?('github.com')
256
- messages << "Github repositories should end in `.git'" unless git_source.end_with?('.git')
257
- messages << "Github repositories should use `https' link" unless git_source.start_with?('https://github.com') || git_source.start_with?('git://gist.github.com')
258
- end
259
- end
260
-
261
- messages
262
- end
263
-
264
- # It creates a podfile in memory and builds a library containing
265
- # the pod for all available platfroms with xcodebuild.
266
- #
267
- # @return [Array<String>]
268
- #
269
- def xcodebuild_output
270
- return [] if `which xcodebuild`.strip.empty?
271
- messages = []
272
- output = Dir.chdir(config.project_pods_root) { `xcodebuild clean build 2>&1` }
273
- clean_output = process_xcode_build_output(output)
274
- messages += clean_output
275
- puts(output) if config.verbose?
276
- messages
277
- end
278
-
279
- def process_xcode_build_output(output)
280
- output_by_line = output.split("\n")
281
- selected_lines = output_by_line.select do |l|
282
- l.include?('error: ') && (l !~ /errors? generated\./) && (l !~ /error: \(null\)/)\
283
- || l.include?('warning: ') && (l !~ /warnings? generated\./)\
284
- || l.include?('note: ') && (l !~ /expanded from macro/)
285
- end
286
- selected_lines.map do |l|
287
- new = l.gsub(/\/tmp\/CocoaPods\/Lint\/Pods\//,'') # Remove the unnecessary tmp path
288
- new.gsub!(/^ */,' ') # Remove indentation
289
- "XCODEBUILD > " << new # Mark
290
- end
291
- end
292
-
293
- # It checks that every file pattern specified in a spec yields
294
- # at least one file. It requires the pods to be alredy present
295
- # in the current working directory under Pods/spec.name.
296
- #
297
- # @return [Array<String>]
298
- #
299
- def file_patterns_errors
300
- messages = []
301
- messages << "The sources did not match any file" if !spec.source_files.empty? && @pod.source_files.empty?
302
- messages << "The resources did not match any file" if !spec.resources.empty? && @pod.resource_files.empty?
303
- messages << "The preserve_paths did not match any file" if !spec.preserve_paths.empty? && @pod.preserve_files.empty?
304
- messages << "The exclude_header_search_paths did not match any file" if !spec.exclude_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?
305
- messages
306
- end
307
-
308
- def file_patterns_warnings
309
- messages = []
310
- unless @pod.license_file || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] )
311
- messages << "Unable to find a license file"
312
- end
313
- messages
314
- end
315
- end
316
- end
317
- end