mirror of https://github.com/sbt/sbt.git
rename Graph => AsciiTreeLayout
This commit is contained in:
parent
42ec040ccc
commit
045aff16f5
|
|
@ -145,7 +145,7 @@ object IvyGraphMLDependencies extends App {
|
|||
// there should only be one root node (the project itself)
|
||||
val roots = graph.nodes.filter(n => !graph.edges.exists(_._2 == n.id)).sortBy(_.id.idString)
|
||||
roots.map { root =>
|
||||
Graph.toAscii[Module](root, node => deps.getOrElse(node.id, Seq.empty[Module]), displayModule)
|
||||
util.AsciiTreeLayout.toAscii[Module](root, node => deps.getOrElse(node.id, Seq.empty[Module]), displayModule)
|
||||
}.mkString("\n")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@
|
|||
*
|
||||
* Copied from sbt 0.12 source code
|
||||
*/
|
||||
package net.virtualvoid.sbt.graph
|
||||
package net.virtualvoid.sbt.graph.util
|
||||
|
||||
object Graph
|
||||
{
|
||||
object AsciiTreeLayout {
|
||||
// [info] foo
|
||||
// [info] +-bar
|
||||
// [info] | +-baz
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package net.virtualvoid.sbt.graph
|
||||
package net.virtualvoid.sbt.graph.util
|
||||
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
class GraphSpecs extends Specification {
|
||||
class AsciiTreeLayoutSpecs extends Specification {
|
||||
sealed trait Tree
|
||||
case class Branch(left: Tree, right: Tree) extends Tree
|
||||
case class Leaf(i: Int) extends Tree
|
||||
|
|
@ -19,7 +19,7 @@ class GraphSpecs extends Specification {
|
|||
"Graph" should {
|
||||
"layout simple graphs" in {
|
||||
val simple = Branch(Branch(Leaf(1), Leaf(2)), Leaf(3))
|
||||
Graph.toAscii(simple, children, display, 20) ===
|
||||
AsciiTreeLayout.toAscii(simple, children, display, 20) ===
|
||||
"""Branch
|
||||
| +-Branch
|
||||
| | +-1
|
||||
|
|
@ -30,7 +30,7 @@ class GraphSpecs extends Specification {
|
|||
}
|
||||
"layout deep graphs" in {
|
||||
val simple = Branch(Branch(Branch(Branch(Branch(Branch(Leaf(1), Leaf(1)), Leaf(1)), Leaf(1)), Leaf(2)), Leaf(3)), Leaf(4))
|
||||
Graph.toAscii(simple, children, display, 10) ===
|
||||
AsciiTreeLayout.toAscii(simple, children, display, 10) ===
|
||||
"""Branch
|
||||
| +-Branch
|
||||
| | +-Br..
|
||||
Loading…
Reference in New Issue