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
|
# File 'lib/doraBox/util/pod_file_helper.rb', line 11
def self.handle_pod_file(modules_name,branch_name)
version_filter_regex = /'([\d]+)(\.([1-9]\d|\d)*-*\w*)*'/
version_filter_number_regex = /([\d]+)(\.([1-9]\d|\d)*-*\w*)*/
podfile_str = ""
checked_names = []
module_branch_or_version_dict = {}
File.open($pod_file, 'r+') do |file|
file.each_line do |line|
modules_name.each do |name|
puts line if line.include?(name)
checked_names.append(name)
if version_filter_regex =~ line && /#{name}/ =~ line && /[^#]/ =~ line
regex_str = line.gsub(version_filter_regex,":path => '../#{name}'")
podfile_str += regex_str
match_result = version_filter_number_regex.match(line)
module_branch_or_version_dict[name] = match_result[0]
else
podfile_str += line
end
end
end
end
modules_name.each do |module_name|
module_pod_version = module_branch_or_version_dict[module_name]
GitOperator.create_module_branch(module_pod_version,module_name,branch_name)
end
File.open($pod_file,'w') do |file|
file.write podfile_str
end
FileOperator.cache_modified_modules(modules_name,branch_name)
Logger.log_with_type("正在执行 pod install", HIGHLIGHT_LOG)
pod_install
end
|