Sha256: fde15ff9ee1b6a9957e1fe2983b6fb479f745255cdcb014938376952adcf78a6

Contents?: true

Size: 956 Bytes

Versions: 2

Compression:

Stored size: 956 Bytes

Contents

#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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ratch-0.2.1 lib/ratch/batch.rb
ratch-0.2.2 lib/ratch/batch.rb