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.
This commit is contained in:
Nobuyoshi Nakada 2025-02-01 16:22:24 +09:00
parent 5318a48e4e
commit bff168f182
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-02-01 07:56:45 +00:00

View File

@ -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|