#!/usr/bin/ruby # new_problem: # * creates a directory for a problem in the current directory, # * create standard testcase config file require 'erb' def process_options(options) i = 2 while ii+1 i += 1 end if ARGV[i]=='-m' options[:mem_limit] = ARGV[i+1].to_i if ARGV.length>i+1 i += 1 end i += 1 end end puts "This script is out of dated, shall be fixed soon" puts "Right now, you can create raw_ev and import" exit(0) GRADER_DIR = File.dirname(__FILE__) # print usage if ARGV.length < 2 puts < 1, :mem_limit => 16} process_options(options) # start working puts "creating directories" system("mkdir #{problem}") system("mkdir #{problem}/script") system("mkdir #{problem}/test_cases") puts "creating testcases directories" 1.upto(num_testcases) do |i| system("mkdir #{problem}/test_cases/#{i}") end # generating all_tests.cfg puts "generating testcase config file" template = File.open(File.dirname(__FILE__) + "/templates/all_tests.cfg.erb").read all_test_cfg = ERB.new(template) cfg_file = File.open("#{problem}/test_cases/all_tests.cfg","w") cfg_file.puts all_test_cfg.result cfg_file.close puts "done"