cocoapods 1.5.3 → 1.6.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +200 -0
- data/lib/cocoapods.rb +0 -1
- data/lib/cocoapods/command/init.rb +1 -1
- data/lib/cocoapods/command/install.rb +7 -0
- data/lib/cocoapods/command/lib/lint.rb +8 -1
- data/lib/cocoapods/command/outdated.rb +2 -7
- data/lib/cocoapods/command/repo/add.rb +1 -1
- data/lib/cocoapods/command/repo/list.rb +1 -1
- data/lib/cocoapods/command/repo/push.rb +17 -12
- data/lib/cocoapods/command/repo/remove.rb +1 -1
- data/lib/cocoapods/command/repo/update.rb +1 -1
- data/lib/cocoapods/command/setup.rb +1 -1
- data/lib/cocoapods/command/spec/create.rb +39 -39
- data/lib/cocoapods/command/spec/lint.rb +8 -1
- data/lib/cocoapods/config.rb +13 -2
- data/lib/cocoapods/downloader/cache.rb +1 -1
- data/lib/cocoapods/executable.rb +2 -2
- data/lib/cocoapods/external_sources.rb +7 -4
- data/lib/cocoapods/external_sources/abstract_external_source.rb +23 -13
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +6 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +11 -0
- data/lib/cocoapods/generator/app_target_helper.rb +102 -16
- data/lib/cocoapods/generator/copy_resources_script.rb +6 -0
- data/lib/cocoapods/generator/dummy_source.rb +14 -5
- data/lib/cocoapods/generator/embed_frameworks_script.rb +13 -2
- data/lib/cocoapods/generator/header.rb +1 -1
- data/lib/cocoapods/generator/info_plist_file.rb +12 -4
- data/lib/cocoapods/generator/prefix_header.rb +2 -2
- data/lib/cocoapods/hooks_manager.rb +28 -17
- data/lib/cocoapods/installer.rb +103 -42
- data/lib/cocoapods/installer/analyzer.rb +362 -277
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +52 -22
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +9 -6
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +4 -5
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +3 -14
- data/lib/cocoapods/installer/analyzer/specs_state.rb +28 -4
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +24 -16
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +17 -11
- data/lib/cocoapods/installer/pod_source_installer.rb +31 -43
- data/lib/cocoapods/installer/post_install_hooks_context.rb +71 -46
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +22 -13
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +3 -1
- data/lib/cocoapods/installer/user_project_integrator.rb +0 -2
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +38 -28
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +44 -11
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +129 -119
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +25 -16
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +95 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +12 -45
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +277 -169
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +31 -24
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +93 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +60 -69
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +72 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +15 -9
- data/lib/cocoapods/project.rb +14 -14
- data/lib/cocoapods/resolver.rb +38 -50
- data/lib/cocoapods/sandbox.rb +22 -38
- data/lib/cocoapods/sandbox/file_accessor.rb +11 -6
- data/lib/cocoapods/sandbox/headers_store.rb +9 -8
- data/lib/cocoapods/sandbox/path_list.rb +5 -8
- data/lib/cocoapods/sources_manager.rb +1 -1
- data/lib/cocoapods/target.rb +92 -37
- data/lib/cocoapods/target/aggregate_target.rb +140 -84
- data/lib/cocoapods/target/build_settings.rb +1076 -0
- data/lib/cocoapods/target/pod_target.rb +198 -294
- data/lib/cocoapods/user_interface.rb +5 -0
- data/lib/cocoapods/validator.rb +133 -41
- metadata +18 -18
- data/lib/cocoapods/generator/xcconfig.rb +0 -13
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
- data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -87
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -558
@@ -1,45 +1,52 @@
|
|
1
1
|
module Pod
|
2
2
|
class Installer
|
3
3
|
class Analyzer
|
4
|
+
# A simple container produced after a analysis is completed by the {Analyzer}.
|
5
|
+
#
|
4
6
|
class AnalysisResult
|
5
7
|
# @return [SpecsState] the states of the Podfile specs.
|
6
8
|
#
|
7
|
-
|
9
|
+
attr_reader :podfile_state
|
8
10
|
|
9
|
-
# @return [Hash{TargetDefinition => Array<Specification>}] the
|
10
|
-
# specifications grouped by target.
|
11
|
+
# @return [Hash{TargetDefinition => Array<Specification>}] the specifications grouped by target.
|
11
12
|
#
|
12
|
-
|
13
|
+
attr_reader :specs_by_target
|
13
14
|
|
14
|
-
# @return [Hash{Source => Array<Specification>}] the
|
15
|
-
# specifications grouped by spec repo source.
|
15
|
+
# @return [Hash{Source => Array<Specification>}] the specifications grouped by spec repo source.
|
16
16
|
#
|
17
|
-
|
17
|
+
attr_reader :specs_by_source
|
18
18
|
|
19
|
-
# @return [Array<Specification>] the specifications of the resolved
|
20
|
-
# version of Pods that should be installed.
|
19
|
+
# @return [Array<Specification>] the specifications of the resolved version of Pods that should be installed.
|
21
20
|
#
|
22
|
-
|
21
|
+
attr_reader :specifications
|
23
22
|
|
24
|
-
# @return [SpecsState] the states of the {Sandbox} respect the resolved
|
25
|
-
# specifications.
|
23
|
+
# @return [SpecsState] the states of the {Sandbox} respect the resolved specifications.
|
26
24
|
#
|
27
|
-
|
25
|
+
attr_reader :sandbox_state
|
28
26
|
|
29
|
-
# @return [Array<AggregateTarget>] The aggregate targets created for each
|
30
|
-
# {TargetDefinition} from the {Podfile}.
|
27
|
+
# @return [Array<AggregateTarget>] The aggregate targets created for each {TargetDefinition} from the {Podfile}.
|
31
28
|
#
|
32
|
-
|
29
|
+
attr_reader :targets
|
33
30
|
|
34
|
-
# @return [
|
35
|
-
# results of inspecting the user targets
|
31
|
+
# @return [Array<PodTarget>] The pod targets created for all the aggregate targets.
|
36
32
|
#
|
37
|
-
|
33
|
+
attr_reader :pod_targets
|
38
34
|
|
39
|
-
# @return [PodfileDependencyCache] the cache of all dependencies in the
|
40
|
-
# podfile.
|
35
|
+
# @return [PodfileDependencyCache] the cache of all dependencies in the podfile.
|
41
36
|
#
|
42
|
-
|
37
|
+
attr_reader :podfile_dependency_cache
|
38
|
+
|
39
|
+
def initialize(podfile_state, specs_by_target, specs_by_source, specifications, sandbox_state, targets, pod_targets,
|
40
|
+
podfile_dependency_cache)
|
41
|
+
@podfile_state = podfile_state
|
42
|
+
@specs_by_target = specs_by_target
|
43
|
+
@specs_by_source = specs_by_source
|
44
|
+
@specifications = specifications
|
45
|
+
@sandbox_state = sandbox_state
|
46
|
+
@targets = targets
|
47
|
+
@pod_targets = pod_targets
|
48
|
+
@podfile_dependency_cache = podfile_dependency_cache
|
49
|
+
end
|
43
50
|
|
44
51
|
# @return [Hash{String=>Symbol}] A hash representing all the user build
|
45
52
|
# configurations across all integration targets. Each key
|
@@ -51,6 +58,29 @@ module Pod
|
|
51
58
|
result.merge(target.user_build_configurations)
|
52
59
|
end
|
53
60
|
end
|
61
|
+
|
62
|
+
# @return [Bool] Whether an installation should be performed or this
|
63
|
+
# CocoaPods project is already up to date.
|
64
|
+
#
|
65
|
+
def needs_install?
|
66
|
+
podfile_needs_install? || sandbox_needs_install?
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [Bool] Whether the podfile has changes respect to the lockfile.
|
70
|
+
#
|
71
|
+
def podfile_needs_install?
|
72
|
+
state = podfile_state
|
73
|
+
needing_install = state.added.length + state.changed.length + state.deleted.length
|
74
|
+
needing_install > 0
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [Bool] Whether the sandbox is in synch with the lockfile.
|
78
|
+
#
|
79
|
+
def sandbox_needs_install?
|
80
|
+
state = sandbox_state
|
81
|
+
needing_install = state.added.length + state.changed.length + state.deleted.length
|
82
|
+
needing_install > 0
|
83
|
+
end
|
54
84
|
end
|
55
85
|
end
|
56
86
|
end
|
@@ -33,6 +33,8 @@ module Pod
|
|
33
33
|
dependency_graph = Molinillo::DependencyGraph.new
|
34
34
|
|
35
35
|
if lockfile
|
36
|
+
added_dependency_strings = Set.new
|
37
|
+
|
36
38
|
explicit_dependencies = lockfile.dependencies
|
37
39
|
explicit_dependencies.each do |dependency|
|
38
40
|
dependency_graph.add_vertex(dependency.name, dependency, true)
|
@@ -40,7 +42,7 @@ module Pod
|
|
40
42
|
|
41
43
|
pods = lockfile.to_hash['PODS'] || []
|
42
44
|
pods.each do |pod|
|
43
|
-
add_to_dependency_graph(pod, [], dependency_graph, pods_to_unlock)
|
45
|
+
add_to_dependency_graph(pod, [], dependency_graph, pods_to_unlock, added_dependency_strings)
|
44
46
|
end
|
45
47
|
|
46
48
|
pods_to_update = pods_to_update.flat_map do |u|
|
@@ -67,7 +69,8 @@ module Pod
|
|
67
69
|
|
68
70
|
private
|
69
71
|
|
70
|
-
def self.add_child_vertex_to_graph(dependency_string, parents, dependency_graph, pods_to_unlock)
|
72
|
+
def self.add_child_vertex_to_graph(dependency_string, parents, dependency_graph, pods_to_unlock, added_dependency_strings)
|
73
|
+
return unless added_dependency_strings.add?(dependency_string)
|
71
74
|
dependency = Dependency.from_string(dependency_string)
|
72
75
|
if pods_to_unlock.include?(dependency.root_name)
|
73
76
|
dependency = Dependency.new(dependency.name)
|
@@ -78,14 +81,14 @@ module Pod
|
|
78
81
|
dependency
|
79
82
|
end
|
80
83
|
|
81
|
-
def self.add_to_dependency_graph(object, parents, dependency_graph, pods_to_unlock)
|
84
|
+
def self.add_to_dependency_graph(object, parents, dependency_graph, pods_to_unlock, added_dependency_strings)
|
82
85
|
case object
|
83
86
|
when String
|
84
|
-
add_child_vertex_to_graph(object, parents, dependency_graph, pods_to_unlock)
|
87
|
+
add_child_vertex_to_graph(object, parents, dependency_graph, pods_to_unlock, added_dependency_strings)
|
85
88
|
when Hash
|
86
89
|
object.each do |key, value|
|
87
|
-
dependency = add_child_vertex_to_graph(key, parents, dependency_graph, pods_to_unlock)
|
88
|
-
value.each { |v| add_to_dependency_graph(v, [dependency.name], dependency_graph, pods_to_unlock) }
|
90
|
+
dependency = add_child_vertex_to_graph(key, parents, dependency_graph, pods_to_unlock, added_dependency_strings)
|
91
|
+
value.each { |v| add_to_dependency_graph(v, [dependency.name], dependency_graph, pods_to_unlock, added_dependency_strings) }
|
89
92
|
end
|
90
93
|
end
|
91
94
|
end
|
@@ -38,6 +38,7 @@ module Pod
|
|
38
38
|
@test_specs = test_specs
|
39
39
|
@platform = platform
|
40
40
|
@requires_frameworks = requires_frameworks
|
41
|
+
@hash = [specs, platform, requires_frameworks].hash
|
41
42
|
end
|
42
43
|
|
43
44
|
# @note Test specs are intentionally not included as part of the equality for pod variants since a
|
@@ -48,9 +49,9 @@ module Pod
|
|
48
49
|
#
|
49
50
|
def ==(other)
|
50
51
|
self.class == other.class &&
|
51
|
-
|
52
|
+
requires_frameworks == other.requires_frameworks &&
|
52
53
|
platform == other.platform &&
|
53
|
-
|
54
|
+
specs == other.specs
|
54
55
|
end
|
55
56
|
alias_method :eql?, :==
|
56
57
|
|
@@ -59,9 +60,7 @@ module Pod
|
|
59
60
|
# This adds support to make instances usable as Hash keys.
|
60
61
|
#
|
61
62
|
# @!visibility private
|
62
|
-
|
63
|
-
[specs, platform, requires_frameworks].hash
|
64
|
-
end
|
63
|
+
attr_reader :hash
|
65
64
|
end
|
66
65
|
end
|
67
66
|
end
|
@@ -42,27 +42,16 @@ module Pod
|
|
42
42
|
|
43
43
|
alias_method :update_mode?, :update_mode
|
44
44
|
|
45
|
-
# @return [Lockfile] The lockfile of the installation as a fall-back if
|
46
|
-
# there is no sandbox manifest. This is indented as a temporary
|
47
|
-
# solution to prevent the full re-installation from users which
|
48
|
-
# are upgrading from CP < 0.17.
|
49
|
-
#
|
50
|
-
# @todo Remove for CP 0.18.
|
51
|
-
#
|
52
|
-
attr_reader :lockfile
|
53
|
-
|
54
45
|
# Init a new SandboxAnalyzer
|
55
46
|
#
|
56
47
|
# @param [Sandbox] sandbox @see sandbox
|
57
48
|
# @param [Array<Specifications>] specs @see specs
|
58
49
|
# @param [Bool] update_mode @see update_mode
|
59
|
-
# @param [Lockfile] lockfile @see lockfile
|
60
50
|
#
|
61
|
-
def initialize(sandbox, specs, update_mode
|
51
|
+
def initialize(sandbox, specs, update_mode)
|
62
52
|
@sandbox = sandbox
|
63
53
|
@specs = specs
|
64
54
|
@update_mode = update_mode
|
65
|
-
@lockfile = lockfile
|
66
55
|
end
|
67
56
|
|
68
57
|
# Performs the analysis to the detect the state of the sandbox respect
|
@@ -114,7 +103,7 @@ module Pod
|
|
114
103
|
#
|
115
104
|
def pod_added?(pod)
|
116
105
|
return true if resolved_pods.include?(pod) && !sandbox_pods.include?(pod)
|
117
|
-
return true
|
106
|
+
return true if !folder_exist?(pod) && !sandbox.local?(pod)
|
118
107
|
false
|
119
108
|
end
|
120
109
|
|
@@ -164,7 +153,7 @@ module Pod
|
|
164
153
|
# @return [Lockfile] The manifest to use for the sandbox.
|
165
154
|
#
|
166
155
|
def sandbox_manifest
|
167
|
-
sandbox.manifest
|
156
|
+
sandbox.manifest
|
168
157
|
end
|
169
158
|
|
170
159
|
#--------------------------------------#
|
@@ -59,10 +59,14 @@ module Pod
|
|
59
59
|
# @return [void]
|
60
60
|
#
|
61
61
|
def print
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
states = %i(added deleted changed unchanged)
|
63
|
+
lines(states).each do |line|
|
64
|
+
UI.message(line, '', 2)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def to_s(states: %i(added deleted changed unchanged))
|
69
|
+
lines(states).join("\n")
|
66
70
|
end
|
67
71
|
|
68
72
|
# Adds the name of a Pod to the give state.
|
@@ -78,6 +82,26 @@ module Pod
|
|
78
82
|
def add_name(name, state)
|
79
83
|
send(state) << Specification.root_name(name)
|
80
84
|
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
# @return [Array<String>] A description of changes for the given states,
|
89
|
+
# one per line
|
90
|
+
#
|
91
|
+
def lines(states)
|
92
|
+
prefixes = {
|
93
|
+
:added => 'A'.green,
|
94
|
+
:deleted => 'R'.red,
|
95
|
+
:changed => 'M'.yellow,
|
96
|
+
:unchanged => '-',
|
97
|
+
}
|
98
|
+
|
99
|
+
states.flat_map do |state|
|
100
|
+
send(state).sort.map do |pod|
|
101
|
+
prefixes[state.to_sym] + " #{pod}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
81
105
|
end
|
82
106
|
end
|
83
107
|
end
|
@@ -5,40 +5,48 @@ module Pod
|
|
5
5
|
# @return [TargetDefinition] the target definition, whose project was
|
6
6
|
# inspected
|
7
7
|
#
|
8
|
-
|
8
|
+
attr_reader :target_definition
|
9
9
|
|
10
|
-
# @return [
|
11
|
-
# #target_definition should integrate
|
10
|
+
# @return [Xcodeproj::Project] the user's Xcode project
|
12
11
|
#
|
13
|
-
|
12
|
+
attr_reader :project
|
14
13
|
|
15
14
|
# @return [Array<String>] the uuid of the user's targets
|
16
15
|
#
|
17
|
-
|
16
|
+
attr_reader :project_target_uuids
|
18
17
|
|
19
18
|
# @return [Hash{String=>Symbol}] A hash representing the user build
|
20
19
|
# configurations where each key corresponds to the name of a
|
21
20
|
# configuration and its value to its type (`:debug` or
|
22
21
|
# `:release`).
|
23
22
|
#
|
24
|
-
|
23
|
+
attr_reader :build_configurations
|
25
24
|
|
26
25
|
# @return [Platform] the platform of the user targets
|
27
26
|
#
|
28
|
-
|
27
|
+
attr_reader :platform
|
29
28
|
|
30
29
|
# @return [Array<String>] the architectures used by user's targets
|
31
30
|
#
|
32
|
-
|
33
|
-
|
34
|
-
# @return [Bool] whether frameworks are recommended for the integration
|
35
|
-
# due to the presence of Swift source in the user's targets
|
36
|
-
#
|
37
|
-
attr_accessor :recommends_frameworks
|
31
|
+
attr_reader :archs
|
38
32
|
|
39
|
-
#
|
40
|
-
#
|
41
|
-
|
33
|
+
# Initialize a new instance
|
34
|
+
#
|
35
|
+
# @param [TargetDefinition] target_definition @see #target_definition
|
36
|
+
# @param [Xcodeproj::Project] project @see #project
|
37
|
+
# @param [Array<String>] project_target_uuids @see #project_target_uuids
|
38
|
+
# @param [Hash{String=>Symbol}] build_configurations @see #build_configurations
|
39
|
+
# @param [Platform] platform @see #platform
|
40
|
+
# @param [Array<String>] archs @see #archs
|
41
|
+
#
|
42
|
+
def initialize(target_definition, project, project_target_uuids, build_configurations, platform, archs)
|
43
|
+
@target_definition = target_definition
|
44
|
+
@project = project
|
45
|
+
@project_target_uuids = project_target_uuids
|
46
|
+
@build_configurations = build_configurations
|
47
|
+
@platform = platform
|
48
|
+
@archs = archs
|
49
|
+
end
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
@@ -32,22 +32,21 @@ module Pod
|
|
32
32
|
#
|
33
33
|
# @raise If no `user_project` is set
|
34
34
|
#
|
35
|
-
# @return [TargetInspectionResult]
|
35
|
+
# @return [TargetInspectionResult] the result of the inspection of the target definition within the user project
|
36
36
|
#
|
37
37
|
def compute_results(user_project)
|
38
38
|
raise ArgumentError, 'Cannot compute results without a user project set' unless user_project
|
39
39
|
|
40
40
|
targets = compute_targets(user_project)
|
41
|
+
project_target_uuids = targets.map(&:uuid)
|
42
|
+
build_configurations = compute_build_configurations(targets)
|
43
|
+
platform = compute_platform(targets)
|
44
|
+
archs = compute_archs(targets)
|
45
|
+
swift_version = compute_swift_version_from_targets(targets)
|
41
46
|
|
42
|
-
result = TargetInspectionResult.new
|
43
|
-
|
44
|
-
result.
|
45
|
-
result.project_target_uuids = targets.map(&:uuid)
|
46
|
-
result.build_configurations = compute_build_configurations(targets)
|
47
|
-
result.platform = compute_platform(targets)
|
48
|
-
result.archs = compute_archs(targets)
|
49
|
-
result.project = user_project
|
50
|
-
result.target_definition.swift_version = compute_swift_version_from_targets(targets)
|
47
|
+
result = TargetInspectionResult.new(target_definition, user_project, project_target_uuids,
|
48
|
+
build_configurations, platform, archs)
|
49
|
+
result.target_definition.swift_version = swift_version
|
51
50
|
result
|
52
51
|
end
|
53
52
|
|
@@ -219,7 +218,14 @@ module Pod
|
|
219
218
|
#
|
220
219
|
def compute_swift_version_from_targets(targets)
|
221
220
|
versions_to_targets = targets.inject({}) do |memo, target|
|
222
|
-
|
221
|
+
# User project may have an xcconfig that specifies the `SWIFT_VERSION`. We first check if that is true and
|
222
|
+
# that the xcconfig file actually exists. After the first integration the xcconfig set is most probably
|
223
|
+
# the one that was generated from CocoaPods. See https://github.com/CocoaPods/CocoaPods/issues/7731 for
|
224
|
+
# more details.
|
225
|
+
resolve_against_xcconfig = target.build_configuration_list.build_configurations.all? do |bc|
|
226
|
+
!bc.base_configuration_reference.nil? && File.exist?(bc.base_configuration_reference.real_path)
|
227
|
+
end
|
228
|
+
versions = target.resolved_build_setting('SWIFT_VERSION', resolve_against_xcconfig).values
|
223
229
|
versions.each do |version|
|
224
230
|
memo[version] = [] if memo[version].nil?
|
225
231
|
memo[version] << target.name unless memo[version].include? target.name
|
@@ -8,6 +8,8 @@ module Pod
|
|
8
8
|
# @note This class needs to consider all the activated specs of a Pod.
|
9
9
|
#
|
10
10
|
class PodSourceInstaller
|
11
|
+
UNENCRYPTED_PROTOCOLS = %w(http git).freeze
|
12
|
+
|
11
13
|
# @return [Sandbox] The installation target.
|
12
14
|
#
|
13
15
|
attr_reader :sandbox
|
@@ -24,9 +26,9 @@ module Pod
|
|
24
26
|
|
25
27
|
# Initialize a new instance
|
26
28
|
#
|
27
|
-
# @param [Sandbox] sandbox @see sandbox
|
28
|
-
# @param [Hash{Symbol=>Array}] specs_by_platform @see specs_by_platform
|
29
|
-
# @param [Boolean] can_cache @see can_cache
|
29
|
+
# @param [Sandbox] sandbox @see #sandbox
|
30
|
+
# @param [Hash{Symbol=>Array}] specs_by_platform @see #specs_by_platform
|
31
|
+
# @param [Boolean] can_cache @see #can_cache
|
30
32
|
#
|
31
33
|
def initialize(sandbox, specs_by_platform, can_cache: true)
|
32
34
|
@sandbox = sandbox
|
@@ -63,9 +65,6 @@ module Pod
|
|
63
65
|
|
64
66
|
# Cleans the installations if appropriate.
|
65
67
|
#
|
66
|
-
# @todo As the pre install hooks need to run before cleaning this
|
67
|
-
# method should be refactored.
|
68
|
-
#
|
69
68
|
# @return [void]
|
70
69
|
#
|
71
70
|
def clean!
|
@@ -74,45 +73,29 @@ module Pod
|
|
74
73
|
|
75
74
|
# Locks the source files if appropriate.
|
76
75
|
#
|
77
|
-
# @todo As the pre install hooks need to run before cleaning this
|
78
|
-
# method should be refactored.
|
79
|
-
#
|
80
76
|
# @return [void]
|
81
77
|
#
|
82
78
|
def lock_files!(file_accessors)
|
83
79
|
return if local?
|
84
|
-
|
85
|
-
FileUtils.chmod('u-w', source_file)
|
86
|
-
end
|
80
|
+
FileUtils.chmod('u-w', source_files(file_accessors))
|
87
81
|
end
|
88
82
|
|
89
83
|
# Unlocks the source files if appropriate.
|
90
84
|
#
|
91
|
-
# @todo As the pre install hooks need to run before cleaning this
|
92
|
-
# method should be refactored.
|
93
|
-
#
|
94
85
|
# @return [void]
|
95
86
|
#
|
96
87
|
def unlock_files!(file_accessors)
|
97
88
|
return if local?
|
98
|
-
|
99
|
-
FileUtils.chmod('u+w', source_file)
|
100
|
-
end
|
89
|
+
FileUtils.chmod('u+w', source_files(file_accessors))
|
101
90
|
end
|
102
91
|
|
103
|
-
# @return [Hash] @see Downloader#checkout_options
|
104
|
-
#
|
105
|
-
attr_reader :specific_source
|
106
|
-
|
107
92
|
#-----------------------------------------------------------------------#
|
108
93
|
|
109
94
|
private
|
110
95
|
|
111
96
|
# @!group Installation Steps
|
112
97
|
|
113
|
-
# Downloads the source of the Pod.
|
114
|
-
# needed to recreate the same exact installation if needed in
|
115
|
-
# `#specific_source`.
|
98
|
+
# Downloads the source of the Pod.
|
116
99
|
#
|
117
100
|
# @return [void]
|
118
101
|
#
|
@@ -120,23 +103,31 @@ module Pod
|
|
120
103
|
verify_source_is_secure(root_spec)
|
121
104
|
download_result = Downloader.download(download_request, root, :can_cache => can_cache?)
|
122
105
|
|
123
|
-
if (
|
106
|
+
if (specific_source = download_result.checkout_options) && specific_source != root_spec.source
|
124
107
|
sandbox.store_checkout_source(root_spec.name, specific_source)
|
125
108
|
end
|
126
109
|
end
|
127
110
|
|
128
|
-
# Verify the source of the spec is secure, which is used to
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
111
|
+
# Verify the source of the spec is secure, which is used to show a warning to the user if that isn't the case
|
112
|
+
# This method doesn't verify all protocols, but currently only prohibits unencrypted 'http://' and 'git://''
|
113
|
+
# connections.
|
114
|
+
#
|
115
|
+
# @return [void]
|
132
116
|
#
|
133
117
|
def verify_source_is_secure(root_spec)
|
134
|
-
return if root_spec.source.nil? || root_spec.source[:http].nil?
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
118
|
+
return if root_spec.source.nil? || (root_spec.source[:http].nil? && root_spec.source[:git].nil?)
|
119
|
+
source = if !root_spec.source[:http].nil?
|
120
|
+
URI(root_spec.source[:http].to_s)
|
121
|
+
elsif !root_spec.source[:git].nil?
|
122
|
+
git_source = root_spec.source[:git].to_s
|
123
|
+
return unless git_source =~ /^#{URI.regexp}$/
|
124
|
+
URI(git_source)
|
125
|
+
end
|
126
|
+
if UNENCRYPTED_PROTOCOLS.include?(source.scheme)
|
127
|
+
UI.warn "'#{root_spec.name}' uses the unencrypted '#{source.scheme}' protocol to transfer the Pod. " \
|
128
|
+
'Please be sure you\'re in a safe network with only trusted hosts. ' \
|
129
|
+
'Otherwise, please reach out to the library author to notify them of this security issue.'
|
130
|
+
end
|
140
131
|
end
|
141
132
|
|
142
133
|
def download_request
|
@@ -199,13 +190,10 @@ module Pod
|
|
199
190
|
!local? && !predownloaded? && sandbox.specification(root_spec.name) != root_spec
|
200
191
|
end
|
201
192
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
blk[source_file]
|
207
|
-
end
|
208
|
-
end
|
193
|
+
# @return [Array<Pathname>] The paths of the source files
|
194
|
+
#
|
195
|
+
def source_files(file_accessors)
|
196
|
+
file_accessors.flat_map(&:source_files)
|
209
197
|
end
|
210
198
|
|
211
199
|
#-----------------------------------------------------------------------#
|