Skip to content

Instantly share code, notes, and snippets.

@rajeshpv
Created February 23, 2012 16:31
Show Gist options
  • Save rajeshpv/1893593 to your computer and use it in GitHub Desktop.
Save rajeshpv/1893593 to your computer and use it in GitHub Desktop.
testing spray twirl
cd ~/projects-github
projects-github $ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) Server VM (build 22.1-b02, mixed mode)
git clone https://github.com/spray/twirl.git
cd twirl
sbt
twirl > publish-local
....
[success] Total time: 29 s, completed Feb 23, 2012 11:24:07 AM
twirl > exit
twirl $ cd example
example $ sbt
....
[info] Set current project to default-c1a1fc (in build file:/home/rpradeshik/projects-github/twirl/example/)
>
> compile
[info] Preparing 3 Twirl template(s) ...
[info] Updating {file:/home/rpradeshik/projects-github/twirl/example/}default-c1a1fc...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving cc.spray#twirl-api_2.9.1;0.5.1 ...
[info] Resolving commons-lang#commons-lang;2.6 ...
[info] Done updating.
[info] Compiling 4 Scala sources to /home/rpradeshik/projects-github/twirl/example/target/scala-2.9.1/classes...
[success] Total time: 4 s, completed Feb 23, 2012 11:25:59 AM
>
> run
[info] Preparing 3 Twirl template(s) ...
[info] Running org.example.Main
A rendered Twirl TXT template:
Welcome Alice!!
You are 16 years old, shouldn't you be in bed ?!
---
A rendered Twirl HTML template:
<html>
<h1>Welcome Bob!!</h1>
<p>You are 22 years old, <i>have a great evening !</i></p>
</html>
---
A rendered Twirl XML template:
<main>
<head>Welcome Darth!!</head>
You are 42 years old, have a great evening !
</main>
[success] Total time: 0 s, completed Feb 23, 2012 11:26:34 AM
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment