ruby-changes:37978
From: nobu <ko1@a...>
Date: Mon, 23 Mar 2015 14:15:43 +0900 (JST)
Subject: [ruby-changes:37978] nobu:r50059 (trunk): json_index.rb: check zlib
nobu 2015-03-23 14:15:15 +0900 (Mon, 23 Mar 2015) New Revision: 50059 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50059 Log: json_index.rb: check zlib * lib/rdoc/generator/json_index.rb (generate_gzipped): do nothing unless zlib is available. Modified files: trunk/lib/rdoc/generator/json_index.rb trunk/test/rdoc/test_rdoc_generator_json_index.rb Index: lib/rdoc/generator/json_index.rb =================================================================== --- lib/rdoc/generator/json_index.rb (revision 50058) +++ lib/rdoc/generator/json_index.rb (revision 50059) @@ -1,5 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/json_index.rb#L1 require 'json' -require 'zlib' +begin + require 'zlib' +rescue LoadError +end ## # The JsonIndex generator is designed to complement an HTML generator and @@ -157,6 +160,8 @@ class RDoc::Generator::JsonIndex https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/json_index.rb#L160 # Compress the search_index.js file using gzip def generate_gzipped + return unless defined?(Zlib) + debug_msg "Compressing generated JSON index" out_dir = @base_dir + @options.op_dir Index: test/rdoc/test_rdoc_generator_json_index.rb =================================================================== --- test/rdoc/test_rdoc_generator_json_index.rb (revision 50058) +++ test/rdoc/test_rdoc_generator_json_index.rb (revision 50059) @@ -137,7 +137,11 @@ class TestRDocGeneratorJsonIndex < RDoc: https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_generator_json_index.rb#L137 end def test_generate_gzipped - require 'zlib' + begin + require 'zlib' + rescue LoadError + skip "no zlib" + end @g.generate @g.generate_gzipped -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/