Permalink
Browse files

Merge pull request #1 from franklinhu/templatefiles

Fix template file resolving for packaged jarfiles
  • Loading branch information...
2 parents 5369e2d + 1932e8a commit 40ca3020536a63bd20dac6fcbf3c4098e00831d2 @capotej capotej committed Jul 2, 2012
Showing with 4 additions and 3 deletions.
  1. +1 −1 pom.xml
  2. +3 −2 src/main/scala/com/posterous/finatra/TemplateHandler.scala
View
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.posterous</groupId>
<artifactId>finatra</artifactId>
- <version>4.2.0</version>
+ <version>4.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Sinatra clone on top of finagle-http</description>
<inceptionYear>2012</inceptionYear>
@@ -1,6 +1,7 @@
package com.posterous.finatra
import com.github.mustachejava._
+import com.twitter.io.TempFile
import com.twitter.mustache._
import java.io.IOException
@@ -29,8 +30,8 @@ class FinatraMustacheFactory extends DefaultMustacheFactory {
class TemplateHandler {
def captureTemplate(template: String, layout: String, exports: Any): String = {
- val tpath = new File("templates/" + template)
- val lpath = new File("templates/layouts/" + layout)
+ val tpath = TempFile.fromResourcePath("/templates/" + template)
+ val lpath = TempFile.fromResourcePath("/templates/layouts/" + layout)
//what remembers the templates
val mf = new FinatraMustacheFactory

0 comments on commit 40ca302

Please sign in to comment.