Skip to content

Commit

Permalink
making use of submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
philcali committed Mar 18, 2012
1 parent 086afd7 commit b42ec41
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -1,3 +1,6 @@
[submodule "server/bootstrap"]
path = server/bootstrap
url = git://github.com/twitter/bootstrap.git
[submodule "server/src/main/resources/lib"]
path = server/src/main/resources/lib
url = git://github.com/philcali/robot-interface.git
18 changes: 8 additions & 10 deletions server/src/main/resources/index.lmxml
Expand Up @@ -14,15 +14,15 @@ html
left: 0px;
}
```
js @src="/jquery.js"
js @src="/lib/jquery.js"
js @src="/bootstrap-collapse.js"
js @src="/desktop.js"
js @src="/viewport.js"
js @src="/lib/desktop.js"
js @src="/lib/viewport.js"
js @src="/interface.js"
connect-check
connect-check-true
js @src="/control.js"
js @src="/connect.js"
js @src="/lib/control.js"
js @src="/lib/connect.js"
body
>.navbar .navbar-fixed-top
>.navbar-inner
Expand All @@ -37,8 +37,6 @@ html
li a @href="/snapshot.jpg" "Snapshot"
>#buffer .viewport
img #desktop @src="/image/desktop_1.0x1.0_0.2_p.jpg"
connect-check
connect-check-true
canvas #control @width="{width}" @height="{height}" {
style: "z-index: 1; position: absolute; top: 40px; left: 0px;"
}
canvas #control @width="{width}" @height="{height}" {
style: "z-index: 1; position: absolute; top: 40px; left: 0px;"
}
1 change: 1 addition & 0 deletions server/src/main/resources/lib
Submodule lib added at 913b6f
4 changes: 2 additions & 2 deletions server/src/main/scala/Connect.scala
Expand Up @@ -9,13 +9,13 @@ import unfiltered.netty._
object Connect extends DefaultPlan with Lmxml {
import lmxml.transforms.If

val validFiles = List("connect.js", "control.js")
val validFiles = List("lib/connect.js", "lib/control.js")

def data = Seq("connect-check" -> If (true)(Nil))

def intent = {
case req @ Path("/desktop.html") =>
req.respond(index(Resource.retrieve("index.lmxml")))
case req @ Path(Seg(ValidJs(rf) :: Nil)) => req.respond(rf)
case req @ Path(StripSlash(ValidJs(rf))) => req.respond(rf)
}
}
9 changes: 7 additions & 2 deletions server/src/main/scala/Interface.scala
Expand Up @@ -19,7 +19,7 @@ trait Interface extends DefaultPlan with Lmxml {
val pattern = new java.text.SimpleDateFormat("MM-dd-yy KK:mm:ss a")

val validFiles =
List("jquery.js", "desktop.js", "interface.js", "viewport.js")
List("lib/jquery.js", "lib/desktop.js", "interface.js", "lib/viewport.js")

def data = Seq("connect-check" -> Empty)

Expand All @@ -28,7 +28,7 @@ trait Interface extends DefaultPlan with Lmxml {
def defaults: async.Plan.Intent = {
case req @ Path("/view.html") =>
req.respond(index(Resource.retrieve("index.lmxml")))
case req @ Path(Seg(ValidJs(rf) :: Nil)) => req.respond(rf)
case req @ Path(StripSlash(ValidJs(rf))) => req.respond(rf)
case req @ Path(Seg(Bootstrap(rf) :: Nil)) => req.respond(rf)
case req @ Path(Seg("img" :: Bootstrap(rf) :: Nil)) => req.respond(rf)
case req @ Path(Seg("snapshot.jpg" :: Nil)) =>
Expand All @@ -48,6 +48,11 @@ trait DefaultPlan extends async.Plan with ServerErrorResponse {
// Allow plan to determine what js files are valid
val validFiles: List[String]

object StripSlash {
def unapply(path: String) =
if (path.startsWith("/")) Some(path.drop(1).mkString) else None
}

object ValidJs {
def unapply(file: String) = {
if (validFiles.exists(_ == file))
Expand Down

0 comments on commit b42ec41

Please sign in to comment.