forked from acunote/mediacloth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
48 lines (38 loc) · 1.16 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
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
task :default => [:parser]
desc 'Regenerate the parser with racc'
racc_flags=""
#racc_flags="-g -v"
file "lib/mediacloth/mediawikiparser.rb" => ["lib/mediacloth/mediawikiparser.y"] do |t|
sh "cd lib/mediacloth && racc #{racc_flags} mediawikiparser.y -o mediawikiparser.rb && cd .. && cd .."
end
task :parser => "lib/mediacloth/mediawikiparser.rb"
namespace :test do
desc '(Re)generate test data'
task :regenerate do
Dir["test/data/input*"].each do |file|
if file =~ /input([0-9]+)$/
`ruby -I lib/ test/dataproducers/lex.rb #{$1}`
`ruby -I lib/ test/dataproducers/html.rb #{$1}`
`ruby -I test/ -I lib/ test/dataproducers/ast.rb #{$1}`
end
end
end
end
desc 'Test'
Rake::TestTask.new(:test => [:parser]) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/*.rb'
t.verbose = true
end
desc 'Generate documentation.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Mediacloth'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end