зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
ae90724357
Коммит
a2dbb9d603
|
@ -524,9 +524,14 @@ install?(:local, :comm, :man) do
|
||||||
mdocs = Dir["#{srcdir}/man/*.[1-9]"]
|
mdocs = Dir["#{srcdir}/man/*.[1-9]"]
|
||||||
prepare "manpages", mandir, ([] | mdocs.collect {|mdoc| mdoc[/\d+$/]}).sort.collect {|sec| "man#{sec}"}
|
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")
|
mandir = File.join(mandir, "man")
|
||||||
has_goruby = File.exist?(goruby_install_name+exeext)
|
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|
|
mdocs.each do |mdoc|
|
||||||
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
next unless File.file?(mdoc) and open(mdoc){|fh| fh.read(1) == '.'}
|
||||||
base = File.basename(mdoc)
|
base = File.basename(mdoc)
|
||||||
|
@ -539,11 +544,21 @@ install?(:local, :comm, :man) do
|
||||||
destfile = File.join(destdir, "#{destname}.#{section}")
|
destfile = File.join(destdir, "#{destname}.#{section}")
|
||||||
|
|
||||||
if /\Adoc\b/ =~ $mantype
|
if /\Adoc\b/ =~ $mantype
|
||||||
install mdoc, destfile, :mode => $data_mode
|
if compress
|
||||||
case $mantype
|
w = open(mdoc) {|f|
|
||||||
when /\.(?:(gz)|bz2)\z/
|
stdin = STDIN.dup
|
||||||
compress = $1 ? "gzip" : "bzip2"
|
STDIN.reopen(f)
|
||||||
system(compress, dest)
|
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
|
end
|
||||||
else
|
else
|
||||||
class << (w = [])
|
class << (w = [])
|
||||||
|
@ -551,10 +566,7 @@ install?(:local, :comm, :man) do
|
||||||
end
|
end
|
||||||
open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)}
|
open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)}
|
||||||
w = w.join("")
|
w = w.join("")
|
||||||
case $mantype
|
if compress
|
||||||
when /\.(?:(gz)|bz2)\z/
|
|
||||||
suffix = $&
|
|
||||||
compress = $1 ? "gzip" : "bzip2"
|
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
Dir.mktmpdir("man") {|d|
|
Dir.mktmpdir("man") {|d|
|
||||||
dest = File.join(d, File.basename(destfile))
|
dest = File.join(d, File.basename(destfile))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче