forked from sup-heliotrope/sup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
52 lines (43 loc) · 1.11 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
require 'rake/testtask'
require "bundler/gem_tasks"
Rake::TestTask.new(:test) do |test|
test.libs << 'test'
test.test_files = FileList.new('test/**/test_*.rb')
test.verbose = true
end
task :default => :test
task :build => [:man]
task :travis => [:test, :build]
def test_pandoc
return system("pandoc -v > /dev/null 2>&1")
end
task :man do
puts "building manpages from wiki.."
unless test_pandoc
puts "no pandoc installed, needed for manpage generation."
return
end
# test if wiki is cloned
unless Dir.exist? 'doc/wiki/man'
puts "wiki git repository is not cloned in doc/wiki, try: git submodule update --init."
return
end
unless Dir.exist? 'man'
Dir.mkdir 'man'
end
Dir.glob("doc/wiki/man/*.md").each do |md|
m = /^.*\/(?<manpage>[^\/]*)\.md$/.match(md)[:manpage]
puts "generating manpage for: #{m}.."
r = system "pandoc -s -f markdown -t man #{md} -o man/#{m}"
unless r
puts "failed to generate manpage: #{m}."
return
end
end
end
task :clean do
['man', 'pkg'].each do |d|
puts "cleaning #{d}.."
FileUtils.rm_r d if Dir.exist? d
end
end