# TITLE: # # BatchFile # # COPYING: # # Copyright (c) 2007 Psi T Corp. # # This file is part of the ProUtils' Ratch program. # # Ratch is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ratch is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ratch. If not, see . #require 'shellwords' require 'yaml' require 'rbconfig' # replace with facets/rbsystem in future ? #require 'facets/hash/merge' # for reverse_merge require 'ratch/options' require 'ratch/consoleutils' require 'ratch/configutils' require 'ratch/emailutils' require 'ratch/fileutils' require 'ratch/argvutils' require 'ratch/taskable' require 'ratch/buildable' require 'ratch/batchable' module Ratch # BatchScript module defines the DSL available to a ratch script. module BatchScript #< Module include GeneralOptions include ConsoleUtils include ArgvUtils include FileUtils include ConfigUtils include EmailUtils include Buildable include Taskable include Batchable # 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) #puts script #p $0 #puts # 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 BatchScript into to main runspace. # # TODO: Should this be in all Object space (ie. no class << self)? class << self include Ratch::BatchScript end $batch_binding = binding END { task_manager.call_main }