Method: EtchExternalSource#run_script

Defined in:
lib/etch.rb

#run_script(script) ⇒ Object

This method runs a etch script (as specified via a <script> entry in a config.xml file) and returns any output that the script puts in the @contents variable.



1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
# File 'lib/etch.rb', line 1518

def run_script(script)
  @dlogger.debug "Processing script #{script} for file #{@file}"
  @contents = ''
  begin
    run_script_stage2(script)
  rescue Exception => e
    if e.kind_of?(SystemExit)
      # The user might call exit within a script.  We want the scripts
      # to act as much like a real script as possible, so ignore those.
    else
      # Help the user figure out where the exception occurred, otherwise they
      # just get told it happened here in eval, which isn't very helpful.
      raise Etch.wrap_exception(e, "Exception while processing script #{script} for file #{@file}:\n" + e.message)
    end
  end
  @contents
end