diff --git a/app/helpers/backtrace_line_helper.rb b/app/helpers/backtrace_line_helper.rb deleted file mode 100644 index c65a7cd..0000000 --- a/app/helpers/backtrace_line_helper.rb +++ /dev/null @@ -1,46 +0,0 @@ -module BacktraceLineHelper - def link_to_source_file(line, app, &block) - text = capture_haml(&block) - link_to_in_app_source_file(line, app, text) || text - end - - private - def link_to_in_app_source_file(line, app, text) - return unless line.in_app? - if line.file_name =~ /\.js$/ - link_to_hosted_javascript(line, app, text) - else - link_to_repo_source_file(line, app, text) || - link_to_issue_tracker_file(line, app, text) - end - end - - def link_to_repo_source_file(line, app, text) - link_to_github(line, app, text) || link_to_bitbucket(line, app, text) - end - - def link_to_hosted_javascript(line, app, text) - if app.asset_host? - link_to(text, "#{app.asset_host}/#{line.file_relative}", :target => '_blank') - end - end - - def link_to_github(line, app, text = nil) - return unless app.github_repo? - href = "%s#L%s" % [app.github_url_to_file(line.decorated_path + line.file_name), line.number] - link_to(text || line.file_name, href, :target => '_blank') - end - - def link_to_bitbucket(line, app, text = nil) - return unless app.bitbucket_repo? - href = "%s#cl-%s" % [app.bitbucket_url_to_file(line.decorated_path + line.file_name), line.number] - link_to(text || line.file_name, href, :target => '_blank') - end - - def link_to_issue_tracker_file(line, app, text = nil) - return unless app.issue_tracker && app.issue_tracker.respond_to?(:url_to_file) - href = app.issue_tracker.url_to_file(line.file_relative, line.number) - link_to(text || line.file_name, href, :target => '_blank') - end - -end diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 0f3ec4d..1d55f46 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -4,7 +4,6 @@ require Rails.root.join('config/routes.rb') class Mailer < ActionMailer::Base helper ApplicationHelper - helper BacktraceLineHelper default :from => Errbit::Config.email_from, 'X-Errbit-Host' => Errbit::Config.host, diff --git a/app/views/mailer/err_notification.html.haml b/app/views/mailer/err_notification.html.haml index ee61597..83b026a 100644 --- a/app/views/mailer/err_notification.html.haml +++ b/app/views/mailer/err_notification.html.haml @@ -65,6 +65,6 @@ %p.heading FULL BACKTRACE: - @notice.backtrace.lines.each do |line| %p.backtrace - = link_to_source_file(line, @app) do + = line.link_to_source_file(@app) do = line.to_s %br diff --git a/spec/helpers/backtrace_line_helper.rb b/spec/helpers/backtrace_line_helper.rb deleted file mode 100644 index 45ab917..0000000 --- a/spec/helpers/backtrace_line_helper.rb +++ /dev/null @@ -1,18 +0,0 @@ -describe BacktraceLineHelper do - describe "in app lines" do - let(:notice) do - Fabricate.build(:notice, :backtrace => - Fabricate.build(:backtrace, :lines => [ - Fabricate.build(:backtrace_line, :file => "[PROJECT_ROOT]/path/to/asset.js") - ]) - ) - end - - describe '#link_to_source_file' do - it 'still returns text for in app file and line number when no repo is configured' do - result = link_to_source_file(notice.backtrace.lines.first) { haml_concat "link text" } - result.strip.should == 'link text' - end - end - end -end -- libgit2 0.21.2