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:
parent
cb7b34ec48
commit
56ad706f4e
1 changed files with 11 additions and 6 deletions
|
@ -63,13 +63,10 @@ module Capistrano
|
||||||
|
|
||||||
def display_error_message(ex)
|
def display_error_message(ex)
|
||||||
unless options.backtrace
|
unless options.backtrace
|
||||||
if (loc = Rake.application.find_rakefile_location)
|
Rake.application.options.suppress_backtrace_pattern = backtrace_pattern
|
||||||
whitelist = (@imported.dup << loc[0]).map{|f| File.absolute_path(f, loc[1])}
|
trace '(Backtrace restricted to imported tasks)'
|
||||||
pattern = %r@^(?!#{whitelist.map{|p| Regexp.quote(p)}.join('|')})@
|
|
||||||
Rake.application.options.suppress_backtrace_pattern = pattern
|
|
||||||
end
|
|
||||||
trace "(Backtrace restricted to imported tasks)"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -83,6 +80,14 @@ module Capistrano
|
||||||
|
|
||||||
private
|
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
|
def load_imports
|
||||||
if options.show_tasks
|
if options.show_tasks
|
||||||
invoke 'load:defaults'
|
invoke 'load:defaults'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue