Sha256: e437cac6605a7e43a5d30b6e54dea49b49c95fa3555c0d4c181bc690abf87bec

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

module Blogdown
  class FilePipeline
    attr_accessor :stack
    def initialize(root)
      @root=root
      @base=Pathname(@root)
      @stack=[]
      load_files
    end

    def load_files
      base_input=@root+'/posts'

      base=Pathname.new(base_input)
      unless base.exist?
        raise Blogdown::Exceptions::DirectoryNotFound, "please make sure the posts folder is present"
      end
      if base.exist?
        base.each_child do|child|
          if child.basename.to_s=~/^*.md$/
            self.stack<<child
          end
        end
      end
    end

    def writer(name,contents)
      file=@base.to_s+"/output/#{name}.html"
      file=File.new(file.to_s,"w")
      file.write(contents)
      file.close
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blogdown-0.0.2 lib/blogdown/file_pipeline.rb
blogdown-0.0.1 lib/blogdown/file_pipeline.rb