Module: ProjectlockerErrata::RakeHandler

Defined in:
lib/projectlocker_errata/rake_handler.rb

Overview

Patch Rake::Application to handle errors with ProjectlockerErrata

Defined Under Namespace

Modules: Rake087Methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/projectlocker_errata/rake_handler.rb', line 3

def self.included(klass)
  klass.class_eval do
    include Rake087Methods unless defined?(Rake::VERSION) && Rake::VERSION >= '0.9.0'
    alias_method :display_error_message_without_projectlocker_errata, :display_error_message
    alias_method :display_error_message, :display_error_message_with_projectlocker_errata
  end
end

Instance Method Details

#display_error_message_with_projectlocker_errata(ex) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/projectlocker_errata/rake_handler.rb', line 11

def display_error_message_with_projectlocker_errata(ex)
  if ProjectlockerErrata.sender && ProjectlockerErrata.configuration &&
      (ProjectlockerErrata.configuration.rescue_rake_exceptions ||
        (ProjectlockerErrata.configuration.rescue_rake_exceptions===nil && !self.tty_output?))

    ProjectlockerErrata.notify_or_ignore(ex, :component => reconstruct_command_line, :cgi_data => ENV)
  end

  display_error_message_without_projectlocker_errata(ex)
end

#reconstruct_command_lineObject



22
23
24
# File 'lib/projectlocker_errata/rake_handler.rb', line 22

def reconstruct_command_line
  "rake #{ARGV.join( ' ' )}"
end