From 9f4fa5f12e05899bb4c5ba19da353de6b47ccc33 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 12 May 2017 14:19:54 -0500 Subject: [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 ``` --- Rakefile | 21 +++++++++++++++++++-- man/index.txt | 15 --------------- 2 files changed, 19 insertions(+), 17 deletions(-) delete mode 100644 man/index.txt diff --git a/Rakefile b/Rakefile index d9ffc70059..bb37a9666f 100644 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/man/index.txt b/man/index.txt deleted file mode 100644 index e3b38c46db..0000000000 --- a/man/index.txt +++ /dev/null @@ -1,15 +0,0 @@ -Gemfile(5) gemfile.5 -bundle-install bundle-install.1 -bundle-update bundle-update.1 -bundle-package bundle-package.1 -bundle-exec bundle-exec.1 -bundle-config bundle-config.1 -bundle-platform bundle-platform.1 -bundle-gem bundle-gem.1 -bundle-clean bundle-clean.1 -bundle-check bundle-check.1 -bundle-init bundle-init.1 -bundle-inject bundle-inject.1 -bundle-open bundle-open.1 -bundle-show bundle-show.1 -bundle-viz bundle-viz.1 -- cgit v1.2.1 From 4fcce0f3ed99de5d19ccbeaa47c94fb14fc7a29f Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 12 May 2017 14:20:18 -0500 Subject: Ensure that manpages are always built when running specs --- spec/spec_helper.rb | 1 + spec/support/manpages.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spec/support/manpages.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 297d81f531..0a6b696fe7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -40,6 +40,7 @@ end $debug = false +Spec::Manpages.setup Spec::Rubygems.setup FileUtils.rm_rf(Spec::Path.gem_repo1) ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.root}/spec/support/hax.rb" diff --git a/spec/support/manpages.rb b/spec/support/manpages.rb new file mode 100644 index 0000000000..e3031ca4a4 --- /dev/null +++ b/spec/support/manpages.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true +module Spec + module Manpages + def self.setup + man_path = Spec::Path.root.join("man") + return if man_path.children(false).select {|file| file.extname == ".ronn" }.all? do |man| + man_path.join(man).sub_ext(".txt").file? + end + + system(Spec::Path.root.join("bin", "rake").to_s, "man:build") || raise("Failed building man pages") + end + end +end -- cgit v1.2.1 From 581ba1b50021520d7ac860517f28eeb8bb4d49dd Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sat, 13 May 2017 16:36:06 -0500 Subject: [Travis] Use RubyGems 2.6.12 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index bb37a9666f..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" -- cgit v1.2.1 From a52076c06ad77f8dd1b2df7c0763e45ff7369ff0 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sat, 13 May 2017 16:45:33 -0500 Subject: Avoid re-building manpages each spec run --- spec/support/manpages.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/manpages.rb b/spec/support/manpages.rb index e3031ca4a4..f6a4a4ab51 100644 --- a/spec/support/manpages.rb +++ b/spec/support/manpages.rb @@ -4,7 +4,7 @@ module Spec def self.setup man_path = Spec::Path.root.join("man") return if man_path.children(false).select {|file| file.extname == ".ronn" }.all? do |man| - man_path.join(man).sub_ext(".txt").file? + Dir[man_path.join("#{man.to_s[0..-6]}*.txt").to_s].any? end system(Spec::Path.root.join("bin", "rake").to_s, "man:build") || raise("Failed building man pages") -- cgit v1.2.1