Commit 9c45124156adff715a28feb2f2dffb1eef01b0c7
1 parent
0ff2eb5a
Exists in
master
and in
1 other branch
Refs #933 remove remnants of BacktraceLineHelper
Showing
4 changed files
with
1 additions
and
66 deletions
Show diff stats
app/helpers/backtrace_line_helper.rb
... | ... | @@ -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
app/views/mailer/err_notification.html.haml
spec/helpers/backtrace_line_helper.rb
... | ... | @@ -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 |