cocoapods 0.37.1 → 0.37.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/lib/cocoapods/command/outdated.rb +2 -0
  4. data/lib/cocoapods/command/repo/lint.rb +2 -0
  5. data/lib/cocoapods/command/repo/push.rb +9 -3
  6. data/lib/cocoapods/command/spec/edit.rb +7 -0
  7. data/lib/cocoapods/config.rb +12 -0
  8. data/lib/cocoapods/downloader/cache.rb +8 -3
  9. data/lib/cocoapods/downloader/request.rb +5 -0
  10. data/lib/cocoapods/executable.rb +9 -1
  11. data/lib/cocoapods/external_sources.rb +13 -0
  12. data/lib/cocoapods/external_sources/abstract_external_source.rb +8 -1
  13. data/lib/cocoapods/gem_version.rb +1 -1
  14. data/lib/cocoapods/generator/copy_resources_script.rb +7 -3
  15. data/lib/cocoapods/generator/header.rb +2 -0
  16. data/lib/cocoapods/generator/info_plist_file.rb +2 -0
  17. data/lib/cocoapods/generator/module_map.rb +5 -3
  18. data/lib/cocoapods/generator/prefix_header.rb +2 -0
  19. data/lib/cocoapods/generator/target_environment_header.rb +1 -4
  20. data/lib/cocoapods/generator/umbrella_header.rb +2 -0
  21. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +3 -1
  22. data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +2 -0
  23. data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +2 -0
  24. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +14 -7
  25. data/lib/cocoapods/hooks/installer_representation.rb +2 -0
  26. data/lib/cocoapods/hooks/library_representation.rb +4 -2
  27. data/lib/cocoapods/hooks/pod_representation.rb +6 -6
  28. data/lib/cocoapods/hooks_manager.rb +2 -0
  29. data/lib/cocoapods/installer.rb +43 -2
  30. data/lib/cocoapods/installer/analyzer.rb +16 -3
  31. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +3 -1
  32. data/lib/cocoapods/installer/file_references_installer.rb +3 -1
  33. data/lib/cocoapods/installer/hooks_context.rb +9 -0
  34. data/lib/cocoapods/installer/migrator.rb +22 -1
  35. data/lib/cocoapods/installer/pod_source_installer.rb +16 -8
  36. data/lib/cocoapods/installer/pod_source_preparer.rb +2 -0
  37. data/lib/cocoapods/installer/user_project_integrator.rb +4 -2
  38. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +6 -2
  39. data/lib/cocoapods/open_uri.rb +8 -0
  40. data/lib/cocoapods/project.rb +3 -1
  41. data/lib/cocoapods/resolver.rb +10 -10
  42. data/lib/cocoapods/sandbox.rb +4 -0
  43. data/lib/cocoapods/sandbox/file_accessor.rb +3 -1
  44. data/lib/cocoapods/sandbox/headers_store.rb +4 -4
  45. data/lib/cocoapods/sandbox/path_list.rb +25 -6
  46. data/lib/cocoapods/sources_manager.rb +3 -1
  47. data/lib/cocoapods/target.rb +1 -1
  48. data/lib/cocoapods/target/aggregate_target.rb +8 -2
  49. data/lib/cocoapods/user_interface.rb +62 -0
  50. data/lib/cocoapods/validator.rb +6 -2
  51. metadata +34 -33
@@ -119,6 +119,8 @@ module Pod
119
119
 
120
120
  # @!group Private implementation
121
121
 
122
+ # Initialize a new instance
123
+ #
122
124
  # @param [Installer] installer @see installer
123
125
  #
124
126
  def initialize(installer)
@@ -61,7 +61,7 @@ module Pod
61
61
  #
62
62
  attr_reader :sandbox
63
63
 
64
- # @return [Library] The library whose target needs to be generated.
64
+ # @return [Target] The library whose target needs to be generated.
65
65
  #
66
66
  attr_reader :library
67
67
 
@@ -76,8 +76,10 @@ module Pod
76
76
 
77
77
  # @!group Private implementation
78
78
 
79
+ # Initialize a new instance
80
+ #
79
81
  # @param [Sandbox] sandbox @see sandbox
80
- # @param [Library] library @see library
82
+ # @param [Target] library @see library
81
83
  #
82
84
  def initialize(sandbox, library)
83
85
  @sandbox = sandbox
@@ -11,35 +11,35 @@ module Pod
11
11
  # Stores the information of the Installer for the hooks
12
12
  #
13
13
  class PodRepresentation
14
- # @return [String]
14
+ # @return [String] the name of the pod
15
15
  #
16
16
  attr_accessor :name
17
17
 
18
- # @return [Version]
18
+ # @return [Version] the version
19
19
  #
20
20
  def version
21
21
  root_spec.version
22
22
  end
23
23
 
24
- # @return [Specification]
24
+ # @return [Specification] the root spec
25
25
  #
26
26
  def root_spec
27
27
  file_accessors.first.spec.root
28
28
  end
29
29
 
30
- # @return [Array<Specification>]
30
+ # @return [Array<Specification>] the specs
31
31
  #
32
32
  def specs
33
33
  file_accessors.map(&:spec).uniq
34
34
  end
35
35
 
36
- # @return [Pathname]
36
+ # @return [Pathname] the root path
37
37
  #
38
38
  def root
39
39
  file_accessors.first.path_list.root
40
40
  end
41
41
 
42
- # @return [Array<Pathname>]
42
+ # @return [Array<Pathname>] the source files
43
43
  #
44
44
  def source_files
45
45
  file_accessors.map(&:source_files).flatten.uniq
@@ -34,6 +34,8 @@ module Pod
34
34
  #
35
35
  attr_reader :block
36
36
 
37
+ # Initialize a new instance
38
+ #
37
39
  # @param [String] name @see {#name}.
38
40
  #
39
41
  # @param [String] plugin_name @see {#plugin_name}.
@@ -55,6 +55,8 @@ module Pod
55
55
  #
56
56
  attr_reader :lockfile
57
57
 
58
+ # Initialize a new instance
59
+ #
58
60
  # @param [Sandbox] sandbox @see sandbox
59
61
  # @param [Podfile] podfile @see podfile
60
62
  # @param [Lockfile] lockfile @see lockfile
@@ -122,6 +124,7 @@ module Pod
122
124
  install_pod_sources
123
125
  run_pre_install_hooks
124
126
  clean_pod_sources
127
+ lock_pod_sources
125
128
  end
126
129
  end
127
130
 
@@ -133,6 +136,7 @@ module Pod
133
136
  set_target_dependencies
134
137
  run_podfile_post_install_hooks
135
138
  write_pod_project
139
+ share_development_pod_schemes
136
140
  write_lockfiles
137
141
  end
138
142
  end
@@ -171,6 +175,8 @@ module Pod
171
175
 
172
176
  # @!group Installation steps
173
177
 
178
+ # Performs the analysis.
179
+ #
174
180
  # @return [void]
175
181
  #
176
182
  # @note The warning about the version of the Lockfile doesn't use the
@@ -316,6 +322,16 @@ module Pod
316
322
  @pod_installers.each(&:clean!)
317
323
  end
318
324
 
325
+ # Locks the sources of the Pods if the config instructs to do so.
326
+ #
327
+ # @todo Why the @pod_installers might be empty?
328
+ #
329
+ def lock_pod_sources
330
+ return unless config.lock_pod_source?
331
+ return unless @pod_installers
332
+ @pod_installers.each(&:lock_files!)
333
+ end
334
+
319
335
  # Determines if the dependencies need to be built as dynamic frameworks or
320
336
  # if they can be built as static libraries by checking for the Swift source
321
337
  # presence. Therefore it is important that the file accessors of the
@@ -589,6 +605,20 @@ module Pod
589
605
  end
590
606
  end
591
607
 
608
+ # Shares schemes of development Pods.
609
+ #
610
+ # @return [void]
611
+ #
612
+ def share_development_pod_schemes
613
+ development_pod_targets = sandbox.development_pods.keys.map do |pod|
614
+ pods_project.targets.select { |target| target.name =~ /^Pods-.*-#{pod}$/ }
615
+ end.flatten
616
+
617
+ development_pod_targets.each do |pod_target|
618
+ Xcodeproj::XCScheme.share_scheme(pods_project.path, pod_target.name)
619
+ end
620
+ end
621
+
592
622
  # Writes the Podfile and the lock files.
593
623
  #
594
624
  # @todo Pass the checkout options to the Lockfile.
@@ -696,18 +726,20 @@ module Pod
696
726
 
697
727
  # @!group Hooks Data
698
728
 
729
+ # Creates a hook representation for this installer.
730
+ #
699
731
  # @return [InstallerRepresentation]
700
732
  #
701
733
  def installer_rep
702
734
  Hooks::InstallerRepresentation.new(self)
703
735
  end
704
736
 
705
- # @return [PodRepresentation] The hook representation of a Pod.
737
+ # Creates a hook representation for a Pod.
706
738
  #
707
739
  # @param [String] pod
708
740
  # The name of the pod.
709
741
  #
710
- # @return [PodRepresentation] The pod representation.
742
+ # @return [PodRepresentation]
711
743
  #
712
744
  def pod_rep(pod)
713
745
  all_file_accessors = pod_targets.map(&:file_accessors).flatten.compact
@@ -715,18 +747,27 @@ module Pod
715
747
  Hooks::PodRepresentation.new(pod, file_accessors)
716
748
  end
717
749
 
750
+ # Creates a hook representation for a given aggregate target.
751
+ #
752
+ # @param [AggregateTarget] aggregate_target
753
+ # the aggregate target
754
+ #
718
755
  # @return [LibraryRepresentation]
719
756
  #
720
757
  def library_rep(aggregate_target)
721
758
  Hooks::LibraryRepresentation.new(sandbox, aggregate_target)
722
759
  end
723
760
 
761
+ # Creates hook representations for all aggregate targets.
762
+ #
724
763
  # @return [Array<LibraryRepresentation>]
725
764
  #
726
765
  def library_reps
727
766
  @library_reps ||= aggregate_targets.map { |lib| library_rep(lib) }
728
767
  end
729
768
 
769
+ # Creates hook representations for all #root_specs.
770
+ #
730
771
  # @return [Array<PodRepresentation>]
731
772
  #
732
773
  def pod_reps
@@ -24,6 +24,8 @@ module Pod
24
24
  #
25
25
  attr_reader :lockfile
26
26
 
27
+ # Initialize a new instance
28
+ #
27
29
  # @param [Sandbox] sandbox @see sandbox
28
30
  # @param [Podfile] podfile @see podfile
29
31
  # @param [Lockfile] lockfile @see lockfile
@@ -44,6 +46,9 @@ module Pod
44
46
  # compute which specification should be installed. The manifest of the
45
47
  # sandbox returns which specifications are installed.
46
48
  #
49
+ # @param [Bool] allow_fetches
50
+ # whether external sources may be fetched
51
+ #
47
52
  # @return [AnalysisResult]
48
53
  #
49
54
  def analyze(allow_fetches = true)
@@ -72,6 +77,9 @@ module Pod
72
77
  podfile_needs_install?(analysis_result) || sandbox_needs_install?(analysis_result)
73
78
  end
74
79
 
80
+ # @param [AnalysisResult] analysis_result
81
+ # the analysis result to check for changes
82
+ #
75
83
  # @return [Bool] Whether the podfile has changes respect to the lockfile.
76
84
  #
77
85
  def podfile_needs_install?(analysis_result)
@@ -80,6 +88,9 @@ module Pod
80
88
  !needing_install.empty?
81
89
  end
82
90
 
91
+ # @param [AnalysisResult] analysis_result
92
+ # the analysis result to check for changes
93
+ #
83
94
  # @return [Bool] Whether the sandbox is in synch with the lockfile.
84
95
  #
85
96
  def sandbox_needs_install?(analysis_result)
@@ -181,7 +192,7 @@ module Pod
181
192
 
182
193
  # Creates the models that represent the libraries generated by CocoaPods.
183
194
  #
184
- # @return [Array<Libraries>] the generated libraries.
195
+ # @return [Array<Target>] the generated libraries.
185
196
  #
186
197
  def generate_targets
187
198
  targets = []
@@ -757,6 +768,8 @@ module Pod
757
768
  # subspecs are added instead of the name of the Pods.
758
769
  #
759
770
  class SpecsState
771
+ # Initialize a new instance
772
+ #
760
773
  # @param [Hash{Symbol=>String}] pods_by_state
761
774
  # The name of the pods grouped by their state
762
775
  # (`:added`, `:removed`, `:changed` or `:unchanged`).
@@ -804,10 +817,10 @@ module Pod
804
817
 
805
818
  # Adds the name of a Pod to the give state.
806
819
  #
807
- # @param [String]
820
+ # @param [String] name
808
821
  # the name of the Pod.
809
822
  #
810
- # @param [Symbol]
823
+ # @param [Symbol] state
811
824
  # the state of the Pod.
812
825
  #
813
826
  # @return [void]
@@ -51,6 +51,8 @@ module Pod
51
51
  #
52
52
  attr_reader :lockfile
53
53
 
54
+ # Init a new SandboxAnalyzer
55
+ #
54
56
  # @param [Sandbox] sandbox @see sandbox
55
57
  # @param [Array<Specifications>] specs @see specs
56
58
  # @param [Bool] update_mode @see update_mode
@@ -66,7 +68,7 @@ module Pod
66
68
  # Performs the analysis to the detect the state of the sandbox respect
67
69
  # to the resolved specifications.
68
70
  #
69
- # @return [SpecsState] the state of the sandbox.
71
+ # @return [void]
70
72
  #
71
73
  def analyze
72
74
  state = SpecsState.new
@@ -16,6 +16,8 @@ module Pod
16
16
  #
17
17
  attr_reader :pods_project
18
18
 
19
+ # Initialize a new instance
20
+ #
19
21
  # @param [Sandbox] sandbox @see sandbox
20
22
  # @param [Array<PodTarget>] libraries @see libraries
21
23
  # @param [Project] libraries @see libraries
@@ -153,7 +155,7 @@ module Pod
153
155
  # The key of the group of the Pods project.
154
156
  #
155
157
  # @param [Bool] reflect_file_system_structure_for_development
156
- # Wether organizing the a local pod's files in subgroups inside
158
+ # Whether organizing a local pod's files in subgroups inside
157
159
  # the pod's group is allowed.
158
160
  #
159
161
  # @return [void]
@@ -13,6 +13,15 @@ module Pod
13
13
  #
14
14
  attr_accessor :umbrella_targets
15
15
 
16
+ # Generate a {HooksContext}.
17
+ #
18
+ # @param [Sandbox] sandbox
19
+ # The sandbox
20
+ #
21
+ # @param [Array<AggregateTarget>] aggregate_targets
22
+ # The aggregate targets, which will been presented by an adequate
23
+ # {UmbrellaTargetDescription} in the generated context.
24
+ #
16
25
  # @return [HooksContext] Convenience class method to generate the
17
26
  # static context.
18
27
  #
@@ -8,7 +8,8 @@ module Pod
8
8
  class << self
9
9
  # Performs the migration.
10
10
  #
11
- # @param [Sandbox] The sandbox which should be migrated.
11
+ # @param [Sandbox] sandbox
12
+ # The sandbox which should be migrated.
12
13
  #
13
14
  def migrate(sandbox)
14
15
  if sandbox.manifest
@@ -21,6 +22,8 @@ module Pod
21
22
 
22
23
  # Migrates from CocoaPods versions previous to 0.34.
23
24
  #
25
+ # @param [Sandbox] sandbox
26
+ #
24
27
  def migrate_to_0_34(sandbox)
25
28
  UI.message('Migrating to CocoaPods 0.34') do
26
29
  delete(sandbox.root + 'Headers')
@@ -49,6 +52,8 @@ module Pod
49
52
 
50
53
  # Migrates from CocoaPods versions prior to 0.36.
51
54
  #
55
+ # @param [Sandbox] sandbox
56
+ #
52
57
  def migrate_to_0_36(sandbox)
53
58
  UI.message('Migrating to CocoaPods 0.36') do
54
59
  move(sandbox.root + 'Headers/Build', sandbox.root + 'Headers/Private')
@@ -69,6 +74,16 @@ module Pod
69
74
 
70
75
  # @!group Private helpers
71
76
 
77
+ # Check whether a migration is required
78
+ #
79
+ # @param [#to_s] target_version
80
+ # See Version#new.
81
+ #
82
+ # @param [Sandbox] sandbox
83
+ # The sandbox
84
+ #
85
+ # @return [void]
86
+ #
72
87
  def installation_minor?(target_version, sandbox)
73
88
  sandbox.manifest.cocoapods_version < Version.new(target_version)
74
89
  end
@@ -79,6 +94,8 @@ module Pod
79
94
  # @path [#to_s] path
80
95
  # The path.
81
96
  #
97
+ # @return [void]
98
+ #
82
99
  def make_path(path)
83
100
  return if path.exist?
84
101
  UI.message "- Making path #{UI.path(path)}" do
@@ -94,6 +111,8 @@ module Pod
94
111
  # @path [#to_s] destination
95
112
  # The destination path.
96
113
  #
114
+ # @return [void]
115
+ #
97
116
  def move(source, destination)
98
117
  return unless source.exist?
99
118
  make_path(destination.dirname)
@@ -108,6 +127,8 @@ module Pod
108
127
  # @path [#to_s] path
109
128
  # The path.
110
129
  #
130
+ # @return [void]
131
+ #
111
132
  def delete(path)
112
133
  return unless path.exist?
113
134
  UI.message "- Deleting #{UI.path(path)}" do
@@ -8,7 +8,7 @@ module Pod
8
8
  # @note This class needs to consider all the activated specs of a Pod.
9
9
  #
10
10
  class PodSourceInstaller
11
- # @return [Sandbox]
11
+ # @return [Sandbox] The installation target.
12
12
  #
13
13
  attr_reader :sandbox
14
14
 
@@ -17,6 +17,8 @@ module Pod
17
17
  #
18
18
  attr_reader :specs_by_platform
19
19
 
20
+ # Initialize a new instance
21
+ #
20
22
  # @param [Sandbox] sandbox @see sandbox
21
23
  # @param [Hash{Symbol=>Array}] specs_by_platform @see specs_by_platform
22
24
  #
@@ -44,7 +46,6 @@ module Pod
44
46
  def install!
45
47
  download_source unless predownloaded? || local?
46
48
  PodSourcePreparer.new(root_spec, root).prepare! if local?
47
- lock_files!
48
49
  end
49
50
 
50
51
  # Cleans the installations if appropriate.
@@ -58,7 +59,18 @@ module Pod
58
59
  clean_installation unless local?
59
60
  end
60
61
 
61
- # @return [Hash]
62
+ # Locks the source files if appropriate.
63
+ #
64
+ # @todo As the pre install hooks need to run before cleaning this
65
+ # method should be refactored.
66
+ #
67
+ # @return [void]
68
+ #
69
+ def lock_files!
70
+ lock_installation unless local?
71
+ end
72
+
73
+ # @return [Hash] @see Downloader#checkout_options
62
74
  #
63
75
  attr_reader :specific_source
64
76
 
@@ -95,11 +107,7 @@ module Pod
95
107
  #
96
108
  # @return [void]
97
109
  #
98
- def lock_files!
99
- if local?
100
- return
101
- end
102
-
110
+ def lock_installation
103
111
  # We don't want to lock diretories, as that forces you to override
104
112
  # those permissions if you decide to delete the Pods folder.
105
113
  Dir.glob(root + '**/*').each do |file|