forked from jacott/Enhanced-Ruby-Mode
-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathRakefile
102 lines (82 loc) · 2.04 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
96
97
98
99
100
101
102
task :default => %w[clean test:all compile]
el_files = Rake::FileList['**/*.el']
def run cmd
sh cmd do |good|
# block prevents ruby backtrace on failure
exit 1 unless good
end
end
def emacs args
emacs_cmd = Dir[
"/usr/local/bin/emacs",
"/{My,}Applications/Emacs.app/Contents/MacOS/Emacs" # homebrew
].first || "emacs" # trust the path
run %Q[#{emacs_cmd} -Q -L . #{args}]
end
def emacs_test args
emacs "-l enh-ruby-mode-test.el #{args}"
end
desc "byte compile the project. Helps drive out warnings, but also faster."
task compile: el_files.ext('.elc')
rule '.elc' => '.el' do |t|
emacs "--batch -f batch-byte-compile #{t.source}"
end
desc "Clean the project"
task :clean do
rm_f Dir["**/*~", "**/*.elc"]
end
task :test => %w[ test:ruby test:elisp ]
namespace :test do
desc "Run tests for Ruby"
task :ruby do
n = ENV["N"]
if n then
run %Q[ruby -wI. test/test_erm_buffer.rb -n #{n.dump}]
else
run %Q[ruby -wI. test/test_erm_buffer.rb]
end
end
desc "Run tests for Emacs Lisp"
task :elisp do
n=ENV["N"]
Dir.chdir "test" do
if n then
emacs_test "--batch -eval '(ert-run-tests-batch-and-exit #{n.dump})'"
else
emacs_test "--batch -f ert-run-tests-batch-and-exit"
end
end
end
desc "Run tests for Emacs Lisp interactively"
task :elispi do
Dir.chdir "test" do
emacs_test %q[-eval "(ert-run-tests-interactively 't)"]
end
end
desc "Run test:ruby and test:elisp"
task :all => [:ruby, :elisp]
end
def docker cmd
sh %(docker run -v $PWD:/erm --rm -i -t -w /erm/test zenspider/emacs-ruby #{cmd})
end
desc "test in a docker container"
task :docker do
docker "rake test:all"
end
desc "interactive test in a docker container"
task :dockeri do
docker "rake test:elispi"
end
desc "run a shell in a docker container"
task :sh do
docker "/bin/sh"
end
desc "debug a file (F=path)"
task :debug do
f = ENV["F"]
system "ruby tools/debug.rb #{f}"
puts
system "ruby tools/lexer.rb #{f}"
puts
system "ruby tools/markup.rb #{f}"
end