From bff168f182b872ac77bbdd55665c94a7cefad9ac Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 1 Feb 2025 16:22:24 +0900 Subject: [PATCH] Install non-mdoc files as-is See if the content contains `.Nm` macro, instead of the names. This reverts "Don't convert bundler man pages from mdoc to man", commit e0b40ef5d8173aff304c81f93516e1246e3c042c. --- tool/rbinstall.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 36ff5c22af..3665276f80 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -850,6 +850,10 @@ def install_default_gem(dir, srcdir, bindir) end end +def mdoc_file?(mdoc) + /^\.Nm / =~ File.read(mdoc, 1024) +end + # :startdoc: install?(:local, :arch, :bin, :'bin-arch') do @@ -1018,7 +1022,7 @@ install?(:local, :comm, :man) do destname = ruby_install_name.sub(/ruby/, base.chomp(".#{section}")) destfile = File.join(destdir, "#{destname}.#{section}") - if /\Adoc\b/ =~ mantype + if /\Adoc\b/ =~ mantype or !mdoc_file?(mdoc) if compress begin w = IO.popen(compress, "rb", in: mdoc, &:read) @@ -1036,13 +1040,8 @@ install?(:local, :comm, :man) do class << (w = []) alias print push end - if File.basename(mdoc).start_with?('bundle') || - File.basename(mdoc).start_with?('gemfile') - w = File.read(mdoc) - else - File.open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)} - w = w.join("") - end + File.open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)} + w = w.join("") if compress begin w = IO.popen(compress, "r+b") do |f|