bin/ratch in ratch-0.2.3 vs bin/ratch in ratch-0.3.0
- old
+ new
@@ -1,55 +1,68 @@
#! /usr/bin/ruby1.8
-#require 'shellwords'
-require 'rbconfig' # replace with facets/rbsystem in future ?
-#require 'ratch/batchfile'
-require 'ratch/batch'
-
-module Ratch
-
- class RatchCommand
-
- # Quick start.
-
- def self.start(file)
- new.run(file)
+if ARGV[0] == '-s'
+ require 'ratch/manager'
+ manager = Ratch::Manager.new
+ file = ARGV[1]
+ if file
+ # run tool
+ if tool = manager.tool?(file)
+ require 'ratch/batch'
+ load(tool)
+ else
+ puts "no tool -- #{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
-
+ else
+ puts manager.toolset.join("\n")
end
+elsif ARGV.empty?
+ # TODO read stdin for ratch script
-
+else
+ require 'ratch/batch'
+ load($0 = ARGV.shift)
end
-load($0 = ARGV.shift)
-#Ratch::RatchCommand.start(ARGV.shift)
-
+# 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