Really support extension-less files (and still support -o)

This commit is contained in:
Colin Shea 2010-04-03 08:01:48 +08:00 committed by Ryan Tomayko
parent 889fcb286b
commit 6aa7bd6a33

View File

@ -88,7 +88,7 @@ end
# Run each file through Rocco and write output. # Run each file through Rocco and write output.
sources.each do |filename| sources.each do |filename|
rocco = Rocco.new(filename, sources, options) rocco = Rocco.new(filename, sources, options)
dest = File.join(output_dir, filename.split('.')[0..-2].join('.') + '.html') dest = File.join(output_dir, (filename.split('.')[0..-2].empty? ? filename : filename.split('.')[0..-2].join('.')) + '.html')
puts "rocco: #{filename} -> #{dest}" puts "rocco: #{filename} -> #{dest}"
FileUtils.mkdir_p File.dirname(dest) FileUtils.mkdir_p File.dirname(dest)
File.open(dest, 'wb') { |fd| fd.write(rocco.to_html) } File.open(dest, 'wb') { |fd| fd.write(rocco.to_html) }