Skip to content

Commit

Permalink
replaces tut with mdoc due to tpolecat/tut#246
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroli committed Sep 8, 2019
1 parent b8e8a30 commit 7e40567
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 65 deletions.
7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ lazy val siteSettings = ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(
git.remoteRepo := "git@github.com:mkroli/dns4s.git",
siteSubdirName in ScalaUnidoc := "api",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), siteSubdirName in ScalaUnidoc),
sourceDirectory in Paradox := tutTargetDirectory.value,
mdocIn := sourceDirectory.value / "main" / "doc",
sourceDirectory in Paradox := mdocOut.value,
sourceDirectory in Paradox in paradoxTheme := sourceDirectory.value / "main" / "paradox" / "template",
makeSite := makeSite.dependsOn(tut).value,
makeSite := makeSite.dependsOn(mdoc.toTask("")).value,
paradoxNavigationDepth := 5,
paradoxProperties in Paradox ~= (_ - "github.base_url"),
paradoxProperties in Paradox += ("version" -> version.value),
Expand All @@ -127,7 +128,7 @@ lazy val dns4sRoot = Project(id = "dns4s", base = file("."))
parentSettings ++
siteSettings
)
.enablePlugins(GhpagesPlugin, ScalaUnidocPlugin, TutPlugin, ParadoxSitePlugin, ParadoxMaterialThemePlugin)
.enablePlugins(GhpagesPlugin, ScalaUnidocPlugin, MdocPlugin, ParadoxSitePlugin, ParadoxMaterialThemePlugin)
.aggregate(dns4sCore, dns4sAkka, dns4sNetty)
.dependsOn(dns4sCore, dns4sAkka, dns4sNetty)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import io.netty.channel.socket.nio.NioDatagramChannel
import io.netty.util.concurrent.{ Future => NettyFuture }
import io.netty.util.concurrent.GenericFutureListener

class DnsServerHandler(group: NioEventLoopGroup) extends SimpleChannelInboundHandler[DnsPacket] {
class DnsClientHandler(group: NioEventLoopGroup) extends SimpleChannelInboundHandler[DnsPacket] {
def channelRead0(ctx: ChannelHandlerContext, packet: DnsPacket) {
packet.content match {
case Response(Answers(answers)) =>
Expand All @@ -48,7 +48,7 @@ object DnsClient extends App {
.channel(classOf[NioDatagramChannel])
.handler(new ChannelInitializer[DatagramChannel] {
override def initChannel(ch: DatagramChannel) {
ch.pipeline.addLast(new DnsCodec, new DnsServerHandler(group))
ch.pipeline.addLast(new DnsCodec, new DnsClientHandler(group))
}
})
.bind(0)
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2")

addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0")

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.12")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "1.3.2")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

Expand Down
10 changes: 5 additions & 5 deletions src/main/tut/akka.md → src/main/doc/akka.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ libraryDependencies ++= Seq(

### Imports
Use the following additional imports to get started:
```tut:silent
```scala mdoc:silent
import com.github.mkroli.dns4s.dsl._
import com.github.mkroli.dns4s.akka._
```
```tut:invisible
```scala mdoc:invisible
import scala.language.postfixOps

import akka.actor._
Expand All @@ -34,7 +34,7 @@ import scala.concurrent.duration._

### Server
The following is an excerpt from [examples/simple/../DnsServer.scala](https://github.com/mkroli/dns4s/blob/master/examples/simple/src/main/scala/com/github/mkroli/dns4s/examples/simple/DnsServer.scala):
```tut:silent
```scala mdoc:silent
class DnsHandlerActor extends Actor {
override def receive = {
case Query(q) ~ Questions(QName(host) ~ TypeA() :: Nil) =>
Expand All @@ -51,7 +51,7 @@ object DnsServer extends App {

### Client
The following is an excerpt from [examples/simple-client/../DnsClient.scala](https://github.com/mkroli/dns4s/blob/master/examples/simple-client/src/main/scala/com/github/mkroli/dns4s/examples/simple/client/DnsClient.scala):
```tut:silent
```scala mdoc:silent
implicit val system = ActorSystem("DnsServer")
implicit val timeout = Timeout(5.seconds)
import system.dispatcher
Expand All @@ -63,7 +63,7 @@ IO(Dns) ? Dns.DnsPacket(Query ~ Questions(QName("google.de")), new java.net.Inet
}
}
```
```tut:invisible
```scala mdoc:invisible
system.terminate()
```

Expand Down
File renamed without changes.
Loading

0 comments on commit 7e40567

Please sign in to comment.