File: Rakefile

package info (click to toggle)
sup-mail 0.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,168 kB
  • sloc: ruby: 12,583; sh: 115; makefile: 9
file content (52 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download | duplicates (2)
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