Skip to content

Commit

Permalink
Rack-up file (mostly for playing at this point) and a Passenger confi…
Browse files Browse the repository at this point in the history
…g to use said rackup file
  • Loading branch information
eee-c committed Jun 8, 2009
1 parent 985a723 commit c90c74a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions config.ru
@@ -0,0 +1,46 @@
#require 'pp'
require 'eee.rb'
require 'rubygems'
require 'sinatra'


module Rack
class Interstitial
def initialize app
@app = app
end

def call env
session = env["rack.session"]
session[:count] = session[:count].to_i + 1
if session[:count] % 5 == 0
return [200, { }, session[:count].to_s]
end
code, headers, body = @app.call env
if session[:count] % 3 == 0
ret = []
body.each do |line|
ret << line.gsub(/grits/i, '<span style="color:red">fizz</span>')
end
else
ret = body
end
[code, headers, ret]
end
end
end


#use Rack::Session::Cookie

#use Rack::Interstitial

root_dir = File.dirname(__FILE__)

set :environment, :development
set :root, root_dir
set :app_root, root_dir
set :app_file, File.join(root_dir, 'eee.rb')
disable :run

run Sinatra::Application
4 changes: 4 additions & 0 deletions passenger.conf
@@ -0,0 +1,4 @@
<VirtualHost *:80>
ServerName eee.local
DocumentRoot /home/cstrom/repos/eee-code/public
</VirtualHost>

0 comments on commit c90c74a

Please sign in to comment.