diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-08-22 18:15:24 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-08-22 18:15:24 +0800 |
commit | dfe179d66517ab60dc80a89e6d5d14dd20b3fa2f (patch) | |
tree | 1fc9331f337fb622217d9cddfb0b723c85e6a8ed /example | |
parent | f3fe134973e06b7498403c2775b8cdd181139380 (diff) | |
download | cask-dfe179d66517ab60dc80a89e6d5d14dd20b3fa2f.tar.gz cask-dfe179d66517ab60dc80a89e6d5d14dd20b3fa2f.tar.bz2 cask-dfe179d66517ab60dc80a89e6d5d14dd20b3fa2f.zip |
0.1.30.1.3
Diffstat (limited to 'example')
-rw-r--r-- | example/compress/build.sc | 2 | ||||
-rw-r--r-- | example/compress2/build.sc | 2 | ||||
-rw-r--r-- | example/compress3/build.sc | 2 | ||||
-rw-r--r-- | example/cookies/build.sc | 2 | ||||
-rw-r--r-- | example/decorated/build.sc | 2 | ||||
-rw-r--r-- | example/decorated2/build.sc | 2 | ||||
-rw-r--r-- | example/endpoints/build.sc | 2 | ||||
-rw-r--r-- | example/formJsonPost/build.sc | 2 | ||||
-rw-r--r-- | example/httpMethods/build.sc | 2 | ||||
-rw-r--r-- | example/minimalApplication/build.sc | 2 | ||||
-rw-r--r-- | example/minimalApplication2/build.sc | 2 | ||||
-rw-r--r-- | example/redirectAbort/build.sc | 2 | ||||
-rw-r--r-- | example/scalatags/build.sc | 2 | ||||
-rw-r--r-- | example/staticFiles/build.sc | 2 | ||||
-rw-r--r-- | example/todo/build.sc | 2 | ||||
-rw-r--r-- | example/todoApi/build.sc | 2 | ||||
-rw-r--r-- | example/todoDb/build.sc | 2 | ||||
-rw-r--r-- | example/twirl/app/src/Twirl.scala | 9 | ||||
-rw-r--r-- | example/twirl/app/test/src/ExampleTests.scala | 29 | ||||
-rw-r--r-- | example/twirl/app/views/hello.scala.html | 7 | ||||
-rw-r--r-- | example/twirl/build.sc | 23 | ||||
-rw-r--r-- | example/variableRoutes/build.sc | 2 | ||||
-rw-r--r-- | example/websockets/build.sc | 2 |
23 files changed, 87 insertions, 19 deletions
diff --git a/example/compress/build.sc b/example/compress/build.sc index a08b2c6..e5faf4b 100644 --- a/example/compress/build.sc +++ b/example/compress/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/compress2/build.sc b/example/compress2/build.sc index a08b2c6..e5faf4b 100644 --- a/example/compress2/build.sc +++ b/example/compress2/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/compress3/build.sc b/example/compress3/build.sc index a08b2c6..e5faf4b 100644 --- a/example/compress3/build.sc +++ b/example/compress3/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/cookies/build.sc b/example/cookies/build.sc index a08b2c6..e5faf4b 100644 --- a/example/cookies/build.sc +++ b/example/cookies/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/decorated/build.sc b/example/decorated/build.sc index a08b2c6..e5faf4b 100644 --- a/example/decorated/build.sc +++ b/example/decorated/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/decorated2/build.sc b/example/decorated2/build.sc index a08b2c6..e5faf4b 100644 --- a/example/decorated2/build.sc +++ b/example/decorated2/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/endpoints/build.sc b/example/endpoints/build.sc index a08b2c6..e5faf4b 100644 --- a/example/endpoints/build.sc +++ b/example/endpoints/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/formJsonPost/build.sc b/example/formJsonPost/build.sc index a08b2c6..e5faf4b 100644 --- a/example/formJsonPost/build.sc +++ b/example/formJsonPost/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/httpMethods/build.sc b/example/httpMethods/build.sc index a08b2c6..e5faf4b 100644 --- a/example/httpMethods/build.sc +++ b/example/httpMethods/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/minimalApplication/build.sc b/example/minimalApplication/build.sc index a08b2c6..e5faf4b 100644 --- a/example/minimalApplication/build.sc +++ b/example/minimalApplication/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/minimalApplication2/build.sc b/example/minimalApplication2/build.sc index a08b2c6..e5faf4b 100644 --- a/example/minimalApplication2/build.sc +++ b/example/minimalApplication2/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/redirectAbort/build.sc b/example/redirectAbort/build.sc index a08b2c6..e5faf4b 100644 --- a/example/redirectAbort/build.sc +++ b/example/redirectAbort/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/scalatags/build.sc b/example/scalatags/build.sc index 86141e0..12e8ff9 100644 --- a/example/scalatags/build.sc +++ b/example/scalatags/build.sc @@ -13,7 +13,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/staticFiles/build.sc b/example/staticFiles/build.sc index 54d1fb5..4f4716d 100644 --- a/example/staticFiles/build.sc +++ b/example/staticFiles/build.sc @@ -14,7 +14,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) def forkWorkingDir = build.millSourcePath diff --git a/example/todo/build.sc b/example/todo/build.sc index 0f01a14..37e5253 100644 --- a/example/todo/build.sc +++ b/example/todo/build.sc @@ -15,7 +15,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/todoApi/build.sc b/example/todoApi/build.sc index a08b2c6..e5faf4b 100644 --- a/example/todoApi/build.sc +++ b/example/todoApi/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/todoDb/build.sc b/example/todoDb/build.sc index 5bfc599..52ac761 100644 --- a/example/todoDb/build.sc +++ b/example/todoDb/build.sc @@ -14,7 +14,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/twirl/app/src/Twirl.scala b/example/twirl/app/src/Twirl.scala new file mode 100644 index 0000000..f6f12b4 --- /dev/null +++ b/example/twirl/app/src/Twirl.scala @@ -0,0 +1,9 @@ +package app +object Twirl extends cask.MainRoutes{ + @cask.get("/") + def hello() = { + "<!doctype html>" + html.hello("Hello World") + } + + initialize() +} diff --git a/example/twirl/app/test/src/ExampleTests.scala b/example/twirl/app/test/src/ExampleTests.scala new file mode 100644 index 0000000..815f656 --- /dev/null +++ b/example/twirl/app/test/src/ExampleTests.scala @@ -0,0 +1,29 @@ +package app +import io.undertow.Undertow + +import utest._ + +object ExampleTests extends TestSuite{ + def test[T](example: cask.main.BaseMain)(f: String => T): T = { + val server = Undertow.builder + .addHttpListener(8080, "localhost") + .setHandler(example.defaultHandler) + .build + server.start() + val res = + try f("http://localhost:8080") + finally server.stop() + res + } + + val tests = Tests { + 'Twirl - test(Twirl) { host => + val body = requests.get(host).text() + + assert( + body.contains("<h1>Hello World</h1>"), + body.contains("<p>I am cow</p>"), + ) + } + } +} diff --git a/example/twirl/app/views/hello.scala.html b/example/twirl/app/views/hello.scala.html new file mode 100644 index 0000000..604a8f4 --- /dev/null +++ b/example/twirl/app/views/hello.scala.html @@ -0,0 +1,7 @@ +@(titleTxt: String) +<html> + <body> + <h1>@titleTxt</h1> + <p>I am cow</p> + </body> +</html>
\ No newline at end of file diff --git a/example/twirl/build.sc b/example/twirl/build.sc new file mode 100644 index 0000000..8e95a19 --- /dev/null +++ b/example/twirl/build.sc @@ -0,0 +1,23 @@ +import mill._, scalalib._ +import $ivy.`com.lihaoyi::mill-contrib-twirllib:0.2.6-18-b29c13` + +trait AppModule extends ScalaModule with mill.twirllib.TwirlModule{ + def scalaVersion = "2.12.6" + def twirlVersion = "1.3.15" + + def generatedSources = T{ Seq(compileTwirl().classes) } + def ivyDeps = Agg( + ivy"com.lihaoyi::cask:0.1.1", + ivy"com.lihaoyi::scalatags:0.6.7", + ivy"com.typesafe.play::twirl-api:${twirlVersion()}", + ) + + object test extends Tests{ + def testFrameworks = Seq("utest.runner.Framework") + + def ivyDeps = Agg( + ivy"com.lihaoyi::utest::0.6.3", + ivy"com.lihaoyi::requests::0.1.3", + ) + } +}
\ No newline at end of file diff --git a/example/variableRoutes/build.sc b/example/variableRoutes/build.sc index a08b2c6..e5faf4b 100644 --- a/example/variableRoutes/build.sc +++ b/example/variableRoutes/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ) } }
\ No newline at end of file diff --git a/example/websockets/build.sc b/example/websockets/build.sc index aa9fa17..ef595b1 100644 --- a/example/websockets/build.sc +++ b/example/websockets/build.sc @@ -12,7 +12,7 @@ trait AppModule extends ScalaModule{ def ivyDeps = Agg( ivy"com.lihaoyi::utest::0.6.3", - ivy"com.lihaoyi::requests::0.1.2", + ivy"com.lihaoyi::requests::0.1.3", ivy"org.asynchttpclient:async-http-client:2.5.2" ) } |