Skip to content

Commit a992f68

Browse files
committed
upgrade to latest Kotlin
1 parent 31b5ac2 commit a992f68

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
dependencies {
66
classpath "io.ratpack:ratpack-gradle:0.9.13",
77
"com.github.jengelman.gradle.plugins:shadow:1.2.1",
8-
"org.jetbrains.kotlin:kotlin-gradle-plugin:0.10.770"
8+
"org.jetbrains.kotlin:kotlin-gradle-plugin:0.11.91.1"
99
}
1010
}
1111

@@ -23,7 +23,7 @@ repositories {
2323
}
2424

2525
dependencies {
26-
compile "org.jetbrains.kotlin:kotlin-stdlib:0.10.770"
26+
compile "org.jetbrains.kotlin:kotlin-stdlib:0.11.91.1"
2727
compile ratpack.dependency("guice")
2828
testCompile "junit:junit:4.12"
2929
}

src/main/kotlin/ratpack/example/kotlin/HandlerFactory.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package ratpack.example.kotlin
22

3-
import ratpack.registry.Registry
43
import ratpack.guice.Guice
4+
import ratpack.registry.Registry
55

66
class HandlerFactory : ratpack.launch.HandlerFactory {
77
override fun create(registry : Registry) = Guice.builder(registry)
8-
.bindings({ registry -> registry.add(MyModule()) })
9-
.build({ chain ->
10-
chain
11-
// Map to /foo
12-
.handler("foo") { context -> context.render("from the foo handler") }
8+
.bindings { registry -> registry.add(MyModule()) }
9+
.build { chain ->
10+
// Map to /foo
11+
chain.handler("foo") { context -> context.render("from the foo handler") }
1312

1413
// Map to /bar
1514
.handler("bar") { context -> context.render("from the bar handler") }
@@ -33,5 +32,5 @@ class HandlerFactory : ratpack.launch.HandlerFactory {
3332

3433
// If nothing above matched, we'll get to here.
3534
.handler { context -> context.render("root handler!") }
36-
})
35+
}
3736
}

src/main/kotlin/ratpack/example/kotlin/MyApp.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import ratpack.server.RatpackServer
44
import ratpack.server.ServerConfig
55

66
fun main(args : Array<String>) {
7-
RatpackServer.of { b ->
8-
b.serverConfig(ServerConfig.findBaseDirProps())
9-
b.handler { registry ->
7+
RatpackServer.of {
8+
it.serverConfig(ServerConfig.findBaseDirProps())
9+
it.handler { registry ->
1010
HandlerFactory().create(registry)
1111
}
1212
}.start()

src/main/kotlin/ratpack/example/kotlin/MyModule.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,3 @@ class MyModule : AbstractModule(), HandlerDecoratingModule {
2929
*/
3030
override fun decorate(injector : Injector?, handler : Handler?) = chain(LoggingHandler(), handler)
3131
}
32-
33-
fun AbstractModule.chain(vararg handlers : Handler) = chain(handlers.toList())

0 commit comments

Comments
 (0)