summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile23
1 files changed, 20 insertions, 3 deletions
diff --git a/Rakefile b/Rakefile
index d9ffc70059..5e6f421fae 100644
--- a/Rakefile
+++ b/Rakefile
@@ -70,7 +70,7 @@ namespace :spec do
sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2"
# Install the gems with a consistent version of RubyGems
- sh "gem update --system 2.6.11"
+ sh "gem update --system 2.6.12"
$LOAD_PATH.unshift("./spec")
require "support/rubygems_ext"
@@ -240,12 +240,15 @@ begin
namespace :man do
directory "man"
+ index = []
sources = Dir["man/*.ronn"].map {|f| File.basename(f, ".ronn") }
sources.map do |basename|
ronn = "man/#{basename}.ronn"
- manual_section = ".1" unless basename =~ /.*(\d+)\Z/
+ manual_section = ".1" unless basename =~ /\.(\d+)\Z/
roff = "man/#{basename}#{manual_section}"
+ index << [ronn, File.basename(roff)]
+
file roff => ["man", ronn] do
sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}"
end
@@ -257,9 +260,23 @@ begin
task :build_all_pages => "#{roff}.txt"
end
+ file "index.txt" do
+ index.map! do |(ronn, roff)|
+ [File.read(ronn).split(" ").first, roff]
+ end
+ index = index.sort_by(&:first)
+ justification = index.map {|(n, _f)| n.length }.max + 4
+ File.open("man/index.txt", "w") do |f|
+ index.each do |name, filename|
+ f << name.ljust(justification) << filename << "\n"
+ end
+ end
+ end
+ task :build_all_pages => "index.txt"
+
task :clean do
leftovers = Dir["man/*"].reject do |f|
- File.extname(f) == ".ronn" || f == "man/index.txt"
+ File.extname(f) == ".ronn"
end
rm leftovers if leftovers.any?
end