-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathRakefile
58 lines (48 loc) · 1.24 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'bundler/setup'
require 'fileutils'
require 's3_deployer/tasks'
require './s3_deployer_config'
def execute(cmd)
puts "Running '#{cmd}'"
system(cmd, out: $stdout, err: :out)
end
def recreate_dir(dir)
FileUtils.rm_rf(dir)
FileUtils.mkdir_p(dir)
end
def copy_file_or_directory(source, target)
puts "Copy #{source} to #{target}"
FileUtils.cp_r(source, target)
end
def invoke_task(task)
Rake::Task[task].invoke
end
desc "Compile"
task :compile do
execute("lein cljsbuild once release")
end
desc "Package"
task :package do
build_dir = File.expand_path("..", __FILE__)
dist_dir = "dist"
recreate_dir(dist_dir)
%w{
resources index_prod.html tixi_prod.js tixi_prod.js.map
}.each do |file|
copy_file_or_directory(File.join(build_dir, file), dist_dir)
end
FileUtils.rm_rf(File.join(dist_dir, "resources/public/out"))
FileUtils.rm_rf(File.join(dist_dir, "resources/public/tixi.js"))
FileUtils.rm_rf(File.join(dist_dir, "resources/public/index.html"))
FileUtils.mv(File.join(dist_dir, "index_prod.html"), File.join(dist_dir, "index.html"))
end
desc "Release"
task :release do
invoke_task :compile
invoke_task :package
end
desc "Deploy"
task :deploy do
invoke_task :release
invoke_task :"s3_deployer:deploy"
end