bin/ratch in ratch-0.4.1 vs bin/ratch in ratch-1.0.0

- old
+ new

@@ -1,83 +1,10 @@ -#! /usr/bin/env ruby +#!/usr/bin/env ruby -# TODO Create a more robust parser. +$0 = ARGV.shift -if ARGV[0] == '-s' - require 'ratch/manager' - manager = Ratch::Manager.new +require 'ratch/script' - set = ARGV[1] - path = ARGV[2] +script = Ratch::Script.new - 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 +script.instance_eval(File.read($0)) -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] <taskfile> -# -# OPTIONS: -# -# --dryrun --nohram -# -# --trace -# -# --debug -# END -# puts help.gsub(/^\s+/, '') -# end -# -# end -# -# end