-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add module alias to Graphviz export (#159)
- Loading branch information
Showing
9 changed files
with
110 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
plugin/src/main/kotlin/com/jraska/module/graph/assertion/DependencyToAssert.kt
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
plugin/src/main/kotlin/com/jraska/module/graph/assertion/ModuleDependency.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.jraska.module.graph.assertion | ||
|
||
class ModuleDependency( | ||
val dependencyPair: Pair<String, String>, | ||
private val fromAlias: String?, | ||
private val toAlias: String? | ||
) { | ||
private val from get() = dependencyPair.first | ||
private val to get() = dependencyPair.second | ||
|
||
fun pairToAssert(): Pair<String, String> { | ||
if (fromAlias != null || toAlias != null) { | ||
return (fromAlias ?: from) to (toAlias ?: to) | ||
} else { | ||
return dependencyPair | ||
} | ||
} | ||
|
||
fun assertDisplayText(): String { | ||
val stringBuilder = StringBuilder() | ||
|
||
if (fromAlias != null) { | ||
stringBuilder.append("\"$fromAlias\"") | ||
stringBuilder.append("('${from}')") | ||
} else { | ||
stringBuilder.append("'${from}'") | ||
} | ||
|
||
stringBuilder.append(" -> ") | ||
|
||
if (toAlias != null) { | ||
stringBuilder.append("\"$toAlias\"") | ||
stringBuilder.append("('${to}')") | ||
} else { | ||
stringBuilder.append("'${to}'") | ||
} | ||
|
||
return stringBuilder.toString() | ||
} | ||
|
||
fun fromDocText(): String { | ||
return if (fromAlias != null) { | ||
"$from('$fromAlias')" | ||
} else { | ||
from | ||
} | ||
} | ||
|
||
fun toDocText() : String { | ||
return if (toAlias != null) { | ||
"$to('$toAlias')" | ||
} else { | ||
to | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters