Class: Makit::Rake::TraceController

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/rake/trace_controller.rb

Overview

Enhanced trace controller for Rake with Makit-specific debugging information

This class provides enhanced tracing capabilities when –trace is passed to rake, adding makit-specific debugging information to help with troubleshooting and understanding command execution flow.

Examples:

Basic usage

# In Rakefile
require "makit"
Makit::Rake::TraceController.setup

With environment variable

MAKIT_TRACE=true rake --trace

Class Method Summary collapse

Class Method Details

.setupvoid

This method returns an undefined value.

Set up enhanced tracing for Rake tasks

This method should be called early in the Rakefile to enable enhanced tracing when –trace is passed to rake.



25
26
27
28
29
30
31
# File 'lib/makit/rake/trace_controller.rb', line 25

def self.setup
  return unless should_enhance_trace?

  # Set up enhanced tracing
  setup_enhanced_tracing
  Makit::Logging.debug("Enhanced trace controller activated") if defined?(Makit::Logging)
end

.should_enhance_trace?Boolean

Check if trace enhancement should be enabled



36
37
38
39
40
# File 'lib/makit/rake/trace_controller.rb', line 36

def self.should_enhance_trace?
  ENV['RAKE_TRACE'] ||
  ARGV.include?('--trace') ||
  ENV['MAKIT_TRACE'] == 'true'
end

.trace_statusHash

Get current trace status



45
46
47
48
49
50
51
52
# File 'lib/makit/rake/trace_controller.rb', line 45

def self.trace_status
  {
    rake_trace: ENV['RAKE_TRACE'],
    trace_flag: ARGV.include?('--trace'),
    makit_trace: ENV['MAKIT_TRACE'],
    enhanced: should_enhance_trace?
  }
end