Class: Rake::Task

Inherits:
Object show all
Defined in:
lib/firespring_dev_commands/rake.rb

Overview

Class override for the execute method This has been added to allow the user to configure whether they want to see a stacktrace when an error has been raised to the top level by rake

Instance Method Summary collapse

Instance Method Details

#execute(args = nil) ⇒ Object

Create a new execute method which runs the original execute and catches any errors it raises Specify STACKTRACE=true or TRACE=true to print the full stack trace of the error



15
16
17
18
19
20
21
22
# File 'lib/firespring_dev_commands/rake.rb', line 15

def execute(args = nil)
  orig_execute(args)
rescue => e
  # Exception notification stuff
  puts "\n  #{e}\n".light_red
  puts "\n#{e.backtrace.join("\n")}\n" if ENV['STACKTRACE'].to_s.strip == 'true' || ENV['TRACE'].to_s.strip == 'true'
  exit 1
end

#orig_executeObject

Create an alias method called orig_execute which is a copy of the original execute method



11
# File 'lib/firespring_dev_commands/rake.rb', line 11

alias_method :orig_execute, :execute