merb-core 1.0.6 → 1.0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,118 +1,120 @@
1
- module Merb
2
- class Dispatcher
3
- # :api: private
4
- module DefaultExceptionHelper
5
-
6
- # :api: private
7
- def humanize_exception(e)
8
- e.class.name.split("::").last.gsub(/([a-z])([A-Z])/, '\1 \2')
9
- end
10
-
1
+ Merb::BootLoader.after_app_loads do
2
+ module Merb
3
+ class Dispatcher
11
4
  # :api: private
12
- def error_codes(exception)
13
- if @show_details
14
- message, message_details = exception.message.split("\n", 2)
15
- "<h2>#{escape_html(message)}</h2><p>#{escape_html(message_details)}</p>"
16
- else
17
- "<h2>Sorry about that...</h2>"
5
+ module DefaultExceptionHelper
6
+
7
+ # :api: private
8
+ def humanize_exception(e)
9
+ e.class.name.split("::").last.gsub(/([a-z])([A-Z])/, '\1 \2')
18
10
  end
19
- end
20
11
 
21
- # :api: private
22
- def frame_details(line)
23
- if (match = line.match(/^(.+):(\d+):(.+)$/))
24
- filename = match[1]
25
- lineno = match[2]
26
- location = match[3]
27
- if filename.index(Merb.framework_root) == 0
28
- type = "framework"
29
- shortname = Pathname.new(filename).relative_path_from(Pathname.new(Merb.framework_root))
30
- elsif filename.index(Merb.root) == 0
31
- type = "app"
32
- shortname = Pathname.new(filename).relative_path_from(Pathname.new(Merb.root))
33
- elsif path = Gem.path.find {|p| filename.index(p) == 0}
34
- type = "gem"
35
- shortname = Pathname.new(filename).relative_path_from(Pathname.new(path))
12
+ # :api: private
13
+ def error_codes(exception)
14
+ if @show_details
15
+ message, message_details = exception.message.split("\n", 2)
16
+ "<h2>#{escape_html(message)}</h2><p>#{escape_html(message_details)}</p>"
36
17
  else
37
- type = "other"
38
- shortname = filename
18
+ "<h2>Sorry about that...</h2>"
39
19
  end
40
- [type, shortname, filename, lineno, location]
41
- else
42
- ['', '', '', nil, nil]
43
20
  end
44
- end
45
21
 
46
- # :api: private
47
- def listing(key, value, arr)
48
- ret = []
49
- ret << "<table class=\"listing\" style=\"display: none\">"
50
- ret << " <thead>"
51
- ret << " <tr><th width='25%'>#{key}</th><th width='75%'>#{value}</th></tr>"
52
- ret << " </thead>"
53
- ret << " <tbody>"
54
- (arr || []).each_with_index do |(key, val), i|
55
- klass = i % 2 == 0 ? "even" : "odd"
56
- ret << " <tr class=\"#{klass}\"><td>#{key}</td><td>#{val.inspect}</td></tr>"
22
+ # :api: private
23
+ def frame_details(line)
24
+ if (match = line.match(/^(.+):(\d+):(.+)$/))
25
+ filename = match[1]
26
+ lineno = match[2]
27
+ location = match[3]
28
+ if filename.index(Merb.framework_root) == 0
29
+ type = "framework"
30
+ shortname = Pathname.new(filename).relative_path_from(Pathname.new(Merb.framework_root))
31
+ elsif filename.index(Merb.root) == 0
32
+ type = "app"
33
+ shortname = Pathname.new(filename).relative_path_from(Pathname.new(Merb.root))
34
+ elsif path = Gem.path.find {|p| filename.index(p) == 0}
35
+ type = "gem"
36
+ shortname = Pathname.new(filename).relative_path_from(Pathname.new(path))
37
+ else
38
+ type = "other"
39
+ shortname = filename
40
+ end
41
+ [type, shortname, filename, lineno, location]
42
+ else
43
+ ['', '', '', nil, nil]
44
+ end
57
45
  end
58
- if arr.blank?
59
- ret << " <tr class='odd'><td colspan='2'>None</td></tr>"
46
+
47
+ # :api: private
48
+ def listing(key, value, arr)
49
+ ret = []
50
+ ret << "<table class=\"listing\" style=\"display: none\">"
51
+ ret << " <thead>"
52
+ ret << " <tr><th width='25%'>#{key}</th><th width='75%'>#{value}</th></tr>"
53
+ ret << " </thead>"
54
+ ret << " <tbody>"
55
+ (arr || []).each_with_index do |(key, val), i|
56
+ klass = i % 2 == 0 ? "even" : "odd"
57
+ ret << " <tr class=\"#{klass}\"><td>#{key}</td><td>#{val.inspect}</td></tr>"
58
+ end
59
+ if arr.blank?
60
+ ret << " <tr class='odd'><td colspan='2'>None</td></tr>"
61
+ end
62
+ ret << " </tbody>"
63
+ ret << "</table>"
64
+ ret.join("\n")
60
65
  end
61
- ret << " </tbody>"
62
- ret << "</table>"
63
- ret.join("\n")
64
- end
65
66
 
66
- def jar?(filename)
67
- filename.match(/jar\!/)
68
- end
67
+ def jar?(filename)
68
+ filename.match(/jar\!/)
69
+ end
69
70
 
70
- # :api: private
71
- def textmate_url(filename, line)
72
- "<a href='txmt://open?url=file://#{filename}&amp;line=#{line}'>#{line}</a>"
73
- end
71
+ # :api: private
72
+ def textmate_url(filename, line)
73
+ "<a href='txmt://open?url=file://#{filename}&amp;line=#{line}'>#{line}</a>"
74
+ end
74
75
 
75
- # :api: private
76
- def render_source(filename, line)
77
- line = line.to_i
78
- ret = []
79
- ret << "<tr class='source'>"
80
- ret << " <td class='collapse'></td>"
81
- str = " <td class='code' colspan='2'><div>"
76
+ # :api: private
77
+ def render_source(filename, line)
78
+ line = line.to_i
79
+ ret = []
80
+ ret << "<tr class='source'>"
81
+ ret << " <td class='collapse'></td>"
82
+ str = " <td class='code' colspan='2'><div>"
82
83
 
83
- __caller_lines__(filename, line, 5) do |lline, lcode|
84
- str << "<a href='txmt://open?url=file://#{filename}&amp;line=#{lline}'>#{lline}</a>"
85
- str << "<em>" if line == lline
86
- str << Erubis::XmlHelper.escape_xml(lcode)
87
- str << "</em>" if line == lline
88
- str << "\n"
84
+ __caller_lines__(filename, line, 5) do |lline, lcode|
85
+ str << "<a href='txmt://open?url=file://#{filename}&amp;line=#{lline}'>#{lline}</a>"
86
+ str << "<em>" if line == lline
87
+ str << Erubis::XmlHelper.escape_xml(lcode)
88
+ str << "</em>" if line == lline
89
+ str << "\n"
90
+ end
91
+ str << "</div></td>"
92
+ ret << str
93
+ ret << "</tr>"
94
+ ret.join("\n")
89
95
  end
90
- str << "</div></td>"
91
- ret << str
92
- ret << "</tr>"
93
- ret.join("\n")
94
- end
95
96
 
96
- def jar?(filename)
97
- filename.match(/jar\!/)
97
+ def jar?(filename)
98
+ filename.match(/jar\!/)
99
+ end
98
100
  end
99
- end
100
101
 
101
- # :api: private
102
- class DefaultException < Merb::Controller
103
- self._template_root = File.dirname(__FILE__) / "views"
104
-
105
102
  # :api: private
106
- def _template_location(context, type = nil, controller = controller_name)
107
- "#{context}.#{type}"
108
- end
103
+ class DefaultException < Merb::Controller
104
+ self._template_root = File.dirname(__FILE__) / "views"
109
105
 
110
- # :api: private
111
- def index
112
- @exceptions = request.exceptions
113
- @show_details = Merb::Config[:exception_details]
114
- render :format => :html
106
+ # :api: private
107
+ def _template_location(context, type = nil, controller = controller_name)
108
+ "#{context}.#{type}"
109
+ end
110
+
111
+ # :api: private
112
+ def index
113
+ @exceptions = request.exceptions
114
+ @show_details = Merb::Config[:exception_details]
115
+ render :format => :html
116
+ end
115
117
  end
116
118
  end
117
119
  end
118
- end
120
+ end
@@ -1,4 +1,4 @@
1
1
  module Merb
2
- VERSION = '1.0.6' unless defined?(Merb::VERSION)
2
+ VERSION = '1.0.6.1' unless defined?(Merb::VERSION)
3
3
  DM_VERSION = '0.9.8' unless defined?(Merb::DM_VERSION)
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz