-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRakefile
34 lines (29 loc) · 886 Bytes
/
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
require 'bundler/gem_tasks'
require 'rake/clean'
require 'rake/testtask'
CLEAN.include %w[ lib/vimprint/ragel ]
desc "Generate a .dot visualization for each .rl file"
desc "Compile each .rl file to .dot graph (viewable with Graphviz)"
task :visualize do
FileList.new('ext/ragel/*.rl').each do |file|
system "ragel -Vp #{file} > #{file.ext('.dot')}"
end
end
desc "Compile each .rl file to executable .rb"
task :ragel => :clean do
out_dir = File.expand_path('../lib/vimprint/ragel', __FILE__)
Dir.mkdir(out_dir) unless Dir.exist?(out_dir)
Dir.chdir('ext/ragel') do
Dir['*.rl'].each do |file|
out = file.sub(/rl$/, 'rb')
sh "ragel -R #{file} -o #{out_dir}/#{out}"
end
end
end
Rake::TestTask.new(:test => :ragel) do |t|
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
desc "Run tests"
task :default => :test