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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/pod_builder/command/deintegrate.rb', line 6
def self.call
raise "\n\nPodBuilder not initialized!\n".red if !Configuration.exists
prebuilt_podfile = PodBuilder::basepath("Podfile")
restored_podfile = PodBuilder::project_path("Podfile")
FileUtils.cp(prebuilt_podfile, restored_podfile)
podfile_content = File.read(restored_podfile)
podfile_lines = []
pre_install_indx = -1
podfile_content.each_line.with_index do |line, index|
if Podfile::PODBUILDER_LOCK_ACTION.detect { |x| Podfile::strip_line(x) == Podfile::strip_line(line) }
if pre_install_indx == -1
pre_install_indx = index
end
else
podfile_lines.push(line)
end
end
if pre_install_indx > 0 &&
Podfile::strip_line(podfile_lines[pre_install_indx - 1]).include?("pre_installdo|") &&
Podfile::strip_line(podfile_lines[pre_install_indx]) == "end"
podfile_lines.delete_at(pre_install_indx)
podfile_lines.delete_at(pre_install_indx - 1)
end
FileUtils.rm_f(restored_podfile)
podfile_content = podfile_lines.join
podfile_content = Podfile.update_path_entries(podfile_content, Deintegrate.method(:podfile_path_transform))
podfile_content = Podfile.update_project_entries(podfile_content, Deintegrate.method(:podfile_path_transform))
podfile_content = Podfile.update_require_entries(podfile_content, Deintegrate.method(:podfile_path_transform))
File.write(restored_podfile, podfile_content)
PodBuilder::safe_rm_rf(Configuration.base_path)
Dir.chdir(PodBuilder::project_path) do
bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
system("#{bundler_prefix}pod install;")
license_base = PodBuilder::project_path(Configuration.license_filename)
FileUtils.rm_f("#{license_base}.plist")
FileUtils.rm_f("#{license_base}.md")
update_gemfile
end
puts "\n\nš done!\n".green
return 0
end
|