Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Dec 18, 2019
1 parent 91783e1 commit e5862ee
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 44 deletions.
7 changes: 4 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object cask extends CaskModule {
def ivyDeps = Agg(
ivy"org.scala-lang:scala-reflect:${scalaVersion()}",
ivy"io.undertow:undertow-core:2.0.13.Final",
ivy"com.lihaoyi::upickle:0.8.0"
ivy"com.lihaoyi::upickle:0.9.0"
)
def compileIvyDeps = Agg(ivy"com.lihaoyi::acyclic:0.2.0")
def scalacOptions = Seq("-P:acyclic:force")
Expand All @@ -68,7 +68,8 @@ object cask extends CaskModule {
)
def ivyDeps = Agg(
ivy"com.lihaoyi::sourcecode:0.1.8",
ivy"com.lihaoyi::pprint:0.5.5"
ivy"com.lihaoyi::pprint:0.5.5",
ivy"com.lihaoyi::geny:0.2.0"
)
}

Expand All @@ -94,7 +95,7 @@ object cask extends CaskModule {
def testFrameworks = Seq("utest.runner.Framework")
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0"
ivy"com.lihaoyi::requests::0.3.0"
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cask/src/cask/endpoints/JsonEndpoint.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class postJson(val path: String, override val subpath: Boolean = false)
))}
} yield obj.toMap
obj match{
case Left(r) => Result.Success(r.map(Response.Data.StringData))
case Left(r) => Result.Success(r.map(Response.Data.WritableData(_)))
case Right(params) => delegate(params)
}
}
Expand Down
10 changes: 2 additions & 8 deletions cask/src/cask/model/Response.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,15 @@ object Response {
implicit class UnitData(s: Unit) extends Data{
def write(out: OutputStream) = ()
}
implicit class StringData(s: String) extends Data{
def write(out: OutputStream) = out.write(s.getBytes)
implicit class WritableData[T](s: T)(implicit f: T => geny.Writable) extends Data{
def write(out: OutputStream) = f(s).writeBytesTo(out)
}
implicit class NumericData[T: Numeric](s: T) extends Data{
def write(out: OutputStream) = out.write(s.toString.getBytes)
}
implicit class BooleanData(s: Boolean) extends Data{
def write(out: OutputStream) = out.write(s.toString.getBytes)
}
implicit class BytesData(b: Array[Byte]) extends Data{
def write(out: OutputStream) = out.write(b)
}
implicit class StreamData(b: InputStream) extends Data{
def write(out: OutputStream) = Util.transferTo(b, out)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/1 - Cask: a Scala HTTP micro-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ the relevant headers or status code for you.
Cask doesn't come bundled with HTML templating functionality, but it makes it
really easy to use community-standard libraries like
[Scalatags](https://github.com/lihaoyi/scalatags) to render your HTML. Simply
adding the relevant `ivy"com.lihaoyi::scalatags:0.7.0"` dependency to your
adding the relevant `ivy"com.lihaoyi::scalatags:0.8.0"` dependency to your
`build.sc` file is enough to render Scalatags templates:
$$$scalatags
Expand Down
2 changes: 1 addition & 1 deletion example/compress/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/compress2/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/compress3/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/cookies/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/decorated/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/decorated2/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/endpoints/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/formJsonPost/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/httpMethods/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/minimalApplication/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/minimalApplication2/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/redirectAbort/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
10 changes: 6 additions & 4 deletions example/scalatags/app/src/Scalatags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import scalatags.Text.all._
object Scalatags extends cask.MainRoutes{
@cask.get("/")
def hello() = {
"<!doctype html>" + html(
body(
h1("Hello World"),
p("I am cow")
doctype("html")(
html(
body(
h1("Hello World"),
p("I am cow")
)
)
)
}
Expand Down
4 changes: 2 additions & 2 deletions example/scalatags/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import mill._, scalalib._
trait AppModule extends ScalaModule{
def scalaVersion = "2.13.0"
def ivyDeps = Agg[Dep](
ivy"com.lihaoyi::scalatags:0.7.0",
ivy"com.lihaoyi::scalatags:0.8.1",
)

object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/staticFiles/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)

def forkWorkingDir = build.millSourcePath
Expand Down
2 changes: 1 addition & 1 deletion example/staticFiles2/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)

def forkWorkingDir = build.millSourcePath
Expand Down
4 changes: 2 additions & 2 deletions example/todo/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ trait AppModule extends ScalaModule{
def ivyDeps = Agg[Dep](
ivy"org.xerial:sqlite-jdbc:3.18.0",
ivy"io.getquill::quill-jdbc:3.4.10",
ivy"com.lihaoyi::scalatags:0.7.0",
ivy"com.lihaoyi::scalatags:0.8.1",
)

object test extends Tests{
def testFrameworks = Seq("utest.runner.Framework")

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/todoApi/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/todoDb/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
4 changes: 2 additions & 2 deletions example/twirl/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait AppModule extends ScalaModule with mill.twirllib.TwirlModule{

def generatedSources = T{ Seq(compileTwirl().classes) }
def ivyDeps = Agg[Dep](
ivy"com.lihaoyi::scalatags:0.7.0",
ivy"com.lihaoyi::scalatags:0.8.1",
ivy"com.typesafe.play::twirl-api:${twirlVersion()}",
)

Expand All @@ -16,7 +16,7 @@ trait AppModule extends ScalaModule with mill.twirllib.TwirlModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/variableRoutes/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
)
}
}
2 changes: 1 addition & 1 deletion example/websockets/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
ivy"org.asynchttpclient:async-http-client:2.5.2"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/websockets2/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
ivy"org.asynchttpclient:async-http-client:2.5.2"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/websockets3/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
ivy"org.asynchttpclient:async-http-client:2.5.2"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/websockets4/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait AppModule extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.1",
ivy"com.lihaoyi::requests::0.2.0",
ivy"com.lihaoyi::requests::0.3.0",
ivy"org.asynchttpclient:async-http-client:2.5.2"
)
}
Expand Down

0 comments on commit e5862ee

Please sign in to comment.