cocoapods-core 0.31.1 → 0.32.0
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.
- checksums.yaml +4 -4
- data/lib/cocoapods-core/core_ui.rb +0 -3
- data/lib/cocoapods-core/dependency.rb +2 -5
- data/lib/cocoapods-core/gem_version.rb +1 -2
- data/lib/cocoapods-core/github.rb +2 -5
- data/lib/cocoapods-core/lockfile.rb +9 -12
- data/lib/cocoapods-core/platform.rb +15 -6
- data/lib/cocoapods-core/podfile/dsl.rb +3 -5
- data/lib/cocoapods-core/podfile/target_definition.rb +2 -5
- data/lib/cocoapods-core/podfile.rb +6 -12
- data/lib/cocoapods-core/requirement.rb +3 -7
- data/lib/cocoapods-core/source/abstract_data_provider.rb +6 -9
- data/lib/cocoapods-core/source/acceptor.rb +36 -10
- data/lib/cocoapods-core/source/aggregate.rb +2 -5
- data/lib/cocoapods-core/source/file_system_data_provider.rb +7 -10
- data/lib/cocoapods-core/source/github_data_provider.rb +13 -12
- data/lib/cocoapods-core/source/health_reporter.rb +1 -5
- data/lib/cocoapods-core/source.rb +0 -3
- data/lib/cocoapods-core/specification/consumer.rb +3 -37
- data/lib/cocoapods-core/specification/dsl/attribute.rb +15 -8
- data/lib/cocoapods-core/specification/dsl/attribute_support.rb +0 -2
- data/lib/cocoapods-core/specification/dsl/deprecations.rb +8 -7
- data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +4 -6
- data/lib/cocoapods-core/specification/dsl.rb +146 -144
- data/lib/cocoapods-core/specification/json.rb +1 -3
- data/lib/cocoapods-core/specification/linter/analyzer.rb +93 -0
- data/lib/cocoapods-core/specification/linter/result.rb +113 -0
- data/lib/cocoapods-core/specification/linter.rb +66 -278
- data/lib/cocoapods-core/specification/root_attribute_accessors.rb +26 -16
- data/lib/cocoapods-core/specification/set/presenter.rb +4 -7
- data/lib/cocoapods-core/specification/set/statistics.rb +1 -4
- data/lib/cocoapods-core/specification/set.rb +1 -4
- data/lib/cocoapods-core/specification.rb +10 -10
- data/lib/cocoapods-core/standard_error.rb +3 -5
- data/lib/cocoapods-core/vendor.rb +0 -4
- data/lib/cocoapods-core/version.rb +1 -4
- data/lib/cocoapods-core/{yaml_converter.rb → yaml_helper.rb} +22 -6
- data/lib/cocoapods-core.rb +1 -3
- metadata +5 -3
@@ -5,7 +5,6 @@ require 'cocoapods-core/specification/dsl/deprecations'
|
|
5
5
|
|
6
6
|
module Pod
|
7
7
|
class Specification
|
8
|
-
|
9
8
|
#- NOTE ------------------------------------------------------------------#
|
10
9
|
# The of the methods defined in this file and the order of the methods is
|
11
10
|
# relevant for the documentation generated on the
|
@@ -35,7 +34,7 @@ module Pod
|
|
35
34
|
# spec.license = { :type => 'BSD' }
|
36
35
|
# spec.homepage = 'https://github.com/tonymillion/Reachability'
|
37
36
|
# spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
|
38
|
-
# spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.
|
37
|
+
# spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
|
39
38
|
# spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
|
40
39
|
# spec.source_files = 'Reachability.{h,m}'
|
41
40
|
# spec.framework = 'SystemConfiguration'
|
@@ -43,7 +42,6 @@ module Pod
|
|
43
42
|
# end
|
44
43
|
#
|
45
44
|
module DSL
|
46
|
-
|
47
45
|
extend Pod::Specification::DSL::AttributeSupport
|
48
46
|
|
49
47
|
#-----------------------------------------------------------------------#
|
@@ -79,9 +77,8 @@ module Pod
|
|
79
77
|
# @param [String] name
|
80
78
|
# the name of the pod.
|
81
79
|
#
|
82
|
-
root_attribute :name,
|
83
|
-
|
84
|
-
}
|
80
|
+
root_attribute :name,
|
81
|
+
:required => true
|
85
82
|
|
86
83
|
#------------------#
|
87
84
|
|
@@ -97,9 +94,8 @@ module Pod
|
|
97
94
|
# @param [String] version
|
98
95
|
# the version of the Pod.
|
99
96
|
#
|
100
|
-
root_attribute :version,
|
101
|
-
|
102
|
-
}
|
97
|
+
root_attribute :version,
|
98
|
+
:required => true
|
103
99
|
|
104
100
|
#------------------#
|
105
101
|
|
@@ -124,12 +120,11 @@ module Pod
|
|
124
120
|
# @param [String, Hash{String=>String}] authors
|
125
121
|
# the list of the authors of the library and their emails.
|
126
122
|
#
|
127
|
-
root_attribute :authors,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
}
|
123
|
+
root_attribute :authors,
|
124
|
+
:types => [String, Array, Hash],
|
125
|
+
:container => Hash,
|
126
|
+
:required => true,
|
127
|
+
:singularize => true
|
133
128
|
|
134
129
|
#------------------#
|
135
130
|
|
@@ -210,11 +205,10 @@ module Pod
|
|
210
205
|
# allows to use the library (or the relative path to the file
|
211
206
|
# that contains it).
|
212
207
|
#
|
213
|
-
root_attribute :license,
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
}
|
208
|
+
root_attribute :license,
|
209
|
+
:container => Hash,
|
210
|
+
:keys => LICENSE_KEYS,
|
211
|
+
:required => true
|
218
212
|
|
219
213
|
#------------------#
|
220
214
|
|
@@ -224,14 +218,13 @@ module Pod
|
|
224
218
|
#
|
225
219
|
# @example
|
226
220
|
#
|
227
|
-
# spec.homepage = 'www.example.com'
|
221
|
+
# spec.homepage = 'http://www.example.com'
|
228
222
|
#
|
229
223
|
# @param [String] homepage
|
230
224
|
# the URL of the homepage of the Pod.
|
231
225
|
#
|
232
|
-
root_attribute :homepage,
|
233
|
-
|
234
|
-
}
|
226
|
+
root_attribute :homepage,
|
227
|
+
:required => true
|
235
228
|
|
236
229
|
#------------------#
|
237
230
|
|
@@ -279,11 +272,10 @@ module Pod
|
|
279
272
|
# @param [Hash{Symbol=>String}] source
|
280
273
|
# The location from where the library should be retrieved.
|
281
274
|
#
|
282
|
-
root_attribute :source,
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
}
|
275
|
+
root_attribute :source,
|
276
|
+
:container => Hash,
|
277
|
+
:keys => SOURCE_KEYS,
|
278
|
+
:required => true
|
287
279
|
|
288
280
|
#------------------#
|
289
281
|
|
@@ -307,9 +299,8 @@ module Pod
|
|
307
299
|
# @param [String] summary
|
308
300
|
# A short description of the Pod.
|
309
301
|
#
|
310
|
-
root_attribute :summary,
|
311
|
-
|
312
|
-
}
|
302
|
+
root_attribute :summary,
|
303
|
+
:required => true
|
313
304
|
|
314
305
|
#------------------#
|
315
306
|
|
@@ -337,7 +328,7 @@ module Pod
|
|
337
328
|
# @!method screenshots=(screenshots)
|
338
329
|
#
|
339
330
|
# A list of URLs to images showcasing the Pod. Intended for UI oriented
|
340
|
-
# libraries.
|
331
|
+
# libraries. CocoaPods recommends the usage of the `gif` format.
|
341
332
|
#
|
342
333
|
# @example
|
343
334
|
#
|
@@ -351,10 +342,9 @@ module Pod
|
|
351
342
|
# @param [String] screenshots
|
352
343
|
# An URL for the screenshot of the Pod.
|
353
344
|
#
|
354
|
-
root_attribute :screenshots,
|
355
|
-
|
356
|
-
|
357
|
-
}
|
345
|
+
root_attribute :screenshots,
|
346
|
+
:singularize => true,
|
347
|
+
:container => Array
|
358
348
|
|
359
349
|
#------------------#
|
360
350
|
|
@@ -366,7 +356,7 @@ module Pod
|
|
366
356
|
#
|
367
357
|
# @example
|
368
358
|
#
|
369
|
-
# spec.documentation_url = 'www.example.com/docs.html'
|
359
|
+
# spec.documentation_url = 'http://www.example.com/docs.html'
|
370
360
|
#
|
371
361
|
# @param [String] documentation_url
|
372
362
|
# The link of the web documentation of the Pod.
|
@@ -405,6 +395,37 @@ module Pod
|
|
405
395
|
#
|
406
396
|
root_attribute :prepare_command
|
407
397
|
|
398
|
+
#------------------#
|
399
|
+
|
400
|
+
# @!method deprecated=(flag)
|
401
|
+
#
|
402
|
+
# Whether the library has been deprecated.
|
403
|
+
#
|
404
|
+
# @example
|
405
|
+
#
|
406
|
+
# spec.deprecated = true
|
407
|
+
#
|
408
|
+
# @param [Bool] flag
|
409
|
+
# whether the library has been deprecated.
|
410
|
+
#
|
411
|
+
root_attribute :deprecated,
|
412
|
+
:types => [TrueClass, FalseClass],
|
413
|
+
:default_value => false
|
414
|
+
|
415
|
+
# @!method deprecated_in_favor_of=(deprecated_in_favor_of)
|
416
|
+
#
|
417
|
+
# The name of the Pod that this one has been deprecated in favor of.
|
418
|
+
#
|
419
|
+
# @example
|
420
|
+
#
|
421
|
+
# spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
|
422
|
+
#
|
423
|
+
# @param [String] deprecated_in_favor_of
|
424
|
+
# the name of the Pod that this one has been deprecated in
|
425
|
+
# favor of.
|
426
|
+
#
|
427
|
+
root_attribute :deprecated_in_favor_of
|
428
|
+
|
408
429
|
#-----------------------------------------------------------------------#
|
409
430
|
|
410
431
|
# @!group Platform
|
@@ -423,12 +444,11 @@ module Pod
|
|
423
444
|
|
424
445
|
# @todo This currently is not used in the Ruby DSL.
|
425
446
|
#
|
426
|
-
attribute :platforms,
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
}
|
447
|
+
attribute :platforms,
|
448
|
+
:container => Hash,
|
449
|
+
:keys => PLATFORMS,
|
450
|
+
:multi_platform => false,
|
451
|
+
:inherited => true
|
432
452
|
|
433
453
|
# The platform on which this Pod is supported. Leaving this blank
|
434
454
|
# means the Pod is supported on all platforms.
|
@@ -453,9 +473,9 @@ module Pod
|
|
453
473
|
def platform=(args)
|
454
474
|
name, deployment_target = args
|
455
475
|
if name
|
456
|
-
attributes_hash[
|
476
|
+
attributes_hash['platforms'] = { name.to_s => deployment_target }
|
457
477
|
else
|
458
|
-
attributes_hash[
|
478
|
+
attributes_hash['platforms'] = {}
|
459
479
|
end
|
460
480
|
end
|
461
481
|
|
@@ -524,10 +544,9 @@ module Pod
|
|
524
544
|
|
525
545
|
# @todo This currently is not used in the Ruby DSL.
|
526
546
|
#
|
527
|
-
attribute :dependencies,
|
528
|
-
|
529
|
-
|
530
|
-
}
|
547
|
+
attribute :dependencies,
|
548
|
+
:container => Hash,
|
549
|
+
:inherited => true
|
531
550
|
|
532
551
|
# Any dependency on other Pods or to a ‘sub-specification’.
|
533
552
|
#
|
@@ -558,22 +577,22 @@ module Pod
|
|
558
577
|
"subspec"
|
559
578
|
end
|
560
579
|
if @parent
|
561
|
-
composed_name =
|
562
|
-
@parent.name.split(
|
580
|
+
composed_name = ''
|
581
|
+
@parent.name.split('/').each do |component|
|
563
582
|
composed_name << component
|
564
583
|
if name == composed_name
|
565
584
|
raise Informative, "A subspec can't require one of its " \
|
566
585
|
"parents specifications"
|
567
586
|
else
|
568
|
-
composed_name <<
|
587
|
+
composed_name << '/'
|
569
588
|
end
|
570
589
|
end
|
571
590
|
end
|
572
591
|
unless version_requirements.all? { |req| req.is_a?(String) }
|
573
|
-
raise Informative,
|
592
|
+
raise Informative, 'Unsupported version requirements'
|
574
593
|
end
|
575
|
-
attributes_hash[
|
576
|
-
attributes_hash[
|
594
|
+
attributes_hash['dependencies'] ||= {}
|
595
|
+
attributes_hash['dependencies'][name] = version_requirements
|
577
596
|
end
|
578
597
|
|
579
598
|
#------------------#
|
@@ -595,11 +614,10 @@ module Pod
|
|
595
614
|
# @param [Bool] flag
|
596
615
|
# whether the source files require ARC.
|
597
616
|
#
|
598
|
-
attribute :requires_arc,
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
}
|
617
|
+
attribute :requires_arc,
|
618
|
+
:types => [TrueClass, FalseClass],
|
619
|
+
:default_value => false,
|
620
|
+
:inherited => true
|
603
621
|
|
604
622
|
#------------------#
|
605
623
|
|
@@ -619,11 +637,10 @@ module Pod
|
|
619
637
|
# @param [String, Array<String>] frameworks
|
620
638
|
# A list of framework names.
|
621
639
|
#
|
622
|
-
attribute :frameworks,
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
}
|
640
|
+
attribute :frameworks,
|
641
|
+
:container => Array,
|
642
|
+
:singularize => true,
|
643
|
+
:inherited => true
|
627
644
|
|
628
645
|
#------------------#
|
629
646
|
|
@@ -639,11 +656,10 @@ module Pod
|
|
639
656
|
# @param [String, Array<String>] weak_frameworks
|
640
657
|
# A list of frameworks names.
|
641
658
|
#
|
642
|
-
attribute :weak_frameworks,
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
}
|
659
|
+
attribute :weak_frameworks,
|
660
|
+
:container => Array,
|
661
|
+
:singularize => true,
|
662
|
+
:inherited => true
|
647
663
|
|
648
664
|
#------------------#
|
649
665
|
|
@@ -663,11 +679,10 @@ module Pod
|
|
663
679
|
# @param [String, Array<String>] libraries
|
664
680
|
# A list of library names.
|
665
681
|
#
|
666
|
-
attribute :libraries,
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
}
|
682
|
+
attribute :libraries,
|
683
|
+
:container => Array,
|
684
|
+
:singularize => true,
|
685
|
+
:inherited => true
|
671
686
|
|
672
687
|
#------------------#
|
673
688
|
|
@@ -682,11 +697,10 @@ module Pod
|
|
682
697
|
# @param [String, Array<String>] flags
|
683
698
|
# A list of flags.
|
684
699
|
#
|
685
|
-
attribute :compiler_flags,
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
}
|
700
|
+
attribute :compiler_flags,
|
701
|
+
:container => Array,
|
702
|
+
:singularize => true,
|
703
|
+
:inherited => true
|
690
704
|
|
691
705
|
#------------------#
|
692
706
|
|
@@ -701,10 +715,9 @@ module Pod
|
|
701
715
|
# @param [Hash{String => String}] value
|
702
716
|
# A representing an xcconfig.
|
703
717
|
#
|
704
|
-
attribute :xcconfig,
|
705
|
-
|
706
|
-
|
707
|
-
}
|
718
|
+
attribute :xcconfig,
|
719
|
+
:container => Hash,
|
720
|
+
:inherited => true
|
708
721
|
|
709
722
|
#------------------#
|
710
723
|
|
@@ -728,10 +741,9 @@ module Pod
|
|
728
741
|
# @param [String] content
|
729
742
|
# The contents of the prefix header.
|
730
743
|
#
|
731
|
-
attribute :prefix_header_contents,
|
732
|
-
|
733
|
-
|
734
|
-
}
|
744
|
+
attribute :prefix_header_contents,
|
745
|
+
:types => [Array, String],
|
746
|
+
:inherited => true
|
735
747
|
|
736
748
|
#------------------#
|
737
749
|
|
@@ -752,9 +764,8 @@ module Pod
|
|
752
764
|
# @param [String] path
|
753
765
|
# The path to the prefix header file.
|
754
766
|
#
|
755
|
-
attribute :prefix_header_file,
|
756
|
-
|
757
|
-
}
|
767
|
+
attribute :prefix_header_file,
|
768
|
+
:inherited => true
|
758
769
|
|
759
770
|
#------------------#
|
760
771
|
|
@@ -770,9 +781,8 @@ module Pod
|
|
770
781
|
# @param [String] dir
|
771
782
|
# the headers directory.
|
772
783
|
#
|
773
|
-
attribute :header_dir,
|
774
|
-
|
775
|
-
}
|
784
|
+
attribute :header_dir,
|
785
|
+
:inherited => true
|
776
786
|
|
777
787
|
#------------------#
|
778
788
|
|
@@ -788,9 +798,8 @@ module Pod
|
|
788
798
|
# @param [String] dir
|
789
799
|
# the directory from where to preserve the headers namespacing.
|
790
800
|
#
|
791
|
-
attribute :header_mappings_dir,
|
792
|
-
|
793
|
-
}
|
801
|
+
attribute :header_mappings_dir,
|
802
|
+
:inherited => true
|
794
803
|
|
795
804
|
#-----------------------------------------------------------------------#
|
796
805
|
|
@@ -887,10 +896,9 @@ module Pod
|
|
887
896
|
# @param [String, Array<String>] source_files
|
888
897
|
# the source files of the Pod.
|
889
898
|
#
|
890
|
-
attribute :source_files,
|
891
|
-
|
892
|
-
|
893
|
-
}
|
899
|
+
attribute :source_files,
|
900
|
+
:container => Array,
|
901
|
+
:file_patterns => true
|
894
902
|
|
895
903
|
#------------------#
|
896
904
|
|
@@ -911,10 +919,9 @@ module Pod
|
|
911
919
|
# @param [String, Array<String>] public_header_files
|
912
920
|
# the public headers of the Pod.
|
913
921
|
#
|
914
|
-
attribute :public_header_files,
|
915
|
-
|
916
|
-
|
917
|
-
}
|
922
|
+
attribute :public_header_files,
|
923
|
+
:container => Array,
|
924
|
+
:file_patterns => true
|
918
925
|
|
919
926
|
#------------------#
|
920
927
|
|
@@ -936,10 +943,9 @@ module Pod
|
|
936
943
|
# @param [String, Array<String>] private_header_files
|
937
944
|
# the private headers of the Pod.
|
938
945
|
#
|
939
|
-
attribute :private_header_files,
|
940
|
-
|
941
|
-
|
942
|
-
}
|
946
|
+
attribute :private_header_files,
|
947
|
+
:container => Array,
|
948
|
+
:file_patterns => true
|
943
949
|
|
944
950
|
#------------------#
|
945
951
|
|
@@ -958,11 +964,10 @@ module Pod
|
|
958
964
|
# @param [String, Array<String>] vendored_frameworks
|
959
965
|
# A list of framework bundles paths.
|
960
966
|
#
|
961
|
-
attribute :vendored_frameworks,
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
}
|
967
|
+
attribute :vendored_frameworks,
|
968
|
+
:container => Array,
|
969
|
+
:file_patterns => true,
|
970
|
+
:singularize => true
|
966
971
|
|
967
972
|
#------------------#
|
968
973
|
|
@@ -981,11 +986,10 @@ module Pod
|
|
981
986
|
# @param [String, Array<String>] vendored_libraries
|
982
987
|
# A list of library paths.
|
983
988
|
#
|
984
|
-
attribute :vendored_libraries,
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
}
|
989
|
+
attribute :vendored_libraries,
|
990
|
+
:container => Array,
|
991
|
+
:file_patterns => true,
|
992
|
+
:singularize => true
|
989
993
|
|
990
994
|
#------------------#
|
991
995
|
|
@@ -1012,18 +1016,20 @@ module Pod
|
|
1012
1016
|
#
|
1013
1017
|
# @example
|
1014
1018
|
#
|
1015
|
-
# spec.resource_bundles = {
|
1019
|
+
# spec.resource_bundles = {
|
1020
|
+
# 'MapBox' => ['MapView/Map/Resources/*.png'],
|
1021
|
+
# 'OtherResources' => ['MapView/Map/OtherResources/*.png']
|
1022
|
+
# }
|
1016
1023
|
#
|
1017
1024
|
# @param [Hash{String=>String}] resource_bundles
|
1018
1025
|
# A hash where the keys are the names of the resource bundles
|
1019
1026
|
# and the values are their relative file patterns.
|
1020
1027
|
#
|
1021
|
-
attribute :resource_bundles,
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
}
|
1028
|
+
attribute :resource_bundles,
|
1029
|
+
:types => [String, Array],
|
1030
|
+
:container => Hash,
|
1031
|
+
:file_patterns => true,
|
1032
|
+
:singularize => true
|
1027
1033
|
|
1028
1034
|
#------------------#
|
1029
1035
|
|
@@ -1048,11 +1054,10 @@ module Pod
|
|
1048
1054
|
# @param [String, Array<String>] resources
|
1049
1055
|
# The resources shipped with the Pod.
|
1050
1056
|
#
|
1051
|
-
attribute :resources,
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
}
|
1057
|
+
attribute :resources,
|
1058
|
+
:container => Array,
|
1059
|
+
:file_patterns => true,
|
1060
|
+
:singularize => true
|
1056
1061
|
|
1057
1062
|
#------------------#
|
1058
1063
|
|
@@ -1072,10 +1077,9 @@ module Pod
|
|
1072
1077
|
# @param [String, Array<String>] exclude_files
|
1073
1078
|
# the file patterns that the Pod should ignore.
|
1074
1079
|
#
|
1075
|
-
attribute :exclude_files,
|
1076
|
-
|
1077
|
-
|
1078
|
-
}
|
1080
|
+
attribute :exclude_files,
|
1081
|
+
:container => Array,
|
1082
|
+
:file_patterns => true
|
1079
1083
|
|
1080
1084
|
#------------------#
|
1081
1085
|
|
@@ -1099,11 +1103,10 @@ module Pod
|
|
1099
1103
|
# @param [String, Array<String>] preserve_paths
|
1100
1104
|
# the paths that should be not cleaned.
|
1101
1105
|
#
|
1102
|
-
attribute :preserve_paths,
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
}
|
1106
|
+
attribute :preserve_paths,
|
1107
|
+
:container => Array,
|
1108
|
+
:file_patterns => true,
|
1109
|
+
:singularize => true
|
1107
1110
|
|
1108
1111
|
#-----------------------------------------------------------------------#
|
1109
1112
|
|
@@ -1212,9 +1215,8 @@ module Pod
|
|
1212
1215
|
# the name of the subspec that should be inherited as
|
1213
1216
|
# dependency.
|
1214
1217
|
#
|
1215
|
-
attribute :default_subspec,
|
1216
|
-
|
1217
|
-
}
|
1218
|
+
attribute :default_subspec,
|
1219
|
+
:multi_platform => false
|
1218
1220
|
|
1219
1221
|
#-----------------------------------------------------------------------#
|
1220
1222
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Pod
|
2
2
|
class Specification
|
3
3
|
module JSONSupport
|
4
|
-
|
5
4
|
# @return [String] the json representation of the specification.
|
6
5
|
#
|
7
6
|
def to_json(*a)
|
@@ -17,7 +16,7 @@ module Pod
|
|
17
16
|
def to_hash
|
18
17
|
hash = attributes_hash.dup
|
19
18
|
unless subspecs.empty?
|
20
|
-
hash[
|
19
|
+
hash['subspecs'] = subspecs.map { |spec| spec.to_hash }
|
21
20
|
end
|
22
21
|
hash
|
23
22
|
end
|
@@ -65,6 +64,5 @@ module Pod
|
|
65
64
|
end
|
66
65
|
|
67
66
|
#-----------------------------------------------------------------------#
|
68
|
-
|
69
67
|
end
|
70
68
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'cocoapods-core/specification/linter/result'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Specification
|
5
|
+
class Linter
|
6
|
+
class Analyzer
|
7
|
+
include Linter::ResultHelpers
|
8
|
+
|
9
|
+
def initialize(consumer)
|
10
|
+
@consumer = consumer
|
11
|
+
@results = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def analyze
|
15
|
+
validate_file_patterns
|
16
|
+
check_tmp_arc_not_nil
|
17
|
+
check_if_spec_is_empty
|
18
|
+
check_install_hooks
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :consumer
|
24
|
+
|
25
|
+
# Checks the attributes that represent file patterns.
|
26
|
+
#
|
27
|
+
# @todo Check the attributes hash directly.
|
28
|
+
#
|
29
|
+
def validate_file_patterns
|
30
|
+
attributes = DSL.attributes.values.select(&:file_patterns?)
|
31
|
+
attributes.each do |attrb|
|
32
|
+
patterns = consumer.send(attrb.name)
|
33
|
+
if patterns.is_a?(Hash)
|
34
|
+
patterns = patterns.values.flatten(1)
|
35
|
+
end
|
36
|
+
patterns.each do |pattern|
|
37
|
+
if pattern.start_with?('/')
|
38
|
+
error "File patterns must be relative and cannot start with a " \
|
39
|
+
"slash (#{attrb.name})."
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# @todo remove after the switch to true
|
46
|
+
#
|
47
|
+
def check_tmp_arc_not_nil
|
48
|
+
spec = consumer.spec
|
49
|
+
declared = false
|
50
|
+
loop do
|
51
|
+
declared = true unless spec.attributes_hash['requires_arc'].nil?
|
52
|
+
declared = true unless spec.attributes_hash[consumer.platform_name.to_s].nil?
|
53
|
+
spec = spec.parent
|
54
|
+
break unless spec
|
55
|
+
end
|
56
|
+
|
57
|
+
unless declared
|
58
|
+
warning "A value for `requires_arc` should be specified until the " \
|
59
|
+
"migration to a `true` default."
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check empty subspec attributes
|
64
|
+
#
|
65
|
+
def check_if_spec_is_empty
|
66
|
+
methods = %w( source_files resources resource_bundles preserve_paths dependencies
|
67
|
+
vendored_libraries vendored_frameworks )
|
68
|
+
empty_patterns = methods.all? { |m| consumer.send(m).empty? }
|
69
|
+
empty = empty_patterns && consumer.spec.subspecs.empty?
|
70
|
+
if empty
|
71
|
+
error "The #{consumer.spec} spec is empty (no source files, " \
|
72
|
+
"resources, resource_bundles, preserve paths, vendored_libraries, " \
|
73
|
+
"vendored_frameworks dependencies or subspecs)."
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check the hooks
|
78
|
+
#
|
79
|
+
def check_install_hooks
|
80
|
+
unless consumer.spec.pre_install_callback.nil?
|
81
|
+
warning "The pre install hook has been deprecated, " \
|
82
|
+
"use the `resource_bundles` or the `prepare_command` attributes."
|
83
|
+
end
|
84
|
+
|
85
|
+
unless consumer.spec.post_install_callback.nil?
|
86
|
+
warning "The post install hook has been deprecated, " \
|
87
|
+
"use the `resource_bundles` or the `prepare_command` attributes."
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|