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

Merge pull request #1562 from will-in-wi/refactor_display_error_message

Refactor display_error_message to simplify.
This commit is contained in:
Lee Hambley 2016-01-19 16:05:30 +01:00
commit a3a00a0d1d

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 if 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'