diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-05-12 14:19:54 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-05-12 14:19:54 -0500 |
commit | 9f4fa5f12e05899bb4c5ba19da353de6b47ccc33 (patch) | |
tree | cf2e3e7f0d358f4004b0e4fe1c77c3615a15c905 /Rakefile | |
parent | 31297d10a33e095e2f4b523b99264f777eb0238d (diff) | |
download | bundler-9f4fa5f12e05899bb4c5ba19da353de6b47ccc33.tar.gz |
[Rakefile] Generate man/index in man:build
Results in the following:
```
Gemfile(5) gemfile.5
bundle(1) bundle.1
bundle-add(1) bundle-add.1
bundle-binstubs(1) bundle-binstubs.1
bundle-check(1) bundle-check.1
bundle-clean(1) bundle-clean.1
bundle-config(1) bundle-config.1
bundle-exec(1) bundle-exec.1
bundle-gem(1) bundle-gem.1
bundle-info(1) bundle-info.1
bundle-init(1) bundle-init.1
bundle-inject(1) bundle-inject.1
bundle-install(1) bundle-install.1
bundle-lock(1) bundle-lock.1
bundle-open(1) bundle-open.1
bundle-outdated(1) bundle-outdated.1
bundle-package(1) bundle-package.1
bundle-platform(1) bundle-platform.1
bundle-pristine(1) bundle-pristine.1
bundle-show(1) bundle-show.1
bundle-update(1) bundle-update.1
bundle-viz(1) bundle-viz.1
```
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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 |