File tree Expand file tree Collapse file tree 3 files changed +40
-7
lines changed Expand file tree Collapse file tree 3 files changed +40
-7
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ def generate
161161 # Compress the search_index.js file using gzip
162162
163163 def generate_gzipped
164- return unless defined? ( Zlib )
164+ return if @options . dry_run or not defined? ( Zlib )
165165
166166 debug_msg "Compressing generated JSON index"
167167 out_dir = @base_dir + @options . op_dir
Original file line number Diff line number Diff line change @@ -521,13 +521,18 @@ def document options
521521 # by the RDoc options
522522
523523 def generate
524- Dir . chdir @options . op_dir do
525- unless @options . quiet then
526- $stderr. puts "\n Generating #{ @generator . class . name . sub ( /^.*::/ , '' ) } format into #{ Dir . pwd } ..."
527- end
528-
524+ if @options . dry_run then
525+ # do nothing
529526 @generator . generate
530- update_output_dir '.' , @start_time , @last_modified
527+ else
528+ Dir . chdir @options . op_dir do
529+ unless @options . quiet then
530+ $stderr. puts "\n Generating #{ @generator . class . name . sub ( /^.*::/ , '' ) } format into #{ Dir . pwd } ..."
531+ end
532+
533+ @generator . generate
534+ update_output_dir '.' , @start_time , @last_modified
535+ end
531536 end
532537 end
533538
Original file line number Diff line number Diff line change @@ -40,6 +40,34 @@ def test_document # functional test
4040 assert_equal 'title' , store . title
4141 end
4242
43+ def test_document_with_dry_run # functional test
44+ options = RDoc ::Options . new
45+ options . files = [ File . expand_path ( '../xref_data.rb' , __FILE__ ) ]
46+ options . setup_generator 'darkfish'
47+ options . main_page = 'MAIN_PAGE.rdoc'
48+ options . root = Pathname File . expand_path ( '..' , __FILE__ )
49+ options . title = 'title'
50+ options . dry_run = true
51+
52+ rdoc = RDoc ::RDoc . new
53+
54+ out = nil
55+ temp_dir do
56+ out , = capture_io do
57+ rdoc . document options
58+ end
59+
60+ refute File . directory? 'doc'
61+ assert_equal rdoc , rdoc . store . rdoc
62+ end
63+ assert_includes out , '100%'
64+
65+ store = rdoc . store
66+
67+ assert_equal 'MAIN_PAGE.rdoc' , store . main
68+ assert_equal 'title' , store . title
69+ end
70+
4371 def test_gather_files
4472 a = File . expand_path __FILE__
4573 b = File . expand_path '../test_rdoc_text.rb' , __FILE__
You can’t perform that action at this time.
0 commit comments