Stats printer that prints just the files being documented with a progress bar
Prints a file with a progress bar
# File lib/rdoc/stats.rb, line 169
169: def print_file(files_so_far, filename)
170: progress_bar = sprintf("%3d%% [%2d/%2d] ",
171: 100 * (files_so_far + 1) / @total_files,
172: files_so_far + 1,
173: @total_files)
174:
175: if $stdout.tty?
176: # Print a progress bar, but make sure it fits on a single line. Filename
177: # will be truncated if necessary.
178: terminal_width = (ENV['COLUMNS'] || 80).to_i
179: max_filename_size = terminal_width - progress_bar.size
180: if filename.size > max_filename_size
181: # Turn "some_long_filename.rb" to "...ong_filename.rb"
182: filename = filename[(filename.size - max_filename_size) .. 1]
183: filename[0..2] = "..."
184: end
185:
186: # Pad the line with whitespaces so that leftover output from the
187: # previous line doesn't show up.
188: line = "#{progress_bar}#{filename}"
189: padding = terminal_width - line.size
190: line << (" " * padding) if padding > 0
191:
192: $stdout.print("#{line}\r")
193: else
194: $stdout.puts "#{progress_bar} #{filename}"
195: end
196: $stdout.flush
197: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.