3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/cocoapods-mtxx-bin/native/lockfile.rb', line 3
def detect_changes_with_podfile(podfile)
result = {}
[:added, :changed, :removed, :unchanged].each { |k| result[k] = [] }
installed_deps = {}
dependencies.each do |dep|
name = dep.root_name
installed_deps[name] ||= dependencies_to_lock_pod_named(name)
end
installed_deps = installed_deps.values.flatten(1).group_by(&:name)
podfile_dependencies = podfile.dependencies
podfile_dependencies_by_name = podfile_dependencies.group_by(&:name)
all_dep_names = (dependencies + podfile_dependencies).map(&:name).uniq
all_dep_names.each do |name|
installed_dep = installed_deps[name]
installed_dep &&= installed_dep.first
unless installed_dep.nil?
installed_dep_version = installed_dep.specific_version.to_s
if installed_dep_version.include?('bin')
req_arr = installed_dep_version.split('.').delete_if { |r| r.include?('bin') }
installed_dep_version = req_arr.join('.')
installed_dep.specific_version = Pod::Version.create(installed_dep_version)
end
end
podfile_dep = podfile_dependencies_by_name[name]
podfile_dep &&= podfile_dep.first
if installed_dep.nil? then key = :added
elsif podfile_dep.nil? then key = :removed
elsif podfile_dep.compatible?(installed_dep) then key = :unchanged
else key = :changed
end
result[key] << name
end
result
end
|