2
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
45
46
47
|
# File 'lib/cocoapods-mPaaS/podfileTools.rb', line 2
def self.writeVersionCode(podfile_path)
baseline = BaselineTools.getBaselineMatched(podfile_path)
version_code = BaselineTools.getVersionCodeInLocalByBaseline(baseline)
io = File::open(podfile_path).readlines
override = File.new(podfile_path, "w")
need_write_in_last = true
io.each do |line|
if line.include?("mPaaS_version_code")
next
end
override.puts line
if line.include?("mPaaS_baseline")
need_write_in_last = false
override.puts("mPaaS_version_code #{version_code} # This line is maintained by MPaaS plugin automatically. Please don't modify.")
LogTools.p "write 'mPaaS_version_code #{version_code}' in the Podfile"
end
end
if need_write_in_last
override.puts("")
override.puts("mPaaS_version_code #{version_code} # This line is maintained by MPaaS plugin automatically. Please don't modify.")
LogTools.p "write 'mPaaS_version_code #{version_code}' in the Podfile"
end
override.close
end
|