From 66723da96ff230f1b8af40dbcf32997b84b76a37 Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Sat, 5 Mar 2011 03:37:05 -0800 Subject: [PATCH] do not add ./ to paths --- bin/rocco | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/bin/rocco b/bin/rocco index 36431f4..a56c0d3 100755 --- a/bin/rocco +++ b/bin/rocco @@ -59,15 +59,6 @@ if sources.empty? abort_with_note "#{File.basename($0)}: no input s given" end -# Postprocess `sources` so that paths like `bin/file.rb` are written as `./bin/file.rb`: -sources = sources.map do |filename| - if filename.match( '^[a-zA-Z]' ) - File.join( '.', filename ) - else - filename - end -end - # What a fucking mess. Most of this is duplicated in rocco.rb too. libdir = File.expand_path('../../lib', __FILE__).sub(/^#{Dir.pwd}\//, '') begin @@ -99,7 +90,8 @@ end # Run each file through Rocco and write output. sources.each do |filename| rocco = Rocco.new(filename, sources, options) - dest = File.join(output_dir, filename.sub(Regexp.new("#{File.extname(filename)}$"),".html")) + dest = filename.sub(Regexp.new("#{File.extname(filename)}$"),".html") + dest = File.join(output_dir, dest) if output_dir != '.' puts "rocco: #{filename} -> #{dest}" FileUtils.mkdir_p File.dirname(dest) File.open(dest, 'wb') { |fd| fd.write(rocco.to_html) }