-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrakefile
73 lines (57 loc) · 1.47 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
#
# The dishes map build script.
#
require 'find'
# Global variables
DMWA_HOME=Dir.pwd
CODE_DIR='dmwa'
JAVASCRIPT_DIR="#{CODE_DIR}/public/javascript"
INDEX_HTML="#{CODE_DIR}/public/index.html"
CSS_DIR="#{CODE_DIR}/public/stylesheets"
IMAGES_DIR="#{CODE_DIR}/public/images"
NODE_MODULE_DIR="node_modules"
# Load other rake tasks
Dir.glob('tasks/*.rake') {|f| load(f) }
#-----------------------------------------------------
# Helper methods
#-----------------------------------------------------
def highlight(message, length=nil)
stars = '*' * ((length or message.length) + 4)
lines = ["", stars, "* #{message} *", stars, "", ""]
return lines.join("\n")
end
def colorize(message, color=:red)
colors = { :red => "31",
:green => "32" }
color_code = colors[color]
output = "\e[#{color_code}m#{message}\e[0m"
return output
end
def lowlight(message)
to_print = "FAILURE: #{message}"
raw_length = to_print.length
if $stdout.isatty
to_print = colorize(to_print, :red)
end
return highlight(to_print, raw_length)
end
def notice(message)
puts highlight(message)
end
def command_in_dir(dir)
puts "running in #{dir}"
cur_dir = pwd()
cd(dir)
yield
ensure
cd(cur_dir)
end
#-----------------------------------------------------
# Additional Configuration
#-----------------------------------------------------
def mac?
RUBY_PLATFORM.include? 'darwin'
end
def cygwin?
RUBY_PLATFORM.include? 'cygwin'
end