Browse Source

Fix sbt and database issues with scruffy

Alex Schneider 10 years ago
parent
commit
d2294680ac

+ 4 - 3
frameworks/Scala/scruffy/setup.py

@@ -1,16 +1,17 @@
-
+import setup_util
 import subprocess
 import sys
 import time
 import os
 
 def start(args, logfile, errfile):
+  setup_util.replace_text('scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala', 'database_host', args.database_host)
   if os.name == 'nt':
     subprocess.check_call('"..\\sbt\\sbt.bat" assembly', shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
   else:
-    subprocess.check_call("../sbt/sbt assembly", shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
+    subprocess.check_call(args.iroot + "/sbt/bin/sbt assembly", shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
     
-  subprocess.Popen("java -jar target/scala-2.11/scruffy-benchmark-assembly-1.0.1.jar -Dhostname" + args.database_host,
+  subprocess.Popen("java -jar target/scala-2.11/scruffy-benchmark-assembly-1.0.1.jar -Dhostname=" + args.database_host,
                     cwd="scruffy",
                     shell=True,
                     stderr=errfile,

+ 1 - 1
frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Main.scala

@@ -8,7 +8,7 @@ object Main extends App {
   val port = 8080
   val scruffy = new Scruffy(ScruffyConfiguration.port(port).compression(false).requestLogging(false))
   scruffy.mount(new Test1Endpoint)
-  scruffy.mount(new Test2Endpoint(Option(System.getProperty("hostname")).getOrElse("localhost")))
+  scruffy.mount(new Test2Endpoint)
   scruffy.mount(new Test6Endpoint)
   println("Starting Scruffy...")
   val lifecycle = scruffy.start()

+ 2 - 2
frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala

@@ -4,8 +4,8 @@ import com.mongodb.casbah.Imports._
 import com.sksamuel.scruffy.EndpointProvider
 
 /** @author Stephen Samuel */
-class Test2Endpoint(hostname: String) extends EndpointProvider {
-
+class Test2Endpoint() extends EndpointProvider {
+  val hostname = "database_host"
   val connection = MongoConnection(hostname, 27017)
   val collection = connection.getDB("hello_world").getCollection("world")