public
Fork of chneukirchen/rack
Description: a modular Ruby webserver interface
Homepage: http://rack.rubyforge.org/
Clone URL: git://github.com/Qerub/rack.git
TextMate Integration for Rack::ShowExceptions
Qerub (author)
Fri Jun 06 19:41:39 -0700 2008
commit  859bba0de77d391134c422d87370cff3924f1cef
tree    ce41c9a9719d04859e0d6ad93f77f99fa63f2d88
parent  d3b3f2c37269205a048cca96ca19ea596f20a6dd
...
35
36
37
 
 
 
 
 
 
38
39
40
...
210
211
212
213
 
 
 
 
 
 
 
214
215
216
...
35
36
37
38
39
40
41
42
43
44
45
46
...
216
217
218
 
219
220
221
222
223
224
225
226
227
228
0
@@ -35,6 +35,12 @@ module Rack
0
           frame.filename = $1
0
           frame.lineno = $2.to_i
0
           frame.function = $4
0
+                
0
+          if ENV["TEXTMATE"]
0
+            u = ERB::Util.method(:u)
0
+            full_filename = ::File.expand_path(frame.filename)
0
+            frame.system_url = "txmt://open?url=file://#{u.call(full_filename)}&line=#{frame.lineno}"
0
+          end
0
 
0
           begin
0
             lineno = frame.lineno-1
0
@@ -210,7 +216,13 @@ TEMPLATE = <<'HTML'
0
   <ul class="traceback">
0
 <% frames.each { |frame| %>
0
       <li class="frame">
0
-        <code><%=h frame.filename %></code>: in <code><%=h frame.function %></code>
0
+        <code>
0
+          <% if frame.system_url %>
0
+            <a href="<%=h frame.system_url %>"><%=h frame.filename %>:<%=h frame.lineno %></a>
0
+          <% else %>
0
+            <%=h frame.filename %>:<%=h frame.lineno %>
0
+          <% end %>
0
+        </code> in <code><%=h frame.function %></code>
0
 
0
           <% if frame.context_line %>
0
           <div class="context" id="c<%=h frame.object_id %>">

Comments