lib/brief/server/gateway.rb in brief-1.4.2 vs lib/brief/server/gateway.rb in brief-1.4.4
- old
+ new
@@ -1,11 +1,11 @@
class Brief::Server::Gateway
- attr_reader :root
+ attr_reader :root, :briefcases
def initialize(options={})
@root = options.fetch(:root)
- @briefcases = {}
+ @briefcases = {}.to_mash
@briefcase_options = options.fetch(:briefcase_options, {})
load_briefcases
end
def briefcase_options
@@ -23,9 +23,14 @@
end
end
def call(env)
request = Rack::Request.new(env)
+
+ if request.path.match(/__info$/)
+ return [200, {}, [@briefcases.keys.to_json]]
+ end
+
name = request.path.match(/\/\w+\/(\w+)/)[1] rescue nil
if name && @briefcases[name]
@briefcases[name].server.call(env)
else