#! /usr/bin/env ruby # TODO Create a more robust parser. if ARGV[0] == '-s' require 'ratch/manager' manager = Ratch::Manager.new set = ARGV[1] path = ARGV[2] if set if setdirectory = manager.toolset?(set) if path if batchfile = manager.tool?(set, path) require 'ratch/dsl' self.batch_directory = setdirectory load($0 = batchfile) else puts "no #{set} tool -- #{path}" end else puts manager.tools(set).join("\n") end else puts "no toolset -- #{set}" end else puts manager.toolsets.join("\n") end elsif ARGV.empty? # TODO read stdin for ratch script else require 'ratch/dsl' load($0 = ARGV.shift) end # module Ratch # # class RatchCommand # # # Quick start. # # def self.start(file) # new.run(file) # end # # # Run task. # # def run(file) # if file # BatchFile.new(file).call # else # help # end # end # # # Dispaly help. # # def help # help = <<-END # USAGE: # # ratch [options] # # OPTIONS: # # --dryrun --nohram # # --trace # # --debug # END # puts help.gsub(/^\s+/, '') # end # # end # # end