class GeneratorSpec::Matcher::Directory

def description

def description
  'has directory structure'
end

def directory(name, &block)

def directory(name, &block)
  @tree[name] = block_given? && Directory.new(location(name), &block)
end

def file(name, &block)

def file(name, &block)
  @tree[name] = File.new(location(name), &block)
end

def initialize(root = nil, &block)

def initialize(root = nil, &block)
  @tree = {}
  @negative_tree = []
  @root = root
  instance_eval(&block) if block_given?
end

def location(name)

def location(name)
  [@root, name].compact.join("/")
end

def matches?(root)

def matches?(root)
  @tree.each do |file, value|
    unless value
      unless root.join(location(file)).exist?
        throw :failure, "#{root}/#{location(file)}"
      end
    else
      value.matches?(root)
    end
  end
  @negative_tree.each do |file|
    if root.join(location(file)).exist?
      throw :failure, [:not, "unexpected #{root}/#{location(file)}"]
    end
  end
  nil
end

def migration(name, &block)

def migration(name, &block)
  @tree[name] = Migration.new(location(name), &block)
end

def no_file(name)

def no_file(name)
  @negative_tree << name
end