summaryrefslogtreecommitdiffstats
path: root/tasks/rake/manpages.rake
blob: 752a6a7a677b43071f749f3007dd22c991618ae4 (plain)
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
# require 'fileutils'

desc "Build Puppet manpages"
task :gen_manpages do

  sbins = Dir.glob(%w{sbin/*})
  bins  = Dir.glob(%w{bin/*})
  
  # Locate ronn
  ronn = %x{which ronn}
  ronn.chomp!
  # Create puppet.conf.5 man page
  %x{RUBYLIB=./lib:$RUBYLIB bin/puppetdoc --reference configuration > ./man/man5/puppetconf.5.ronn}
  %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man5/puppetconf.5.ronn}
  File.move("./man/man5/puppetconf.5", "./man/man5/puppet.conf.5")
  File.unlink("./man/man5/puppetconf.5.ronn")

  # Create binary man pages
  binary = bins + sbins
  binary.each do |bin|
    b = bin.gsub( /(bin|sbin)\//, "")
    %x{RUBYLIB=./lib:$RUBYLIB #{bin} --help > ./man/man8/#{b}.8.ronn}
    %x{#{ronn} --manual="Puppet manual" --organization="Puppet Labs, LLC" -r ./man/man8/#{b}.8.ronn}
    File.unlink("./man/man8/#{b}.8.ronn")
  end
  
end