Commit 9c45124156adff715a28feb2f2dffb1eef01b0c7

Authored by Stephen Crosby
1 parent 0ff2eb5a
Exists in master and in 1 other branch production

Refs #933 remove remnants of BacktraceLineHelper

app/helpers/backtrace_line_helper.rb
@@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
1 -module BacktraceLineHelper  
2 - def link_to_source_file(line, app, &block)  
3 - text = capture_haml(&block)  
4 - link_to_in_app_source_file(line, app, text) || text  
5 - end  
6 -  
7 - private  
8 - def link_to_in_app_source_file(line, app, text)  
9 - return unless line.in_app?  
10 - if line.file_name =~ /\.js$/  
11 - link_to_hosted_javascript(line, app, text)  
12 - else  
13 - link_to_repo_source_file(line, app, text) ||  
14 - link_to_issue_tracker_file(line, app, text)  
15 - end  
16 - end  
17 -  
18 - def link_to_repo_source_file(line, app, text)  
19 - link_to_github(line, app, text) || link_to_bitbucket(line, app, text)  
20 - end  
21 -  
22 - def link_to_hosted_javascript(line, app, text)  
23 - if app.asset_host?  
24 - link_to(text, "#{app.asset_host}/#{line.file_relative}", :target => '_blank')  
25 - end  
26 - end  
27 -  
28 - def link_to_github(line, app, text = nil)  
29 - return unless app.github_repo?  
30 - href = "%s#L%s" % [app.github_url_to_file(line.decorated_path + line.file_name), line.number]  
31 - link_to(text || line.file_name, href, :target => '_blank')  
32 - end  
33 -  
34 - def link_to_bitbucket(line, app, text = nil)  
35 - return unless app.bitbucket_repo?  
36 - href = "%s#cl-%s" % [app.bitbucket_url_to_file(line.decorated_path + line.file_name), line.number]  
37 - link_to(text || line.file_name, href, :target => '_blank')  
38 - end  
39 -  
40 - def link_to_issue_tracker_file(line, app, text = nil)  
41 - return unless app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file)  
42 - href = app.issue_tracker.url_to_file(line.file_relative, line.number)  
43 - link_to(text || line.file_name, href, :target => '_blank')  
44 - end  
45 -  
46 -end  
app/mailers/mailer.rb
@@ -4,7 +4,6 @@ require Rails.root.join('config/routes.rb') @@ -4,7 +4,6 @@ require Rails.root.join('config/routes.rb')
4 4
5 class Mailer < ActionMailer::Base 5 class Mailer < ActionMailer::Base
6 helper ApplicationHelper 6 helper ApplicationHelper
7 - helper BacktraceLineHelper  
8 7
9 default :from => Errbit::Config.email_from, 8 default :from => Errbit::Config.email_from,
10 'X-Errbit-Host' => Errbit::Config.host, 9 'X-Errbit-Host' => Errbit::Config.host,
app/views/mailer/err_notification.html.haml
@@ -65,6 +65,6 @@ @@ -65,6 +65,6 @@
65 %p.heading FULL BACKTRACE: 65 %p.heading FULL BACKTRACE:
66 - @notice.backtrace.lines.each do |line| 66 - @notice.backtrace.lines.each do |line|
67 %p.backtrace 67 %p.backtrace
68 - = link_to_source_file(line, @app) do 68 + = line.link_to_source_file(@app) do
69 = line.to_s 69 = line.to_s
70 %br 70 %br
spec/helpers/backtrace_line_helper.rb
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -describe BacktraceLineHelper do  
2 - describe "in app lines" do  
3 - let(:notice) do  
4 - Fabricate.build(:notice, :backtrace =>  
5 - Fabricate.build(:backtrace, :lines => [  
6 - Fabricate.build(:backtrace_line, :file => "[PROJECT_ROOT]/path/to/asset.js")  
7 - ])  
8 - )  
9 - end  
10 -  
11 - describe '#link_to_source_file' do  
12 - it 'still returns text for in app file and line number when no repo is configured' do  
13 - result = link_to_source_file(notice.backtrace.lines.first) { haml_concat "link text" }  
14 - result.strip.should == 'link text'  
15 - end  
16 - end  
17 - end  
18 -end