File: Rakefile

package info (click to toggle)
ruby-pathspec 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 224 kB
  • sloc: ruby: 861; sh: 21; makefile: 8
file content (31 lines) | stat: -rw-r--r-- 702 bytes parent folder | download
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
begin
  require 'rspec/core/rake_task'
  RSpec::Core::RakeTask.new(:spec)
rescue LoadError
  puts 'rspec rake task failed to load'
end

require 'rubocop/rake_task'
require 'kramdown'
require 'fileutils'

RuboCop::RakeTask.new(:rubocop) do |t|
  t.options = ['--display-cop-names']
end

task default: %i[rubocop spec docs]

desc 'Generate man page for executable script'
task :docs do
  kramdown = Kramdown::Document.new(File.read('docs/pathspec-rb.md'))

  FileUtils.mkdir_p 'docs/man'
  File.open('docs/man/pathspec-rb.man.1', 'w') do |f|
    f.write(kramdown.to_man)
  end

  FileUtils.mkdir_p 'docs/html'
  File.open('docs/html/pathspec-rb.html', 'w') do |f|
    f.write(kramdown.to_html)
  end
end