Class: Flue::Runner

Inherits:
Object
  • Object
show all
Includes:
Benchmark, Logger
Defined in:
lib/flue/runner.rb

Constant Summary

Constants included from Logger

Logger::DEFAULT_LOGGER

Instance Method Summary collapse

Methods included from Logger

included, #logger

Methods included from Benchmark

#benchmark

Instance Method Details

#filesObject



9
10
11
# File 'lib/flue/runner.rb', line 9

def files
  Dir["site/[^_]*"] - Dir["site/*.yml"]
end

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/flue/runner.rb', line 13

def run
  logger.info "beginning run..."
  files.each do |file|
    basefile = Basefile.new(file)
    File.open(basefile.outfile_name, "w") do |f|
      benchmark "#{basefile.basename} => #{basefile.outfile_name}" do
        options = {}
        data = basefile.datafile
        if data
          options[:variables] = YAML.load(data)
        end
        f.write FilterRegister.run(basefile.exts, basefile.content, options)
      end
    end
  end
end