def windows?
  RUBY_PLATFORM =~ /win/
end

def with_temporary_rename(from, to)
  mv from, to
  yield
ensure
  mv to, from
end

def has_dot?
  if windows?
    v = `dot -V 2>&1` rescue nil
    v and v =~ /Graphviz/
  else
    `which dot` =~ /\/dot/
  end
end
