lib/blogdown/file_pipeline.rb in blogdown-0.0.2 vs lib/blogdown/file_pipeline.rb in blogdown-0.1.0

- old
+ new

@@ -1,15 +1,18 @@ module Blogdown class FilePipeline + # THis keeps track of files being processed + attr_accessor :stack def initialize(root) @root=root @base=Pathname(@root) @stack=[] load_files end + # @return [Array] The files under posts folder def load_files base_input=@root+'/posts' base=Pathname.new(base_input) unless base.exist? @@ -22,13 +25,21 @@ end end end end + # Writes given contents into a file with a name given as a parameter + # @param name [String] The name of the file to be written + # @param contents [String] The contents to be written on the file def writer(name,contents) file=@base.to_s+"/output/#{name}.html" - file=File.new(file.to_s,"w") - file.write(contents) - file.close + + begin + file=File.new(file.to_s,"w") + file.write(contents) + file.close + rescue Exception=>e + raise e + end end end end \ No newline at end of file