./lib/dolt/sinatra/multi_repo_browser.rb in dolt-0.1.0 vs ./lib/dolt/sinatra/multi_repo_browser.rb in dolt-0.1.1
- old
+ new
@@ -23,15 +23,28 @@
aget "/" do
response["Content-Type"] = "text/html"
body("<h1>Welcome to Dolt</h1>")
end
+ aget "/*/tree/*:*" do
+ tree(params[:splat][0], params[:splat][2], params[:splat][1])
+ end
+
+ aget "/*/tree/*" do
+ force_ref(params[:splat], "tree", "master")
+ end
+
aget "/*/blob/*:*" do
- blob(*params[:splat])
+ blob(params[:splat][0], params[:splat][2], params[:splat][1])
end
aget "/*/blob/*" do
- redirect(params[:splat].shift + "/blob/master:" + params[:splat].join)
+ force_ref(params[:splat], "blob", "master")
+ end
+
+ private
+ def force_ref(args, action, ref)
+ redirect(args.shift + "/#{action}/#{ref}:" + args.join)
end
end
end
end