Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created June 28, 2014 06:47

Revisions

  1. xuwei-k created this gist Jun 28, 2014.
    54 changes: 54 additions & 0 deletions Main.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    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)
    }

    }
    5 changes: 5 additions & 0 deletions build.sbt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    scalaVersion := "2.11.1"

    libraryDependencies += "com.github.xuwei-k" %% "ghscala" % "0.2.11"

    libraryDependencies += "com.github.xuwei-k" %% "httpz-native" % "0.2.11"