Module: Texas::Build

Extended by:
OutputHelper
Defined in:
lib/texas/build.rb,
lib/texas/build/dry.rb,
lib/texas/build/base.rb,
lib/texas/build/final.rb,
lib/texas/build/config.rb,
lib/texas/build/task/base.rb,
lib/texas/build/task/script.rb,
lib/texas/build/config_loader.rb,
lib/texas/build/task/open_pdf.rb,
lib/texas/build/task/publish_pdf.rb,
lib/texas/build/task/run_master_template.rb,
lib/texas/build/task/execute_after_scripts.rb,
lib/texas/build/task/execute_before_scripts.rb,
lib/texas/build/task/rewrite_marked_templates.rb,
lib/texas/build/task/copy_contents_to_build_path.rb,
lib/texas/build/task/add_default_templates_to_build_path.rb

Defined Under Namespace

Modules: Task Classes: Base, Config, ConfigLoader, Dry, Final

Class Method Summary collapse

Methods included from OutputHelper

trace, verbose, warning

Class Method Details

.display_error_message(build, ex) ⇒ Object

Display the error message that caused the exception.



8
9
10
11
12
13
14
15
16
# File 'lib/texas/build.rb', line 8

def display_error_message(build, ex)
  trace TraceInfo.new(:error, "#{build.options.task} aborted!", :red)
  trace "\n" + ex.message
  if build.options.backtrace
    trace ex.backtrace
  else
    trace "(See full trace with --backtrace)"
  end
end

.run_with_nice_errors(build, &block) ⇒ Object

Run the given build object. If any errors occur, display them in a formatted way and call the optional block, if present.



21
22
23
24
25
26
27
28
29
30
# File 'lib/texas/build.rb', line 21

def run_with_nice_errors(build, &block)
  build.run
rescue Interrupt => ex
  trace "\n"
  trace TraceInfo.new("interrupt", "#{build.options.task} interrupted!", :yellow)
  exit 0
rescue StandardError => ex
  display_error_message(build, ex)
  block.() if block
end