[前][次][番号順一覧][スレッド一覧]

ruby-changes:39129

From: nobu <ko1@a...>
Date: Fri, 10 Jul 2015 21:50:13 +0900 (JST)
Subject: [ruby-changes:39129] nobu:r51210 (trunk): compressed mantypes

nobu	2015-07-10 21:49:55 +0900 (Fri, 10 Jul 2015)

  New Revision: 51210

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51210

  Log:
    compressed mantypes
    
    * configure.in (--with-mantype): add compressed mantypes.
    
    * tool/rbinstall.rb (man): compress man pages if specified.

  Modified files:
    trunk/configure.in
    trunk/tool/rbinstall.rb
Index: configure.in
===================================================================
--- configure.in	(revision 51209)
+++ configure.in	(revision 51210)
@@ -4194,7 +4194,7 @@ AC_ARG_WITH(mantype, https://github.com/ruby/ruby/blob/trunk/configure.in#L4194
 	AS_HELP_STRING([--with-mantype=TYPE], [specify man page type; TYPE is one of man and doc]),
 		[
 			AS_CASE(["$withval"],
-			[man|doc], [MANTYPE=$withval],
+			[man|man.gz|man.bz2|doc|doc.gz|doc.bz2], [MANTYPE=$withval],
 			[AC_MSG_ERROR(invalid man type: $withval)])
 		])
 if test -z "$MANTYPE"; then
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 51209)
+++ tool/rbinstall.rb	(revision 51210)
@@ -545,7 +545,22 @@ install?(:local, :comm, :man) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L545
         alias print push
       end
       open(mdoc) {|r| Mdoc2Man.mdoc2man(r, w)}
-      open_for_install(destfile, $data_mode) {w.join("")}
+      w = w.join("")
+      case $mantype
+      when /\.(?:(gz)|bz2)\z/
+        suffix = $&
+        compress = $1 ? "gzip" : "bzip2"
+        require 'tmpdir'
+        Dir.mktmpdir("man") {|d|
+          dest = File.join(d, File.basename(destfile))
+          File.open(dest, "wb") {|f| f.write w}
+          if system(compress, dest)
+            w = File.open(dest+suffix, "rb") {|f| f.read}
+            destfile << suffix
+          end
+        }
+      end
+      open_for_install(destfile, $data_mode) {w}
     end
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]