merb-core 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. data/LICENSE +1 -1
  2. data/README +3 -3
  3. data/Rakefile +144 -33
  4. data/bin/merb +0 -0
  5. data/bin/merb-specs +0 -0
  6. data/docs/bootloading.dox +1 -0
  7. data/docs/merb-core-call-stack-diagram.mmap +0 -0
  8. data/docs/merb-core-call-stack-diagram.pdf +0 -0
  9. data/docs/merb-core-call-stack-diagram.png +0 -0
  10. data/lib/merb-core.rb +159 -37
  11. data/lib/merb-core/autoload.rb +1 -0
  12. data/lib/merb-core/bootloader.rb +208 -92
  13. data/lib/merb-core/config.rb +20 -6
  14. data/lib/merb-core/controller/abstract_controller.rb +113 -61
  15. data/lib/merb-core/controller/exceptions.rb +28 -13
  16. data/lib/merb-core/controller/merb_controller.rb +73 -44
  17. data/lib/merb-core/controller/mime.rb +25 -7
  18. data/lib/merb-core/controller/mixins/authentication.rb +1 -1
  19. data/lib/merb-core/controller/mixins/controller.rb +44 -8
  20. data/lib/merb-core/controller/mixins/render.rb +191 -128
  21. data/lib/merb-core/controller/mixins/responder.rb +65 -63
  22. data/lib/merb-core/controller/template.rb +103 -54
  23. data/lib/merb-core/core_ext.rb +7 -12
  24. data/lib/merb-core/core_ext/kernel.rb +128 -136
  25. data/lib/merb-core/dispatch/cookies.rb +26 -4
  26. data/lib/merb-core/dispatch/default_exception/default_exception.rb +93 -0
  27. data/lib/merb-core/dispatch/default_exception/views/_css.html.erb +198 -0
  28. data/lib/merb-core/dispatch/default_exception/views/_javascript.html.erb +73 -0
  29. data/lib/merb-core/dispatch/default_exception/views/index.html.erb +92 -0
  30. data/lib/merb-core/dispatch/dispatcher.rb +156 -224
  31. data/lib/merb-core/dispatch/request.rb +126 -25
  32. data/lib/merb-core/dispatch/router.rb +61 -6
  33. data/lib/merb-core/dispatch/router/behavior.rb +122 -41
  34. data/lib/merb-core/dispatch/router/route.rb +147 -22
  35. data/lib/merb-core/dispatch/session.rb +52 -2
  36. data/lib/merb-core/dispatch/session/cookie.rb +4 -2
  37. data/lib/merb-core/dispatch/session/memcached.rb +38 -27
  38. data/lib/merb-core/dispatch/session/memory.rb +18 -11
  39. data/lib/merb-core/dispatch/worker.rb +28 -0
  40. data/lib/merb-core/gem_ext/erubis.rb +58 -0
  41. data/lib/merb-core/logger.rb +3 -31
  42. data/lib/merb-core/plugins.rb +25 -3
  43. data/lib/merb-core/rack.rb +18 -12
  44. data/lib/merb-core/rack/adapter.rb +10 -8
  45. data/lib/merb-core/rack/adapter/ebb.rb +2 -2
  46. data/lib/merb-core/rack/adapter/irb.rb +31 -21
  47. data/lib/merb-core/rack/adapter/swiftiplied_mongrel.rb +26 -0
  48. data/lib/merb-core/rack/adapter/thin.rb +19 -9
  49. data/lib/merb-core/rack/adapter/thin_turbo.rb +24 -0
  50. data/lib/merb-core/rack/application.rb +9 -84
  51. data/lib/merb-core/rack/middleware.rb +26 -0
  52. data/lib/merb-core/rack/middleware/path_prefix.rb +31 -0
  53. data/lib/merb-core/rack/middleware/profiler.rb +19 -0
  54. data/lib/merb-core/rack/middleware/static.rb +45 -0
  55. data/lib/merb-core/server.rb +27 -9
  56. data/lib/merb-core/tasks/audit.rake +68 -0
  57. data/lib/merb-core/tasks/merb.rb +1 -0
  58. data/lib/merb-core/tasks/merb_rake_helper.rb +12 -0
  59. data/lib/merb-core/tasks/stats.rake +71 -0
  60. data/lib/merb-core/test.rb +2 -1
  61. data/lib/merb-core/test/helpers/multipart_request_helper.rb +3 -3
  62. data/lib/merb-core/test/helpers/request_helper.rb +66 -24
  63. data/lib/merb-core/test/matchers/controller_matchers.rb +36 -4
  64. data/lib/merb-core/test/matchers/route_matchers.rb +12 -3
  65. data/lib/merb-core/test/matchers/view_matchers.rb +3 -3
  66. data/lib/merb-core/test/run_specs.rb +1 -0
  67. data/lib/merb-core/test/tasks/spectasks.rb +13 -5
  68. data/lib/merb-core/test/test_ext/string.rb +14 -0
  69. data/lib/merb-core/vendor/facets/dictionary.rb +3 -3
  70. data/lib/merb-core/vendor/facets/inflect.rb +82 -37
  71. data/lib/merb-core/version.rb +2 -2
  72. data/spec/private/config/config_spec.rb +39 -4
  73. data/spec/private/core_ext/kernel_spec.rb +3 -14
  74. data/spec/private/dispatch/bootloader_spec.rb +1 -1
  75. data/spec/private/dispatch/cookies_spec.rb +181 -69
  76. data/spec/private/dispatch/fixture/app/controllers/exceptions.rb +0 -2
  77. data/spec/private/dispatch/fixture/app/controllers/foo.rb +0 -2
  78. data/spec/private/dispatch/fixture/config/rack.rb +10 -0
  79. data/spec/private/dispatch/fixture/log/merb_test.log +7054 -1802
  80. data/spec/private/dispatch/route_params_spec.rb +2 -3
  81. data/spec/private/dispatch/session_mixin_spec.rb +47 -0
  82. data/spec/private/plugins/plugin_spec.rb +73 -59
  83. data/spec/private/router/behavior_spec.rb +60 -0
  84. data/spec/private/router/fixture/log/merb_test.log +1693 -0
  85. data/spec/private/router/route_spec.rb +414 -0
  86. data/spec/private/router/router_spec.rb +175 -0
  87. data/spec/private/vendor/facets/plural_spec.rb +564 -0
  88. data/spec/private/vendor/facets/singular_spec.rb +489 -0
  89. data/spec/public/abstract_controller/controllers/cousins.rb +41 -0
  90. data/spec/public/abstract_controller/controllers/helpers.rb +12 -2
  91. data/spec/public/abstract_controller/controllers/partial.rb +17 -2
  92. data/spec/public/abstract_controller/controllers/render.rb +16 -1
  93. data/spec/public/abstract_controller/controllers/views/helpers/capture_eq/index.erb +1 -0
  94. data/spec/public/abstract_controller/controllers/views/helpers/capture_with_args/index.erb +1 -0
  95. data/spec/public/abstract_controller/controllers/views/merb/test/fixtures/abstract/render_two_throw_contents/index.erb +1 -0
  96. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/_collection.erb +1 -0
  97. data/spec/public/abstract_controller/controllers/views/partial/partial_with_collections_and_counter/index.erb +1 -0
  98. data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/_partial.erb +1 -0
  99. data/spec/public/abstract_controller/controllers/views/partial/with_absolute_partial/index.erb +1 -0
  100. data/spec/public/abstract_controller/filter_spec.rb +20 -1
  101. data/spec/public/abstract_controller/helper_spec.rb +10 -2
  102. data/spec/public/abstract_controller/partial_spec.rb +8 -0
  103. data/spec/public/abstract_controller/render_spec.rb +8 -0
  104. data/spec/public/abstract_controller/spec_helper.rb +7 -3
  105. data/spec/public/boot_loader/boot_loader_spec.rb +2 -2
  106. data/spec/public/controller/base_spec.rb +10 -2
  107. data/spec/public/controller/config/init.rb +6 -0
  108. data/spec/public/controller/controllers/authentication.rb +9 -11
  109. data/spec/public/controller/controllers/base.rb +2 -8
  110. data/spec/public/controller/controllers/cookies.rb +16 -0
  111. data/spec/public/controller/controllers/dispatcher.rb +35 -0
  112. data/spec/public/controller/controllers/display.rb +62 -14
  113. data/spec/public/controller/controllers/redirect.rb +36 -0
  114. data/spec/public/controller/controllers/responder.rb +37 -11
  115. data/spec/public/controller/controllers/views/layout/custom_arg.json.erb +1 -0
  116. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.html.erb +1 -0
  117. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/class_and_local_provides/index.xml.erb +1 -0
  118. data/spec/public/controller/controllers/views/merb/test/fixtures/controllers/display_with_template/no_layout.html.erb +1 -0
  119. data/spec/public/controller/cookies_spec.rb +23 -0
  120. data/spec/public/controller/dispatcher_spec.rb +411 -0
  121. data/spec/public/controller/display_spec.rb +43 -10
  122. data/spec/public/controller/redirect_spec.rb +33 -0
  123. data/spec/public/controller/responder_spec.rb +79 -11
  124. data/spec/public/controller/spec_helper.rb +3 -1
  125. data/spec/public/controller/url_spec.rb +10 -0
  126. data/spec/public/core/merb_core_spec.rb +11 -0
  127. data/spec/public/core_ext/fixtures/core_ext_dependency.rb +2 -0
  128. data/spec/public/core_ext/kernel_spec.rb +9 -0
  129. data/spec/public/core_ext/spec_helper.rb +1 -0
  130. data/spec/public/directory_structure/directory/log/merb_test.log +3729 -272
  131. data/spec/public/directory_structure/directory_spec.rb +3 -4
  132. data/spec/public/logger/logger_spec.rb +4 -4
  133. data/spec/public/reloading/directory/log/merb_test.log +288066 -15
  134. data/spec/public/reloading/reload_spec.rb +49 -27
  135. data/spec/public/request/multipart_spec.rb +26 -0
  136. data/spec/public/request/request_spec.rb +21 -2
  137. data/spec/public/router/fixation_spec.rb +27 -0
  138. data/spec/public/router/fixture/log/merb_test.log +30050 -0
  139. data/spec/public/router/nested_matches_spec.rb +97 -0
  140. data/spec/public/router/resource_spec.rb +1 -9
  141. data/spec/public/router/resources_spec.rb +0 -20
  142. data/spec/public/router/spec_helper.rb +27 -9
  143. data/spec/public/router/special_spec.rb +21 -8
  144. data/spec/public/template/template_spec.rb +17 -5
  145. data/spec/public/test/controller_matchers_spec.rb +10 -0
  146. data/spec/public/test/request_helper_spec.rb +29 -0
  147. data/spec/public/test/route_helper_spec.rb +18 -1
  148. data/spec/public/test/route_matchers_spec.rb +28 -1
  149. data/spec/public/test/view_matchers_spec.rb +3 -3
  150. data/spec/spec_helper.rb +56 -12
  151. metadata +89 -47
  152. data/lib/merb-core/core_ext/class.rb +0 -299
  153. data/lib/merb-core/core_ext/hash.rb +0 -426
  154. data/lib/merb-core/core_ext/mash.rb +0 -154
  155. data/lib/merb-core/core_ext/object.rb +0 -147
  156. data/lib/merb-core/core_ext/object_space.rb +0 -14
  157. data/lib/merb-core/core_ext/rubygems.rb +0 -28
  158. data/lib/merb-core/core_ext/set.rb +0 -46
  159. data/lib/merb-core/core_ext/string.rb +0 -89
  160. data/lib/merb-core/core_ext/time.rb +0 -13
  161. data/lib/merb-core/dispatch/exceptions.html.erb +0 -297
  162. data/spec/private/core_ext/class_spec.rb +0 -22
  163. data/spec/private/core_ext/hash_spec.rb +0 -522
  164. data/spec/private/core_ext/object_spec.rb +0 -121
  165. data/spec/private/core_ext/set_spec.rb +0 -26
  166. data/spec/private/core_ext/string_spec.rb +0 -167
  167. data/spec/private/core_ext/time_spec.rb +0 -16
  168. data/spec/private/dispatch/dispatch_spec.rb +0 -26
  169. data/spec/private/dispatch/fixture/log/development.log +0 -1
  170. data/spec/private/dispatch/fixture/log/merb.4000.pid +0 -1
  171. data/spec/private/dispatch/fixture/log/production.log +0 -1
  172. data/spec/private/dispatch/fixture/merb.4000.pid +0 -1
  173. data/spec/private/rack/application_spec.rb +0 -43
  174. data/spec/public/controller/log/merb.4000.pid +0 -1
  175. data/spec/public/directory_structure/directory/log/merb.4000.pid +0 -1
  176. data/spec/public/directory_structure/directory/merb.4000.pid +0 -1
  177. data/spec/public/reloading/directory/log/merb.4000.pid +0 -1
  178. data/spec/public/reloading/directory/merb.4000.pid +0 -1
@@ -0,0 +1,93 @@
1
+ module Merb
2
+ class Dispatcher
3
+ module DefaultExceptionHelper
4
+ def humanize_exception(e)
5
+ e.class.name.split("::").last.gsub(/([a-z])([A-Z])/, '\1 \2')
6
+ end
7
+
8
+ def error_codes(exception)
9
+ if @show_details
10
+ message, message_details = exception.message.split("\n", 2)
11
+ "<h2>#{html_escape(message)}</h2><p>#{html_escape(message_details)}</p>"
12
+ else
13
+ "<h2>Sorry about that...</h2>"
14
+ end
15
+ end
16
+
17
+ def frame_details(line)
18
+ filename, lineno, location = line.split(":")
19
+ if filename.index(Merb.framework_root)
20
+ type = "framework"
21
+ shortname = Pathname.new(filename).relative_path_from(Merb.framework_root)
22
+ elsif filename.index(Merb.root)
23
+ type = "app"
24
+ shortname = Pathname.new(filename).relative_path_from(Merb.root)
25
+ elsif path = Gem.path.find {|p| filename.index(p)}
26
+ type = "gem"
27
+ shortname = Pathname.new(filename).relative_path_from(Pathname.new(path))
28
+ else
29
+ type = "other"
30
+ shortname = filename
31
+ end
32
+ [type, shortname, filename, lineno, location]
33
+ end
34
+
35
+ def listing(key, value, arr)
36
+ ret = []
37
+ ret << "<table class=\"listing\" style=\"display: none\">"
38
+ ret << " <thead>"
39
+ ret << " <tr><th width='25%'>#{key}</th><th width='75%'>#{value}</th></tr>"
40
+ ret << " </thead>"
41
+ ret << " <tbody>"
42
+ (arr || []).each_with_index do |(key, val), i|
43
+ klass = i % 2 == 0 ? "even" : "odd"
44
+ ret << " <tr class=#{klass}><td>#{key}</td><td>#{val.inspect}</td></tr>"
45
+ end
46
+ if arr.blank?
47
+ ret << " <tr class='odd'><td colspan='2'>None</td></tr>"
48
+ end
49
+ ret << " </tbody>"
50
+ ret << "</table>"
51
+ ret.join("\n")
52
+ end
53
+
54
+ def textmate_url(filename, line)
55
+ "<a href='txmt://open?url=file://#{filename}&amp;line=#{line}'>#{line}</a>"
56
+ end
57
+
58
+ def render_source(filename, line)
59
+ line = line.to_i
60
+ ret = []
61
+ ret << "<tr class='source'>"
62
+ ret << " <td class='collapse'></td>"
63
+ str = " <td class='code' colspan='2'><div>"
64
+
65
+ __caller_lines__(filename, line, 5) do |lline, lcode|
66
+ str << "<a href='txmt://open?url=file://#{filename}&amp;line=#{lline}'>#{lline}</a>"
67
+ str << "<em>" if line == lline
68
+ str << Erubis::XmlHelper.escape_xml(lcode)
69
+ str << "</em>" if line == lline
70
+ str << "\n"
71
+ end
72
+ str << "</div></td>"
73
+ ret << str
74
+ ret << "</tr>"
75
+ ret.join("\n")
76
+ end
77
+ end
78
+
79
+ class DefaultException < Merb::Controller
80
+ self._template_root = File.dirname(__FILE__) / "views"
81
+
82
+ def _template_location(context, type = nil, controller = controller_name)
83
+ "#{context}.#{type}"
84
+ end
85
+
86
+ def index
87
+ @exceptions = request.exceptions
88
+ @show_details = Merb::Config[:exception_details]
89
+ render :format => :html
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,198 @@
1
+ <style type="text/css" media="screen">
2
+ body {
3
+ font-family:arial;
4
+ font-size:11px;
5
+ }
6
+ p.options {
7
+ text-align: right;
8
+ }
9
+ p.options label {
10
+ margin-left: 10px;
11
+ }
12
+ p.options span.all {
13
+ padding: 5px;
14
+ border: 1px solid #000;
15
+ background-color: #fff;
16
+ }
17
+ p.options input {
18
+ position: relative;
19
+ }
20
+ h1 {
21
+ font-size:48px;
22
+ letter-spacing:-4px;
23
+ margin:0 0 20px 0;
24
+ line-height:36px;
25
+ color:#333;
26
+ }
27
+ h1 sup {
28
+ font-size: 0.5em;
29
+ }
30
+ h1 sup.error_500, h1 sup.error_400 {
31
+ color:#990E05;
32
+ }
33
+ h1 sup.error_100, h1 sup.error_200 {
34
+ color:#00BF10;
35
+ }
36
+ h1 sup.error_300 {
37
+ /* pretty sure you cant 'see' status 300
38
+ errors but if you could I think they
39
+ would be blue */
40
+ color:#1B2099;
41
+ }
42
+ h2 {
43
+ font-size:24px;
44
+ letter-spacing:-1px;
45
+ margin:0;
46
+ line-height:28px;
47
+ color:#444;
48
+ }
49
+ h3 {
50
+ cursor: pointer;
51
+ color: #006;
52
+ text-decoration: underline;
53
+ }
54
+ a, a:visited {
55
+ color:#00BF10;
56
+ }
57
+ .internalError {
58
+ width:800px;
59
+ margin:50px auto;
60
+ }
61
+ .header {
62
+ border-bottom:10px solid #333;
63
+ margin-bottom:1px;
64
+ background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7");
65
+ padding:20px;
66
+ }
67
+ .header ul {
68
+ padding: 5px;
69
+ background-color: white;
70
+ }
71
+ .header ul li {
72
+ list-style-type: none;
73
+ font-size: 16px;
74
+ margin-bottom: 6px;
75
+ }
76
+
77
+ table.listing {
78
+ border-collapse: collapse;
79
+ font-size: 12px;
80
+ width: 100%;
81
+ }
82
+
83
+ table.listing th {
84
+ background-color: #000;
85
+ color: #fff;
86
+ }
87
+
88
+ table.listing td, table.listing th {
89
+ padding: 5px;
90
+ text-align: left;
91
+ vertical-align: top;
92
+ }
93
+
94
+ table.listing tr.odd {
95
+ background-color: #ccc;
96
+ }
97
+
98
+ table.listing tr.even {
99
+ background-color: #aaa;
100
+ }
101
+
102
+ table.listing td[colspan=2] {
103
+ text-align: center;
104
+ }
105
+
106
+ table.trace {
107
+ width:100%;
108
+ font-family:courier, monospace;
109
+ letter-spacing:-1px;
110
+ border-collapse: collapse;
111
+ border-spacing:0;
112
+ }
113
+ table.trace tr td{
114
+ padding:0;
115
+ height:26px;
116
+ font-size:13px;
117
+ vertical-align:middle;
118
+ }
119
+ table.trace tr.file{
120
+ border-top:2px solid #fff;
121
+ background-color:#F3F3F3;
122
+ }
123
+ table.trace tr.source {
124
+ background-color:#F8F8F8;
125
+ display:none;
126
+ }
127
+ table.trace .open tr.source {
128
+ display:table-row;
129
+ }
130
+ table.trace tr.file td.expand {
131
+ width:23px;
132
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=);
133
+ background-position:top left;
134
+ background-repeat:no-repeat;
135
+ }
136
+ table.trace tr.file td.expand div {
137
+ width:23px;
138
+ }
139
+ table.trace .open tr.file td.expand {
140
+ width:23px;
141
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC);
142
+ background-position:top left;
143
+ background-repeat:no-repeat;
144
+ }
145
+ table.trace .open tr.file td.expand div {
146
+ width:23px;
147
+ }
148
+ table.trace tr.source td.collapse {
149
+ width:23px;
150
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==);
151
+ background-position:bottom left;
152
+ background-repeat:no-repeat;
153
+ background-color:#6F706F;
154
+ }
155
+ table.trace tr td.path {
156
+ padding-left:10px;
157
+ }
158
+ table.trace tbody.app td.path {
159
+ color: #900;
160
+ }
161
+ table.trace tbody.framework td.path {
162
+ color: #009;
163
+ }
164
+ table.trace tbody.gem td.path {
165
+ color: #090;
166
+ }
167
+ table.trace tr td.code {
168
+ padding: 10px 0 10px 20px;
169
+ white-space: pre;
170
+ }
171
+ table.trace tr td.code div {
172
+ width: 700px;
173
+ overflow-x: auto;
174
+ overflow-y: hidden;
175
+ }
176
+ table.trace tr td.code em {
177
+ font-weight:bold;
178
+ color:#00BF10;
179
+ }
180
+ table.trace tr td.code a {
181
+ width: 20px;
182
+ float: left;
183
+ }
184
+ table.trace tr td.code .more {
185
+ color:#666;
186
+ }
187
+ table.trace tr td.line {
188
+ width:30px;
189
+ text-align:right;
190
+ padding-right:4px;
191
+ }
192
+ .footer {
193
+ margin-top:5px;
194
+ font-size:11px;
195
+ color:#444;
196
+ text-align:right;
197
+ }
198
+ </style>
@@ -0,0 +1,73 @@
1
+ <script type="text/javascript" charset="utf-8">
2
+ (function() {
3
+ els = document.getElementsByTagName('td');
4
+ var forEach = function(arr, fn) {
5
+ for(var i=0; i<arr.length; i++) {
6
+ var res = fn(arr[i]);
7
+ if(res === false) break;
8
+ }
9
+ }
10
+ var toggleClasses = function(node, first, second) {
11
+ var classes = node.className.split(" ");
12
+ var newClasses = [];
13
+ forEach(classes, function(k) {
14
+ if(k == first) newClasses.push(second);
15
+ else if(k == second) newClasses.push(first);
16
+ else newClasses.push(k);
17
+ });
18
+ node.className = newClasses.join(" ");
19
+ }
20
+ forEach(els, function(el) {
21
+ // swap the open & closed classes
22
+ if(hasClass(el, "expand") || hasClass(el, "collapse")) {
23
+ el.onclick = function(e){
24
+ tbody = this.parentNode.parentNode;
25
+ toggleClasses(tbody, "open", "close");
26
+ }
27
+ }
28
+ })
29
+ forEach(document.getElementsByTagName("h3"), function(el) {
30
+ el.onclick = function(e) {
31
+ var tag = this.nextSibling;
32
+ while(tag.nodeType != 1) tag = tag.nextSibling;
33
+ tag.style.display = tag.style.display == "none" ? "" : "none";
34
+ }
35
+ })
36
+ function hasClass(node, matchClass) {
37
+ var classes = node.className.split(" ");
38
+ for(var i=0,className;className=classes[i];i++)
39
+ if(className == matchClass) return true;
40
+ return false;
41
+ }
42
+ var els = document.getElementsByTagName("p");
43
+ forEach(els, function(tag) {
44
+ if(tag.className != "options") return true;
45
+ var checkboxes = tag.getElementsByTagName("input");
46
+ forEach(checkboxes, function(box) {
47
+ if(window.navigator.userAgent.match(/Firefox/)) {
48
+ box.style.top = "3px";
49
+ }
50
+ });
51
+ tag.getElementsByTagName("input")[0].onclick = function(e) {
52
+ forEach(checkboxes, function(box) {
53
+ if(box == e.target) return true;
54
+ box.checked = e.target.checked;
55
+ toggleTraces(box, box);
56
+ })
57
+ };
58
+ var toggleTraces = function(box, target) {
59
+ var tbodies = tag.parentNode.getElementsByTagName("tbody");
60
+ forEach(tbodies, function(tbody) {
61
+ if(hasClass(tbody, target.parentNode.className)) {
62
+ if(target.checked) tbody.style.display = "";
63
+ else tbody.style.display = "none";
64
+ }
65
+ })
66
+ }
67
+ forEach(checkboxes, function(box) {
68
+ if(box == checkboxes[0]) return true;
69
+ box.onchange = function(e) { toggleTraces(box, e.target) }
70
+ })
71
+ })
72
+ })();
73
+ </script>
@@ -0,0 +1,92 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title><%= humanize_exception(@exceptions.first) %></title>
5
+ <%= partial :css %>
6
+ </head>
7
+ <body>
8
+ <% if @show_details %>
9
+ <% if @exceptions.size > 1 %>
10
+ <div class="internalError">
11
+ <div class="header">
12
+ <h1>Error Stack</h1>
13
+ <ul>
14
+ <% @exceptions.each_with_index do |exception,i| %>
15
+ <li>
16
+ <a href="#exception_<%= i %>"><%= humanize_exception(exception) %></a>
17
+ <%= html_escape(exception.message.split("\n",2).first) %>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+ </div>
23
+ <% end %>
24
+
25
+ <div class="internalError">
26
+ <div class="header">
27
+ <h1>Request Details</h1>
28
+ <h3>Parameters</h3>
29
+ <%= listing("Parameter", "Value", request.params) %>
30
+
31
+ <h3>Session</h3>
32
+ <%= listing("Key", "Value", request.session) %>
33
+
34
+ <h3>Cookies</h3>
35
+ <%= listing("Cookie", "Value", request.cookies) %>
36
+
37
+ <h3>Named Routes</h3>
38
+ <%= listing("Name", "Route", Merb::Router.named_routes) %>
39
+ </div>
40
+ </div>
41
+ <% end %>
42
+
43
+ <% @exceptions.each_with_index do |exception,i| %>
44
+ <div class="internalError" id="exception_<%= i %>">
45
+ <div class="header">
46
+ <h1>
47
+ <%= humanize_exception(exception) %>
48
+ <sup class="error_<%= exception.class.status %>"><%= exception.class.status %></sup>
49
+ </h1>
50
+ <%= error_codes(exception) %>
51
+ <p class="options">
52
+ <label class="all">All<input type="checkbox" autocomplete="off"></label>
53
+ <span class="all">
54
+ <label class="app">App<input type="checkbox" checked="checked" autocomplete="off"/></label>
55
+ <label class="framework">Framework<input type="checkbox" autocomplete="off"/></label>
56
+ <label class="gem">Gem<input type="checkbox" autocomplete="off"/></label>
57
+ <label class="other">Other<input type="checkbox" autocomplete="off"/></label>
58
+ </span>
59
+ </p>
60
+
61
+ <% if @show_details %>
62
+ <table class="trace">
63
+ <% exception.backtrace.each_with_index do |line, index| %>
64
+ <% type, shortname, filename, lineno, location = frame_details(line) %>
65
+ <tbody class="close <%= type %>" <%= "style='display:none'" unless type == "app" %>>
66
+ <tr class="file">
67
+ <td class="expand"><div>&nbsp;</div></td>
68
+ <td class="path">
69
+ <%= shortname %>
70
+ <% if filename && filename.match(/\.erb$/) %>
71
+ (<strong>ERB Template</strong>)
72
+ <% else %>
73
+ in <strong><%= location ? location.match(/in (`.+')$/)[1] : 'main' %></strong>
74
+ <% end %>
75
+ </td>
76
+ <td class="line">
77
+ <%= textmate_url(filename, lineno) %>
78
+ </td>
79
+ </tr>
80
+ <%= render_source(filename, lineno) %>
81
+ </tbody>
82
+ <% end %>
83
+ </table>
84
+ <% end %>
85
+ <div class="footer">
86
+ lots of love, from <a href="http://www.merbivore.com">merb</a>
87
+ </div>
88
+ </div>
89
+ <% end %>
90
+ <%= partial :javascript %>
91
+ </body>
92
+ </html>