summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-06 05:09:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-06 05:09:42 +0000
commita2dbb9d60336aad5f8f6767b5dcab26e6730f6a2 (patch)
tree48b05b3468ae602522154355c6695e4566cfbd6a /tool
parentae907243570e85aa7b01b3428c585c2d8c5bc58a (diff)
rbinstall.rb: compress man pages.
* tool/rbinstall.rb (man): get rid of prompt from compress program. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/rbinstall.rb32
1 files changed, 22 insertions, 10 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index b14a4cd..58a4613 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -524,9 +524,14 @@ install?(:local, :comm, :man) do
mdocs = Dir["#{srcdir}/man/*.[1-9]"]
prepare "manpages", mandir, ([] | mdocs.collect {|mdoc| mdoc[/\d+$/]}).sort.collect {|sec| "man#{sec}"}
+ case $mantype
+ when /\.(?:(gz)|bz2)\z/
+ compress = $1 ? "gzip" : "bzip2"
+ suffix = $&
+ end
mandir = File.join(mandir, "man")
has_goruby = File.exist?(goruby_install_name+exeext)
- require File.join(srcdir, "tool/mdoc2man.rb") if $mantype != "doc"
+ require File.join(srcdir, "tool/mdoc2man.rb") if /\Adoc\b/ !~ $mantype
mdocs.each do |mdoc|
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
base = File.basename(mdoc)
@@ -539,11 +544,21 @@ install?(:local, :comm, :man) do
destfile = File.join(destdir, "#{destname}.#{section}")
if /\Adoc\b/ =~ $mantype
- install mdoc, destfile, :mode => $data_mode
- case $mantype
- when /\.(?:(gz)|bz2)\z/
- compress = $1 ? "gzip" : "bzip2"
- system(compress, dest)
+ if compress
+ w = open(mdoc) {|f|
+ stdin = STDIN.dup
+ STDIN.reopen(f)
+ begin
+ destfile << suffix
+ IO.popen(compress) {|f| f.read}
+ ensure
+ STDIN.reopen(stdin)
+ stdin.close
+ end
+ }
+ open_for_install(destfile, $data_mode) {w}
+ else
+ install mdoc, destfile, :mode => $data_mode
end
else
class << (w = [])
@@ -551,10 +566,7 @@ install?(:local, :comm, :man) do
end
open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)}
w = w.join("")
- case $mantype
- when /\.(?:(gz)|bz2)\z/
- suffix = $&
- compress = $1 ? "gzip" : "bzip2"
+ if compress
require 'tmpdir'
Dir.mktmpdir("man") {|d|
dest = File.join(d, File.basename(destfile))