Skip to content

Commit

Permalink
mustache!
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Oct 9, 2009
1 parent f959ecf commit 5252617
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 0 deletions.
File renamed without changes.
17 changes: 17 additions & 0 deletions app.rb
@@ -0,0 +1,17 @@
require 'sinatra/base'
require 'mustache/sinatra'

class App < Sinatra::Base
register Mustache::Sinatra

set :views, 'templates/'
set :mustaches, 'views/'

get '/' do
mustache :index
end

get '/other' do
mustache :other
end
end
5 changes: 5 additions & 0 deletions config.ru
@@ -0,0 +1,5 @@
require 'app'

use Rack::ShowExceptions

run App.new
5 changes: 5 additions & 0 deletions templates/index.mustache
@@ -0,0 +1,5 @@
<h1>{{title}}</h1>

<p>{{content}}</p>

<a href="/other">The Other Page</a>
18 changes: 18 additions & 0 deletions templates/layout.mustache
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>
Trust the Stache
</title>
<link href='http://ajax.googleapis.com/ajax/libs/yui/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css' media='screen' rel='stylesheet'/>
<link href='http://ajax.googleapis.com/ajax/libs/yui/2.7.0/build/base/base-min.css' media='screen' rel='stylesheet'/>
<link href='/styles.css' media='screen' rel='stylesheet'/>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js'></script>
</head>
<body>
<div id="main">
{{{yield}}}
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions templates/other.mustache
@@ -0,0 +1,7 @@
<style>
pre { text-align: left }
</style>

<pre>{{ascii_art}}</pre>

<a href="/">Home</a>
13 changes: 13 additions & 0 deletions views/index.rb
@@ -0,0 +1,13 @@
class App
module Views
class Index < Mustache
def title
"The Index"
end

def content
"Welcome! Mustache lives."
end
end
end
end
50 changes: 50 additions & 0 deletions views/other.rb
@@ -0,0 +1,50 @@
class App
module Views
class Other < Mustache
def ascii_art
<<-end_art
....................
....................
.............:~I7777777777+. .,I7777777777I:.
.............778OOOOOOOOO88= ..IOOOOOOOOOOOO++
.............77OOOOOOOOOOOOO,, ~=8OOOOOOOOOOO8++
.............778OOOOOOOOOOOOII.. .ZZOOOOOOOOOOOOO++
.............77OOOOOOOOOOOOOO8$. .:O8OOOOOOOOOOOOO8++
.77OOOOOOOOOOOOO88O+. ..788OOOOOOOOOOOOO8++.......
.778OOOOOOOOOOOOOO8O, .=OOOOOOOOOOOOOOOO8++.......
.77OOOOOOOOOOOOOOOOO7. .,ZOOOOOOOOOOOOOOOOO++.......
.77OOOOOOOOOOOOOOOOOOZ$.. :OZOOOOOOOOOOOOOOOOOO++.......
.778OOOOOOOOOOOOOOOOOOO?.... .$OOOOOOOOOOOOOOOOOOOO++.......
.77OOOOOOOOOOOOOOOOOOOOO: ...=O8OOOOOOOOOOOOOOOOOO8++.......
.77OOOOOOOO8OOOOOOOOOOOO$...,OOOOOOOOOOO8OOOOOOOOO8++.......
.778OOOOOOO8OO:OOOOOOOOOOO==OOOOOOOOOOZ:OOOOOOOOOO8++.......
.778OOOOOOOOO8.IOOOOOOOO8O8OOOOOOOOOOO=:O8OOOOOOOO8++.......
.778OOOOOOOOO8.:OOOOOOOOOOOOOOOOOOOO$$.:OOOOOOOOOOO++.......
.77OOOOOOOOOO8..??OOOOOOOOOOOOOOOOOO~:.:OOOOOOOOOO8++.......
.77OOOOOOOOOO8....+OOOOOOOOOOOOOOOO:...:OOOOOOOOOO8++.......
.77OOOOOOOOOO8.....OOOOOOOOOOOOOOOI....:O8OOOOOOOOO++.......
.778OOOOOOOOO8.....=OOOOOOOOOOOOOO:. :OOOOOOOOOO8++
.77OOOOOOOOOO8......$88OOOOOOOOO8I :O8OOOOOOOO8++
.778OOOOOOOOO8.......$$OOOOOOOO??. :OOOOOOOOOOO++
.77OOOOOOOOOO8...... ~:OOOOOOOO,, :OOOOOOOOOOO++
.77O8OOOOOOOO8.........7O8OOOO+. :OOOOOOOOOO8++
.~~7777777777+.........,77777I. .... .?7777777777:,
. . ......=$OOOOOOO$=....~?7$$$$77+, .. .
....,7OOOOOOOOO8O=..=OOO88O88OOZ:...
..:ZZOOOOOOOOOOOOZ,,OOOOOOOOOOO8O=+.
...=8OOOOOOOOOOOOOOO++OOOOOOOOOOOOOOOI,..
.,$$8OOOOOOOOOOOOOOOOO$$OOOOOOOOOOOOOOOO8O==
..~O8OOOOOOOOOOOOOOOOO8O$$OOOOOOOOOOOOOOOOOOOO?..
...?OOOOOOOOOOOOOOOOOOOOOO++OOOOOOOOOOOOOOOOOOOOO$,..
...,$$OOOOOOOOOOOOOOOOOOOO887:,OOOOOOOOOOOOOOOOOOOOOOO~=..
:77III7$O8O8OOOOOOOOOOOOOOOOOOOO87,....+8OOOOOOOOOOOOOOOOOOOOOO8OI======+.
.$$8OOOOOOOOOOOOOOOOOOOOOOOO8OO++..... .~ZZOOOOOOOOOOOOOOOOOOOOOOOOOOOO$7.
,,$8OOOOOOOOOOOOOOOOOO8O888O$: ...... ,,I8888OOOOOOOOOOOOOOOOOO88O8$,,
.=$OOOOOOOOO8OOOO8O88OZ7I~......... ..~IOZOO8OOOOOOOOO8O88O8O8O?.
...,,,,,.................... ..,~======~~,.
....................
end_art
end
end
end
end

0 comments on commit 5252617

Please sign in to comment.