do not add ./ to paths
This commit is contained in:
parent
b2a76fac29
commit
66723da96f
12
bin/rocco
12
bin/rocco
@ -59,15 +59,6 @@ if sources.empty?
|
|||||||
abort_with_note "#{File.basename($0)}: no input <file>s given"
|
abort_with_note "#{File.basename($0)}: no input <file>s given"
|
||||||
end
|
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.
|
# What a fucking mess. Most of this is duplicated in rocco.rb too.
|
||||||
libdir = File.expand_path('../../lib', __FILE__).sub(/^#{Dir.pwd}\//, '')
|
libdir = File.expand_path('../../lib', __FILE__).sub(/^#{Dir.pwd}\//, '')
|
||||||
begin
|
begin
|
||||||
@ -99,7 +90,8 @@ 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.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}"
|
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) }
|
||||||
|
Loading…
Reference in New Issue
Block a user