Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rack-up file (mostly for playing at this point) and a Passenger confi…
…g to use said rackup file
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<VirtualHost *:80> | ||
ServerName eee.local | ||
DocumentRoot /home/cstrom/repos/eee-code/public | ||
</VirtualHost> |