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:
parent
98205fdc19
commit
9da887cf57
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,8 @@
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'zlib'
|
begin
|
||||||
|
require 'zlib'
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# The JsonIndex generator is designed to complement an HTML generator and
|
# 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
|
# Compress the search_index.js file using gzip
|
||||||
|
|
||||||
def generate_gzipped
|
def generate_gzipped
|
||||||
|
return unless defined?(Zlib)
|
||||||
|
|
||||||
debug_msg "Compressing generated JSON index"
|
debug_msg "Compressing generated JSON index"
|
||||||
out_dir = @base_dir + @options.op_dir
|
out_dir = @base_dir + @options.op_dir
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,11 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generate_gzipped
|
def test_generate_gzipped
|
||||||
|
begin
|
||||||
require 'zlib'
|
require 'zlib'
|
||||||
|
rescue LoadError
|
||||||
|
skip "no zlib"
|
||||||
|
end
|
||||||
@g.generate
|
@g.generate
|
||||||
@g.generate_gzipped
|
@g.generate_gzipped
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue