lib/ratch/batch.rb in ratch-0.2.2 vs lib/ratch/batch.rb in ratch-0.2.3
- old
+ new
@@ -1,49 +1,101 @@
+# 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 <http://www.gnu.org/licenses/>.
+
#require 'shellwords'
+require 'yaml'
require 'rbconfig' # replace with facets/rbsystem in future ?
-require 'ratch/taskutils'
+#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
- # Batch File class, is used as an executionm context for a
- # ratch script.
+ # BatchScript module defines the DSL available to a ratch script.
- class BatchFile < Module
+ module BatchScript #< Module
- include TaskUtils
+ include GeneralOptions
+ include ConsoleUtils
+ include ArgvUtils
+ include FileUtils
+ include ConfigUtils
+ include EmailUtils
+
+ include Buildable
+ include Taskable
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
+ #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
+ #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 TaskUtils directly into to main runspace.
+# Load BatchScript into to main runspace.
+#
+# TODO: Should this be in all Object space (ie. no class << self)?
+class << self
+ include Ratch::BatchScript
+end
-#class << self
-# include TaskUtils
-#end
+$batch_binding = binding
+
+END {
+ task_manager.call_main
+}