Sha256: bf0ec5e6c79a2ad8b3488317d3e5fc1bd7426a2a027db095cb204643c0798716

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'rubygems'
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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sup-0.21.0 Rakefile
sup-0.20.0 Rakefile