Module: Texas::OutputHelper

Included in:
Build, Build::Base, Build::Task::Base, OptionParser, Runner, Task::Base, Task::Watch, Template::Runner::Base
Defined in:
lib/texas/output_helper.rb

Overview

The OutputHelper module provides helper methods to output information to STDOUT.

Defined Under Namespace

Classes: TraceInfo

Instance Method Summary collapse

Instance Method Details

#trace(*args) ⇒ Object

Puts the given arguments


8
9
10
# File 'lib/texas/output_helper.rb', line 8

def trace(*args)
  puts *args
end

#verbose(&block) ⇒ Object

Traces the result of the given block if Texas is running in verbose mode

Example:

verbose { "Debug information: " + some_expensive_lookup.to_s }

17
18
19
20
21
# File 'lib/texas/output_helper.rb', line 17

def verbose(&block)
  if Texas.verbose
    trace block.()
  end
end

#warning(&block) ⇒ Object

Traces the result of the given block if warnings are enabled

Example:

warning { "This might cause problems: " + something.to_s }

28
29
30
31
32
# File 'lib/texas/output_helper.rb', line 28

def warning(&block)
  if Texas.warnings
    trace TraceInfo.new("WARNING", block.().to_s, :yellow)
  end
end