#require 'shellwords' require 'rbconfig' # replace with facets/rbsystem in future ? require 'ratch/taskutils' require 'ratch/batchable' module Ratch # Batch File class, is used as an executionm context for a # ratch script. class BatchFile < Module include TaskUtils include Batchable include OpenBatchable # Quick start, equivalent to calling new.run(file). #def self.start(file) # new(file).call #end # New Batch File def initialize(file) abort "missing batch file -- #{file}" unless File.file?(file) @file = file end # TODO What todo about arguments? def call(arguments=nil) script = File.read($0 = @file) eval(script, binding, $0) #instance_eval(script) #@main.call if @main task_manager.call_main #run(:main) if task_manager.main end end end # Load TaskUtils directly into to main runspace. #class << self # include TaskUtils #end