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
|
# File 'lib/flappy/util/iOS_env_config.rb', line 6
def writeEnvToPlist(args, options)
plist_path = check_and_find_plist_file
unless plist_path.blank?
https = options[:https]
env = options[:env]
env_port = options[:port]
pay_env = options[:'pay-env']
load_env_from_plist = 'N'
if !https.blank? || !env.blank? || !env_port.blank? || !pay_env.blank?
load_env_from_plist = 'Y'
end
log_iOS('更新配置文件前')
log_iOS(`/usr/libexec/PlistBuddy -c 'Print' \"#{plist_path}\"`)
system("/usr/libexec/PlistBuddy -c 'Set :LoadConfigFromPlist #{load_env_from_plist}' \"#{plist_path}\"") unless load_env_from_plist.blank?
system("/usr/libexec/PlistBuddy -c 'Set :HTTPS #{https}' \"#{plist_path}\"") unless https.blank?
system("/usr/libexec/PlistBuddy -c 'Set :SCC_ENV:env #{env}' \"#{plist_path}\"") unless env.blank?
system("/usr/libexec/PlistBuddy -c 'Set :SCC_ENV:port #{env_port}' \"#{plist_path}\"") unless env_port.blank?
system("/usr/libexec/PlistBuddy -c 'Set :SCC_PAY_ENV:payEnv #{pay_env}' \"#{plist_path}\"") unless pay_env.blank?
log_iOS('更新配置文件后')
log_iOS(`/usr/libexec/PlistBuddy -c \"Print\" \"#{plist_path}\"`)
end
end
|