Sha256: b7dca6d80ddbf294e7ae6504acc903371238ca2b9f1c34452153606e7da00fd0
Contents?: true
Size: 769 Bytes
Versions: 2
Compression:
Stored size: 769 Bytes
Contents
class Renderer def self.register(cls) @@renderers ||= Array.new @@renderers << cls end def initialize(templatedir, outdir, verbose) @templatedir = templatedir @outdir = outdir @verbose = verbose @renderers = @@renderers.map { |x| x.new(templatedir, outdir, verbose) } end def render(stats) Dir.chdir(@templatedir) { Dir.glob('*').sort }.each do |file| next unless File.file?(File.join(@templatedir, file)) r = @renderers.find { |r| r.handle?(file) } if r.nil? puts "copying '#{file}' ..." if @verbose FileUtils.copy(File.join(@templatedir, file), @outdir) else puts "rendering '#{file}' using #{r.name} ..." if @verbose r.render(file, stats) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
gitstats-rb-2.0.0 | lib/gitstats/renderer.rb |
gitstats-ruby-1.0.1 | lib/gitstats/renderer.rb |