-
Notifications
You must be signed in to change notification settings - Fork 18
/
Rakefile
95 lines (76 loc) · 2.9 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
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
# Rakefile for TimeWarp
# Copyright 2014 Mohit Cheppudira <[email protected]>
require "bundler/setup"
require 'fileutils'
require 'rake/testtask'
DIR = File.dirname(__FILE__)
DEPLOY_SSH_SERVER = "[email protected]"
DEPLOY_DIR = "/home/mohit/www/vexflow/vexwarp"
COFFEE = "node_modules/.bin/coffee"
directory 'build/public'
directory 'build/public/css'
directory 'build/public/css/support'
directory 'build/public/fonts'
directory 'build/public/images'
directory 'build/public/js'
directory 'build/public/js/support'
directory 'build/chrome'
directory 'build/chrome/css'
directory 'build/chrome/js'
directory 'build/chrome/js/support'
directory 'build/chrome/fonts'
def ssh(command)
sh "ssh #{DEPLOY_SSH_SERVER} 'source ~/.bash_profile; cd #{DEPLOY_DIR}; #{command}'"
end
def copy_path(path_glob, dest_dir, name)
FileList[path_glob].each do |source|
target = "#{dest_dir}/#{File.basename(source)}"
file target => [source, dest_dir] do
cp source, target, :verbose => true
end
desc "Copy data in: #{path_glob}"
task name => target
end
end
file 'build/public/js/timewarp-min.js' => :build_copy do
system "./node_modules/requirejs/bin/r.js -o src/build.js"
end
copy_path("www/*.html", "build/public", :build_copy)
copy_path("www/css/*.css", "build/public/css", :build_copy)
copy_path("www/images/*", "build/public/images", :build_copy)
copy_path("src/*", "build/public/js", :build_copy)
copy_path("support/js/*.js", "build/public/js/support", :build_copy)
copy_path("support/css/*.css", "build/public/css", :build_copy)
copy_path("support/fonts/*", "build/public/fonts", :build_copy)
copy_path("www/*.html", "build/chrome", :chrome_build)
copy_path("chrome/*", "build/chrome", :chrome_build)
copy_path("www/css/*.css", "build/chrome/css", :chrome_build)
copy_path("support/css/*.css", "build/chrome/css", :chrome_build)
copy_path("support/fonts/*", "build/chrome/fonts", :chrome_build)
copy_path("build/public/js/timewarp-min.js", "build/chrome/js", :chrome_build)
copy_path("support/js/require.js", "build/chrome/js/support", :build_copy)
file 'build/vexwarp-chrome.zip' => [:chrome_build, 'build/public/js/timewarp-min.js'] do
sh "zip -r build/vexwarp-chrome.zip build/chrome/*"
end
task :lint do
command = "jsl "
FileList['src/*.js'].reject {|x| x == "src/build.js"}.each do |source|
command += " -process #{source}"
end
system command
end
task :clean do
sh 'rm -rf build'
end
task :watch do
sh 'bundle exec guard -i'
end
task :make => [:build_copy, 'build/public/js/timewarp-min.js']
# Publish chrome app to:
# https://developers.google.com/chrome/web-store/docs/publish
task :app => [:clean, 'build/vexwarp-chrome.zip']
task :deploy => [:clean, :make] do
sh "rsync -przvl --executability --delete --stats build/public/* #{DEPLOY_SSH_SERVER}:#{DEPLOY_DIR}"
ssh "rm js/graph.js js/stretch.js js/main.js js/build.js js/warp.js js/tools.js js/app.js js/support/dsp.js"
end
task :default => [:make]