1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Refactor display_error_message to simplify.

This commit is contained in:
William Johnston 2016-01-18 11:13:22 -06:00
parent cb7b34ec48
commit 56ad706f4e

View file

@ -63,13 +63,10 @@ module Capistrano
def display_error_message(ex)
unless options.backtrace
if (loc = Rake.application.find_rakefile_location)
whitelist = (@imported.dup << loc[0]).map{|f| File.absolute_path(f, loc[1])}
pattern = %r@^(?!#{whitelist.map{|p| Regexp.quote(p)}.join('|')})@
Rake.application.options.suppress_backtrace_pattern = pattern
end
trace "(Backtrace restricted to imported tasks)"
Rake.application.options.suppress_backtrace_pattern = backtrace_pattern
trace '(Backtrace restricted to imported tasks)'
end
super
end
@ -83,6 +80,14 @@ module Capistrano
private
def backtrace_pattern
loc = Rake.application.find_rakefile_location
return unless loc
whitelist = (@imported.dup << loc[0]).map { |f| File.absolute_path(f, loc[1]) }
/^(?!#{whitelist.map { |p| Regexp.quote(p) }.join('|')})/
end
def load_imports
if options.show_tasks
invoke 'load:defaults'