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
60
61
62
63
64
|
# File 'lib/emm.rb', line 9
def self.create_emm_project(config_file, export_dir)
config_path = Pathname.new(config_file).realpath.to_s export_path = Pathname.new(export_dir).realpath.to_s root_path = Pathname.new(File.dirname(__FILE__) + "/emm").realpath.to_s
temp_proj_name = "EMM_Temp_Proj" temp_proj_path = "/tmp/" + temp_proj_name
FileUtils.remove_dir(temp_proj_path, true)
json_file = File.open(config_path)
configs_string = json_file.read
configs = JSON.parse(configs_string) proj_name = configs["project_name"]
emm_pods_name = "EMM_Pods" emm_pods_path = export_path + "/" + proj_name + "/" + emm_pods_name
EMMProj.create_temp_proj(temp_proj_name, temp_proj_path)
EMMFiles.create_podfile(configs, temp_proj_path, temp_proj_name)
cmd = "sh " + root_path + "/pods_build.sh " + temp_proj_path + " " + emm_pods_path
system(cmd)
EMMFiles.copy_resources(temp_proj_path + "/Pods", temp_proj_name, emm_pods_path + "/Resources")
xcconfig_source = temp_proj_path + "/Pods/Target\ Support\ Files/Pods-" + temp_proj_name + "/Pods-" + temp_proj_name + ".debug.xcconfig"
xcconfig_export = emm_pods_path + "/EMM_Debug.xcconfig"
EMMFiles.copy_xcconfig(xcconfig_source, xcconfig_export)
xcconfig_source = temp_proj_path + "/Pods/Target\ Support\ Files/Pods-" + temp_proj_name + "/Pods-" + temp_proj_name + ".release.xcconfig"
xcconfig_export = emm_pods_path + "/EMM_Release.xcconfig"
EMMFiles.copy_xcconfig(xcconfig_source, xcconfig_export)
FileUtils.cp_r(root_path + "/Template/", export_path + "/" + proj_name + "/" + proj_name)
EMMProj.create_proj(proj_name, export_path, emm_pods_name, configs)
FileUtils.cp(temp_proj_path + "/Podfile", export_path + "/" + proj_name + "/.Podfile")
FileUtils.remove_dir(temp_proj_path, true)
end
|