1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

json_index.rb: check zlib

* lib/rdoc/generator/json_index.rb (generate_gzipped): do nothing
  unless zlib is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-03-23 05:15:15 +00:00
parent 98205fdc19
commit 9da887cf57
2 changed files with 11 additions and 2 deletions

View file

@ -1,5 +1,8 @@
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
# 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

View file

@ -137,7 +137,11 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
end
def test_generate_gzipped
require 'zlib'
begin
require 'zlib'
rescue LoadError
skip "no zlib"
end
@g.generate
@g.generate_gzipped