Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created December 8, 2012 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xuwei-k/4239913 to your computer and use it in GitHub Desktop.
Save xuwei-k/4239913 to your computer and use it in GitHub Desktop.
sbt pluing watcher ranking
import sbt._,Keys._
object build extends Build{
lazy val root = Project(
"sbt-plugin-ranking",
file(".")
).settings(
scalaVersion := "2.9.2",
licenses := Seq("MIT License" -> url("http://www.opensource.org/licenses/mit-license.php"))
).dependsOn(
uri("git://github.com/xuwei-k/ghscala.git#1bded977f0ce29b")
)
}
package com.github.xuwei_k.sbt_plugin_ranking
import com.github.xuwei_k.ghscala.GhScala
object Main extends App{
val repo = """https:\/\/github.com\/([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-]+)""".r
val url = "http://www.scala-sbt.org/release/docs/Community/Community-Plugins.html"
val html = io.Source.fromURL(url).mkString
val repoList = repo.findAllIn(html).map{case repo(user,name) => user -> name }.toList.distinct
val info = repoList.flatMap{case (u,r) =>
try{
// Thread.sleep(1000)
Option(GhScala.repo(u,r))
}catch{
case e =>
println(u,r)
e.printStackTrace
None
}
}
info.sortBy(_.watchers).reverse.foreach{r => println(r.html_url + " " + r.watchers)}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment