public this repo is viewable by everyone
Description: The invisible framework
Homepage: http://macournoyer.com/
Clone URL: git://github.com/macournoyer/invisible.git
Initial commit
macournoyer (author)
3 months ago
commit  b038e8526a54cd0cbc66aa8968429c76479a17b2
tree    873948aa414b7667226ff605530bb099e9c5efa7
...
 
0
...
1
2
0
@@ -0,0 +1 @@
0
+The fastest framework that you should never use.
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
0
@@ -0,0 +1,8 @@
0
+module Invisible
0
+ class HomeController < Controller
0
+ def index
0
+ @title = 'Hi there!'
0
+ @msg = 'You like my framework?'
0
+ end
0
+ end
0
+end
0
\ No newline at end of file
...
 
 
0
...
1
2
3
0
@@ -0,0 +1,2 @@
0
+<h1>${@title}</h1>
0
+<p>${@msg}</p>
0
\ No newline at end of file
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -0,0 +1,37 @@
0
+# Start w/ thin start -r invisible.rb
0
+require 'tenjin'
0
+
0
+module ::Invisible
0
+ class Adapter
0
+ def initialize
0
+ @template = Tenjin::Engine.new(:postfix=>'.rbhtml', :layout=>'../layout.rbhtml', :path=>'home')
0
+ @file = Rack::File.new('public')
0
+ end
0
+ def call(env)
0
+ path = env['PATH_INFO']
0
+ if path.include?('.')
0
+ @file.call(env)
0
+ else
0
+ _, controller, action = env['PATH_INFO'].split('/')
0
+ Invisible.const_get("#{(controller || 'home').capitalize}Controller").new(@template, env).call(action || 'index')
0
+ end
0
+ end
0
+ end
0
+ class Controller
0
+ def initialize(template, env)
0
+ @template, @status, @env, @headers = template, 200, env, {'Content-Type' => 'text/html'}
0
+ end
0
+ def call(action)
0
+ send(action)
0
+ render(action) unless @body
0
+ [@status, @headers.merge('Content-Length'=>@body.size.to_s), [@body]]
0
+ end
0
+ protected
0
+ def render(action=nil)
0
+ @body = @template.render(action.to_sym, instance_variables.inject({}) {|h,v| h[v[1..-1]] = instance_variable_get(v); h})
0
+ end
0
+ end
0
+end
0
+
0
+require 'app/controllers'
0
+run Invisible::Adapter.new
0
\ No newline at end of file
...
 
 
 
 
 
0
...
1
2
3
4
5
6
0
@@ -0,0 +1,5 @@
0
+<html>
0
+<body>
0
+#{@_content}
0
+</body>
0
+</html>
0
\ No newline at end of file

Comments

    No one has commented yet.