Sha256: 13bf2dd14b86775c494cb3a0b84b8012ea6cb1dd18994a79b924eb9885656d1c

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

#! /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] <taskfile>
#
#        OPTIONS:
#
#          --dryrun --nohram
#
#          --trace
#
#          --debug
#       END
#       puts help.gsub(/^\s+/, '')
#     end
#
#   end
#
# end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratch-0.4.1 bin/ratch