-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathrakefile.rb
54 lines (45 loc) · 1.23 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'rake/clean'
BUILD_DIR="BuildDir"
SRC_DIR="tests"
SOURCE_FILES = FileList.new("#{SRC_DIR}/**/*.cpp")
CLEAN.include(BUILD_DIR)
CC="g++"
CFLAGS="-c -Wall -O0 -g3 -std=c++11"
INC=FileList["include"].pathmap("-I%p")
DELEGATETEST="#{BUILD_DIR}/delegateTest.exe"
CLOSURETEST="#{BUILD_DIR}/closureTest.exe"
directory BUILD_DIR
desc 'run all tests'
task :run => [DELEGATETEST,CLOSURETEST] do
sh "./#{DELEGATETEST}"
sh "./#{CLOSURETEST}"
end
task :default => [DELEGATETEST,CLOSURETEST]
file DELEGATETEST => "#{BUILD_DIR}/DelegateTests.o" do
sh "#{CC} -o #{DELEGATETEST} #{BUILD_DIR}/DelegateTests.o"
end
file CLOSURETEST => "#{BUILD_DIR}/ClosureTests.o" do
sh "#{CC} -o #{CLOSURETEST} #{BUILD_DIR}/ClosureTests.o"
end
rule ".o" => [->(f){locate_source(f)}, BUILD_DIR] do |t|
sh "#{CC} #{CFLAGS} #{INC} -o#{t.name} #{t.source}"
end
def locate_source(o_file)
SOURCE_FILES.detect { |f|
f.ext('') == o_file.pathmap("%{^#{BUILD_DIR},#{SRC_DIR}}X")
}
end
desc "build gh-pages"
task :site do
cd "site" do
sh "hugo -d ../gh-pages"
end
end
desc "build & deploy gh-pages to github"
task :deploy => :site do
cd "gh-pages" do
sh "git add ."
sh "git commit -m 'updated docs'"
end
sh "git push origin gh-pages:gh-pages"
end