Skip to content

Instantly share code, notes, and snippets.

@erlyvideo
Created March 22, 2011 14:07
Embed
What would you like to do?
lib/sc_middleware.rb
# config/environment/development.rb:
# require 'lib/sc_middleware'
# config.middleware.use ScMiddleware
class ScMiddleware
def initialize(app)
@app = app
SC::Rack::Service.filesystem = true
@project = SC::Project.load(File.dirname(__FILE__)+"/../public/self_video", :parent => SC.builtin_project)
@sproutcore = SC::Rack::Service.new([@project])
# @static = ::SC::Rack::FileSystem.new(@project)
end
def call(env)
if env["PATH_INFO"] =~ /^\/self_video/
@sproutcore.call(env)
elsif env["PATH_INFO"] =~ /^\/greenhouse/
@sproutcore.call(env)
elsif env["PATH_INFO"] =~ /^\/static/
@sproutcore.call(env)
else
@app.call(env)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment