Add a --debug option to bin/haml.

This commit is contained in:
Nathan Weizenbaum 2008-12-13 15:33:29 -08:00
parent 71c0146626
commit d9530e2328
1 changed files with 10 additions and 0 deletions

View File

@ -235,6 +235,10 @@ END
opts.on('-I', '--load-path PATH', "Same as 'ruby -I'.") do |path|
@options[:load_paths] << path
end
opts.on('--debug', "Print out the precompiled Ruby source.") do
@options[:debug] = true
end
end
def process_result
@ -254,6 +258,12 @@ END
@options[:load_paths].each {|p| $LOAD_PATH << p}
@options[:requires].each {|f| require f}
if @options[:debug]
puts engine.precompiled
puts '=' * 100
end
result = engine.to_html
rescue Exception => e
raise e if @options[:trace]