-
Notifications
You must be signed in to change notification settings - Fork 3
/
rakefile.rb
31 lines (24 loc) · 882 Bytes
/
rakefile.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
SOURCE_DIR = 'src'
BUILD_DIR = 'dist'
task :default do
puts "Cleaning..."
FileUtils.rm_r BUILD_DIR, :force => true
puts "Copying files..."
FileUtils.mkdir_p "#{BUILD_DIR}/data"
FileUtils.cp "#{SOURCE_DIR}/index.html", BUILD_DIR
FileUtils.cp "#{SOURCE_DIR}/sw.js", BUILD_DIR
FileUtils.cp "#{SOURCE_DIR}/datastore.php", BUILD_DIR
FileUtils.cp "./dist.htaccess", "#{BUILD_DIR}/.htaccess"
FileUtils.cp_r "#{SOURCE_DIR}/css", BUILD_DIR
FileUtils.cp_r "#{SOURCE_DIR}/imgs", BUILD_DIR
puts "Inserting commit info in index.html"
open("#{BUILD_DIR}/index.html", 'a') { |f|
info = `git log --pretty=format:'%H at %ai' -n 1`.gsub(/\n/, "")
f.puts "<!-- #{info} -->"
}
puts "Concatening and minifying JS files"
system "grunt"
puts "Copying l10n resource"
FileUtils.cp "#{SOURCE_DIR}/js/l10n.ini", "#{BUILD_DIR}/js"
puts "Build done !"
end