-
Notifications
You must be signed in to change notification settings - Fork 10
/
Rakefile
92 lines (73 loc) · 2.23 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
require 'fileutils'
require 'rake/clean'
def make_tds(name, files, doc)
tex_dir = "#{name}/tex/context/third/#{name}"
doc_dir = "#{name}/doc/context/third/#{name}"
sh "mkdir -p #{tex_dir}"
sh "mkdir -p #{doc_dir}"
files.each do |tex|
FileUtils.cp tex, tex_dir
end
FileUtils.cp doc, (doc_dir + "/#{name}.txt")
end
def make_zip name
# Ideally, one could have used
# sh "zip #{name} #{name}"
# but that creates a top level directory #{name}.
# So, we take the following round about alternative.
sh "cd #{name} && zip -r ../#{name} ./ && cd ../"
end
def run_tests tests, engine
FileUtils.mkdir_p "output"
tests.each do |file|
sh "context --#{engine} --color --mode=vim-dev --noconsole --purgeall --purgeresult #{file}"
end
sh "context --purgeall"
end
FILTER_TEX = %W[t-filter.mkii t-filter.mkiv t-filter.mkxl t-module-catcodes.mkii t-module-catcodes.mkiv]
FILTER_DOC = "README.md"
FILTER_TEST = FileList['tests/[0-9][0-9]-*.tex']
VIM_TEX = %W[t-vim.tex t-syntax-groups.mkii t-syntax-groups.mkiv t-syntax-highlight.mkii t-syntax-highlight.mkiv t-syntax-highlight.mkxl 2context.vim vimtyping-default.css]
VIM_DOC = "vim-README.md"
VIM_TEST = FileList['tests/vim/[0-9][0-9]-*.tex']
desc "Run tests for filter module (LMTX)"
task :test_filter_lmtx => FILTER_TEST do
run_tests FILTER_TEST, :luametatex
end
desc "Run tests for filter module (MkIV)"
task :test_filter_mkiv => FILTER_TEST do
run_tests FILTER_TEST, :luatex
end
desc "Run tests for filter module (MkII)"
task :test_filter_mkii => FILTER_TEST do
run_tests FILTER_TEST, :pdftex
end
desc "Run tests for vim module (LMTX)"
task :test_vim_lmtx => VIM_TEST do
run_tests VIM_TEST, :luametatex
end
desc "Run tests for vim module (MkIV)"
task :test_vim_mkiv => VIM_TEST do
run_tests VIM_TEST, :luatex
end
desc "Run tests for vim module (MkII)"
task :test_vim_mkii => VIM_TEST do
run_tests VIM_TEST, :pdftex
end
task :clean_vim do
sh "rm -rf vim"
end
task :clean_filter do
sh "rm -rf filter"
end
desc "Make TDS for filter module"
task :filter => :clean_filter do
make_tds :filter, FILTER_TEX, FILTER_DOC
make_zip :filter
end
desc "Make TDS for vim module"
task :vim => :clean_vim do
make_tds :vim, VIM_TEX, VIM_DOC
make_zip :vim
end
CLEAN.include('*.zip')