Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
<p>This tutorial is written for Scala 2.9, but you can also use 2.10. Here is the build.sbt file:*/
name := "sprouch-tutorial"

scalaVersion := "2.9.2"
scalaVersion := "2.10.2"

/* Sprouch is available from its own repository on Github, so you need to add it to your resolvers. */
resolvers += "sprouch repo" at
"http://kimstebel.github.com/sprouch/repository"

resolvers += "spray repo" at "http://repo.spray.io"

/* Now sbt will be able to resolve our dependency on sprouch. */
libraryDependencies += "sprouch" % "sprouch_2.9.2" % "0.5.11"
libraryDependencies += "sprouch" %% "sprouch" % "0.5.11"
/* If you want to use 2.10, just replace 2.9.2 with 2.10. */

2 changes: 1 addition & 1 deletion src/main/scala/Views.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
object ViewsTutorial extends App with Helpers {
import sprouch._, dsl._, JsonProtocol._
import akka.dispatch.{Await, Future}, akka.util.Duration
import scala.concurrent.{Await, Future}, scala.concurrent.duration.Duration
/*First you will need some test data to run your views on. The following creates a sequence of ShopItems
* with prices between 100 and 1000.*/
val items = for (i <- 1 to 10)
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/ViewsMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import sprouch._
import sprouch.dsl._
import sprouch.JsonProtocol._
import akka.actor.ActorSystem
import akka.dispatch.Future
import akka.dispatch.Await
import akka.util.Duration
import scala.concurrent.Future
import scala.concurrent.Await
import scala.concurrent.duration.Duration

trait Helpers {

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/sprouch/tutorial/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object Main extends App {
require a username or password and uses HTTP and not HTTPS.
*/
import akka.actor.ActorSystem
import scala.concurrent.ExecutionContext.Implicits.global
val actorSystem = ActorSystem("myActorSystem")
val config = Config(actorSystem)
/* Here is a different configuration that would work with cloudant.
Expand Down Expand Up @@ -97,8 +98,8 @@ Second version: Document(
Finally you wait for the result to be computed. Again, this is something you probably don't
want to do in a real application. If you want your methods to block, you can use Sprouch's synchronous API.
*/
import akka.util.Duration
import akka.dispatch.Await
import scala.concurrent.duration.Duration
import scala.concurrent.Await
val duration = Duration("10 seconds")
Await.result(future, duration)
actorSystem.shutdown()
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/sprouch/tutorial/Schemaless.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ object Schemaless extends App {
implicit val productFormat = jsonFormat2(PartialDoc)

import akka.actor.ActorSystem
import scala.concurrent.ExecutionContext.Implicits.global
val actorSystem = ActorSystem("myActorSystem")
val config = Config(actorSystem)
val couch = Couch(config)
Expand All @@ -36,8 +37,8 @@ object Schemaless extends App {
println(gotten)

}
import akka.util.Duration
import akka.dispatch.Await
import scala.concurrent.duration.Duration
import scala.concurrent.Await
val duration = Duration("10 seconds")
Await.result(future, duration)
actorSystem.shutdown()
Expand Down