-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRakefile
40 lines (36 loc) · 1.13 KB
/
Rakefile
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
require 'erb'
namespace :package do
desc "package and compress for mobile client"
task :mobile, [:env] do |t, args|
`cp -Rf app/* packager/android/assets/www/`
`cp -Rf app/* packager/ios/www/`
enviroments = ['development','staging','production']
@client_type = 'mobile'
@environment = args.env
if enviroments.include? @environment
index = ERB.new File.open('./src/index.html').read
dirs = ['./packager/android/assets/www/', './packager/ios/www/']
dirs.each do |dir|
file = File.open(dir + 'index.html', 'w+')
file.puts(index.result)
file.close
end
else
raise 'enviroment or client_type invalid'
end
end
desc "package and compress for web client"
task :web, [:env] do |t, args|
enviroments = ['development','staging','production']
@client_type = 'mobile'
@environment = args.env
if enviroments.include? @environment
index = ERB.new File.open('./src/index.html').read
file = File.open('./app/index.html', 'w+')
file.puts(index.result)
file.close
else
raise 'enviroment or client_type invalid'
end
end
end