lib/stack/generator.rb in stack-0.0.6 vs lib/stack/generator.rb in stack-0.0.7

- old
+ new

@@ -5,17 +5,21 @@ attr_accessor :children attr_accessor :layouts attr_accessor :pages + attr_accessor :remove_first + attr_accessor :processed_at, :transformed_at def initialize(source, target, parent = nil) self.source = source self.target = target self.parent = parent + self.remove_first = false + self.layouts = (parent) ? parent.layouts.dup : { } self.children = [ ] # read layouts @@ -52,9 +56,13 @@ self.children.push(Stack::Generator.new(File.join(self.source, dir), File.join(self.target, dir), self)) end end def transform! + if self.remove_first + FileUtils.rm_r self.target + end + self.transformed_at = Time.now self.pages.each do |name, page| page.write! end \ No newline at end of file