forked from MoSync/Reload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rb
123 lines (86 loc) · 4.49 KB
/
build.rb
1
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Copyright (C) 2012 MoSync AB
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require "fileutils"
def sh(command)
if(!system(command))
raise("failed to run #{command}")
exist!(1)
end
end
#Defince version and timestamp
version = "0.1 Beta 3"
time_stamp = Time.now.strftime("%Y%m%d-%H%M")[2..-1]
#Write the version information to the file for use in the server and client
File.open("ReloadServer/build.dat", "w") do |file|
file.puts("MoSync Reload Version #{version}")
file.puts(time_stamp);
end
FileUtils.cp "ReloadServer/build.dat", "ReloadClient/Resources/information"
#build Output Directory
FileUtils.mkdir_p "Build/#{time_stamp}"
puts "building for timestamp #{time_stamp}"
#Build Clients
FileUtils.cd "ReloadClient"
sh "ruby workfile.rb"
FileUtils.cd ".."
files_to_copy = [
"ReloadServer/ReloadServer.js",
"ReloadServer/UI",
"ReloadServer/bin",
"ReloadServer/templates",
"ReloadServer/build.dat"
]
main_dir = FileUtils.pwd
FileUtils.cd "ReloadLauncher/Mac"
if File.exist?("Reload.app")
FileUtils.rm_rf "Reload.app"
end
sh "platypus -y -P Reload.platypus ./Reload.app"
FileUtils.cd main_dir
sh "hdiutil attach ReloadAppTemplates/MoSync_Reload_BETA_Template.dmg"
FileUtils.mkdir_p "Build/#{time_stamp}/MoSync_Reload_BETA_Windows/server"
FileUtils.mkdir_p "Build/#{time_stamp}/MoSync_Reload_BETA_Linux/server"
FileUtils.rm_rf "/Volumes/MoSync Reload (BETA)/Android Client"
FileUtils.rm_rf "/Volumes/MoSync Reload (BETA)/iOS Client"
FileUtils.rm_rf "/Volumes/MoSync Reload (BETA)/WP7 Client"
FileUtils.cp_r "ReloadLauncher/Mac/Reload.app", "/Volumes/MoSync Reload (BETA)/"
puts "Copying Clients"
FileUtils.cp_r "ReloadClient/Clients/Android", "/Volumes/MoSync Reload (BETA)/Android Client"
FileUtils.cp_r "ReloadClient/Clients/iOS", "/Volumes/MoSync Reload (BETA)/iOS Client"
FileUtils.cp_r "ReloadClient/Clients/WindowsPhone", "/Volumes/MoSync Reload (BETA)/WP7 Client"
FileUtils.cp_r "ReloadClient/Clients/Android", "Build/#{time_stamp}/MoSync_Reload_BETA_Windows/Android Client"
FileUtils.cp_r "ReloadClient/Clients/iOS", "Build/#{time_stamp}/MoSync_Reload_BETA_Windows/iOS Client"
FileUtils.cp_r "ReloadClient/Clients/WindowsPhone", "Build/#{time_stamp}/MoSync_Reload_BETA_Windows/WP7 Client"
FileUtils.cp_r "ReloadClient/Clients/Android", "Build/#{time_stamp}/MoSync_Reload_BETA_Linux/Android Client"
FileUtils.cp_r "ReloadClient/Clients/iOS", "Build/#{time_stamp}/MoSync_Reload_BETA_Linux/iOS Client"
FileUtils.cp_r "ReloadClient/Clients/WindowsPhone", "Build/#{time_stamp}/MoSync_Reload_BETA_Linux/WP7 Client"
puts "Copying Readme"
FileUtils.cp_r "ReadMe.txt", "/Volumes/MoSync Reload (BETA)/"
FileUtils.cp_r "ReadMe.txt", "Build/#{time_stamp}/MoSync_Reload_BETA_Windows"
FileUtils.cp_r "ReadMe.txt", "Build/#{time_stamp}/MoSync_Reload_BETA_Linux"
FileUtils.cp_r "Licenses", "/Volumes/MoSync Reload (BETA)/"
FileUtils.cp_r "Licenses", "Build/#{time_stamp}/MoSync_Reload_BETA_Windows"
FileUtils.cp_r "Licenses", "Build/#{time_stamp}/MoSync_Reload_BETA_Linux"
files_to_copy.each { |item|
FileUtils.cp_r item, "Build/#{time_stamp}/MoSync_Reload_BETA_Windows/server"
FileUtils.cp_r item, "Build/#{time_stamp}/MoSync_Reload_BETA_Linux/server"
}
sh "cp -rf ReloadAppTemplates/MoSync_Reload_BETA_2_Windows/* Build/#{time_stamp}/MoSync_Reload_BETA_Windows"
sh "cp -rf ReloadAppTemplates/MoSync_Reload_BETA_2_Linux/* Build/#{time_stamp}/MoSync_Reload_BETA_Linux"
puts "creating final Mac Package"
sh "hdiutil detach /Volumes/MoSync\\ Reload\\ \\(BETA\\)/"
sh "hdiutil convert ReloadAppTemplates/MoSync_Reload_BETA_Template.dmg -format UDZO -imagekey zlib-level=9 -o Build/#{time_stamp}/MoSync_Reload_BETA_OSX_#{time_stamp}.dmg"
puts "Creating final Windows Package"
FileUtils.cd "Build/#{time_stamp}"
sh "zip -9r MoSync_Reload_BETA_Windows_#{time_stamp}.zip MoSync_Reload_BETA_Windows"
puts "Creating final Linux Package"
sh "tar -jcvf MoSync_Reload_BETA_Linux_#{time_stamp}.tar.bz2 MoSync_Reload_BETA_Linux"