Last active
April 28, 2016 21:12
-
-
Save MasseGuillaume/7ba73500997cb7dfdb80ec9328b45488 to your computer and use it in GitHub Desktop.
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
import com.scalakata._ | |
@instrument class Playground { | |
import ch.epfl.scala.index._ | |
import cleanup._ | |
import maven._ | |
import scala.util.Success | |
def filtered(m: MavenModel) = { | |
m.dependencies .exists(d => | |
d.groupId == "org.scala-js" || | |
d.groupId == "org.scala-lang.modules.scalajs" | |
) | |
} | |
object A { | |
val poms = maven.Poms.get.collect{ case Success(p) => maven.PomConvert(p) } | |
val scmCleanup = new ScmCleanup | |
def c(m: maven.MavenModel) = { | |
import m._ | |
s" * $groupId $artifactId $version" | |
} | |
def g(ms: List[MavenModel]) = { | |
ms.groupBy(d => (d.groupId, d.artifactId)).map{ case ((groupId, artifactId), vs) => | |
val vss = vs.map(v => s" * ${v.version}").mkString(System.lineSeparator) | |
s"""| * $groupId $artifactId | |
|$vss""".stripMargin | |
} | |
} | |
val js = | |
poms.filter(filtered).groupBy(p => scmCleanup.find(p).headOption).map{ | |
case (Some(GithubRepo(user, repo)), vs) => s"* https://github.com/$user/$repo" -> g(vs) | |
case (None, vs) => "* nope" -> g(vs) | |
} | |
} | |
import A._ | |
poms.filter(filtered).groupBy(d => (d.groupId, d.artifactId)).size | |
js.toList.sortBy(_._1.toLowerCase).map{ case (k, vs) => | |
s"""|$k | |
|${vs.mkString(System.lineSeparator)}""".stripMargin | |
}.mkString(System.lineSeparator) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment