Sha256: cf08776d83cccdf748a676222ff145714e3928e3cf170ec1c017cf758032d92a

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

#require 'shellwords'
require 'rbconfig'  # replace with facets/rbsystem in future ?
require 'ratch/taskutils'

module Ratch

  # Batch File class, is used as an executionm context for a
  # ratch script.

  class BatchFile < Module

    include TaskUtils

    # 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
    end

  end

end

# Load TaskUtils directly into to main runspace.

#class << self
#  include TaskUtils
#end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratch-0.1 lib/ratch/batch.rb