Skip to content

Instantly share code, notes, and snippets.

@erlyvideo
Created March 22, 2011 14:07
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erlyvideo/881251 to your computer and use it in GitHub Desktop.
Save erlyvideo/881251 to your computer and use it in GitHub Desktop.
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