open_exception 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -1
- data/VERSION +1 -1
- data/lib/open_exception.rb +1 -1
- data/lib/open_exception/open_exception.rb +13 -4
- data/lib/open_exception/rails.rb +2 -1
- data/open_exception.gemspec +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -25,13 +25,17 @@ If you are using emacs, you can also open the backtrace along with the file usin
|
|
25
25
|
as the open command. To use this, you will need to add the following function to your emacs init:
|
26
26
|
|
27
27
|
(defun open-trace-and-file (tracefile file linenum)
|
28
|
-
"
|
28
|
+
"Visits TRACEFILE in one window (in compilation mode), and visit FILE at LINENUM in another"
|
29
29
|
(find-file-other-window tracefile)
|
30
30
|
(goto-line 2)
|
31
31
|
(compilation-mode)
|
32
32
|
(find-file-other-window file)
|
33
33
|
(goto-line linenum))
|
34
34
|
|
35
|
+
This will open the backtrace in a compilation buffer, making it easy to navigate to other files in the trace.
|
36
|
+
|
37
|
+
If using `(open-trace-and-file)`, emacs will *not* take focus - you will need to switch to it manually.
|
38
|
+
|
35
39
|
Note: for `emacsclient` to work, you will need to be running `emacsserver`. To start the server:
|
36
40
|
M-x server-start
|
37
41
|
or add the following to your init:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/open_exception.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + "/open_exception/open_exception"
|
2
2
|
require File.dirname(__FILE__) + "/open_exception/rails" if defined?(ActionController)
|
3
3
|
|
4
|
-
init_message = "**
|
4
|
+
init_message = "** open_exception initialized "
|
5
5
|
|
6
6
|
begin
|
7
7
|
require 'growl'
|
@@ -38,7 +38,7 @@ module OpenException
|
|
38
38
|
attr_accessor :options
|
39
39
|
|
40
40
|
def initialize(exception, options = {})
|
41
|
-
@exception = exception
|
41
|
+
@exception = exception.respond_to?(:original_exception) ? exception.original_exception || exception : exception
|
42
42
|
@options = OpenException.options.merge(options)
|
43
43
|
end
|
44
44
|
|
@@ -48,13 +48,22 @@ module OpenException
|
|
48
48
|
|
49
49
|
protected
|
50
50
|
attr_reader :exception, :file_name, :line_number
|
51
|
+
|
52
|
+
def puts(msg)
|
53
|
+
OpenException.puts(msg)
|
54
|
+
end
|
51
55
|
|
56
|
+
def backtrace
|
57
|
+
exception.backtrace
|
58
|
+
end
|
59
|
+
|
52
60
|
def extract_file_and_line
|
53
|
-
if
|
54
|
-
filter_backtrace(
|
61
|
+
if backtrace and
|
62
|
+
filter_backtrace(backtrace) =~ /(.*?):(\d*)/
|
55
63
|
@file_name = $1
|
56
64
|
@line_number = $2
|
57
65
|
end
|
66
|
+
|
58
67
|
end
|
59
68
|
|
60
69
|
def filter_backtrace(backtrace)
|
@@ -100,7 +109,7 @@ module OpenException
|
|
100
109
|
Tempfile.open('open_exception-trace') do |f|
|
101
110
|
f << exception.message
|
102
111
|
f << "\n"
|
103
|
-
f <<
|
112
|
+
f << backtrace.join("\n")
|
104
113
|
cmd.gsub!('{tracefile}', f.path)
|
105
114
|
end
|
106
115
|
end
|
data/lib/open_exception/rails.rb
CHANGED
@@ -13,10 +13,11 @@ module OpenException
|
|
13
13
|
OpenException.open(exception)
|
14
14
|
rescue_action_locally_without_open_exception(exception)
|
15
15
|
end
|
16
|
+
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
20
|
if !ActionController::Base.ancestors.include?(OpenException::ActionControllerExtensions)
|
20
21
|
ActionController::Base.send(:include, OpenException::ActionControllerExtensions)
|
21
|
-
OpenException.options[:backtrace_line_filters] << %r{
|
22
|
+
OpenException.options[:backtrace_line_filters] << %r{^#{RAILS_ROOT}/(app|lib)}
|
22
23
|
end
|
data/open_exception.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{open_exception}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tobias Crawley"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-28}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{tcrawley@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tobias Crawley
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-28 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|