Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created June 28, 2014 06:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuwei-k/9e1d63e6f0ba8f938a11 to your computer and use it in GitHub Desktop.
Save xuwei-k/9e1d63e6f0ba8f938a11 to your computer and use it in GitHub Desktop.
scalaVersion := "2.11.1"
libraryDependencies += "com.github.xuwei-k" %% "ghscala" % "0.2.11"
libraryDependencies += "com.github.xuwei-k" %% "httpz-native" % "0.2.11"
import httpz._, native._
object Main {
final case class Repo(owner: String, name: String)
val repositories = (
Repo("slick", "slick") ::
Repo("mauricio", "postgresql-async") ::
Repo("squeryl", "squeryl") ::
Repo("scalikejdbc", "scalikejdbc") ::
Repo("twitter", "querulous") ::
Repo("aselab", "scala-activerecord") ::
Repo("fwbrasil", "activate") ::
Repo("jonifreeman", "sqltyped") ::
Repo("sorm", "sorm") ::
Repo("scalikejdbc", "scalikejdbc-async") ::
Repo("jpersson", "prequel") ::
Repo("lucidsoftware", "relate") ::
Repo("cbmi", "dataexpress") ::
Repo("p3t0r", "scala-sql-dsl") ::
Repo("SimpleFinance", "jdub") ::
Repo("mybatis", "scala") ::
Repo("chochos", "scalasql") ::
Repo("Synesso", "scweery") ::
Repo("takezoe", "mirage-scala") ::
Repo("akr4", "shirahae-sql") ::
Nil
)
val action: Action[List[(Int, String)]] = {
import scalaz._, std.list._, syntax.traverse._
repositories.map(repo =>
ghscala.Github.repo(repo.owner, repo.name)
).sequenceU.map{
_.map{
repo => repo.watchers -> repo.name
}.sortBy(_._1).reverse
}
}
def main(args: Array[String]): Unit = {
val config = args match {
case Array(user, pass) =>
Request.auth(user, pass)
case _ =>
scalaz.Endo.idEndo[Request]
}
action.interpretWith(config).fold(
throw _, identity
).foreach(println)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment