Buz*_*zzy 26 ruby rake rack middleware
我正在寻找的功能类似于rake middlewareRails中的命令,但通用机架应用程序除外.
Pet*_*ich 34
$ rake middleware
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffd148f9468>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
run RackTest::Application.routes
Run Code Online (Sandbox Code Playgroud)
http://pothibo.com/2013/11/ruby-on-rails-inside-actiondispatch-and-rack/
Mic*_*ale 18
这将返回所有机架应用程序(包括中间件)的列表:
require 'rack'
def middleware_classes(app)
r = [app]
while ((next_app = r.last.instance_variable_get(:@app)) != nil)
r << next_app
end
r.map{|e| e.instance_variable_defined?(:@app) ? e.class : e }
end
app = Rack::Builder.parse_file('config.ru').first
p middleware_classes(app)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13398 次 |
| 最近记录: |