Class: Contestify::Coci::Configuration
- Inherits:
-
Object
- Object
- Contestify::Coci::Configuration
- Defined in:
- lib/contestify/judges/coci/configuration.rb
Overview
Coci::Configuration holds all the logic to configure a COCI based contest. This class must implement the ‘self.configure!` method.
Class Method Summary collapse
-
.configure!(base_folder) ⇒ Object
Contestify::Configuration.configure!is *the only* method you should call from the contest interface.
Class Method Details
.configure!(base_folder) ⇒ Object
Contestify::Configuration.configure! is *the only* method you should call from the contest interface. All the other methods should be called from here. This is the only method needed for future strategies for other judges.
This should be called in a directory structure such that you have a ‘base_folder` with one folder for each problem you want to upload to the server. Each of these problems folders should have all the input/output files you want to use as test cases.
This method must return the absolute paths of the problem folders in an array. This return value will be used in Contestify::Uploader.upload!
Parameters
- base_folder<String>
-
The base folder where all the problems folders are stored.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/contestify/judges/coci/configuration.rb', line 24 def self.configure!(base_folder) puts green "=> Configuring problems (#{base_folder})" problem_index = 0 Dir.glob("*").select { |f| File.directory?(f) }.map do |dir| Dir.chdir File.join(base_folder, dir) dirid = Dir.pwd.split('/').last[0...8] puts green "==> #{dirid.upcase}" rename_data_files add_problem_config(dirid, problem_index) problem_index += 1 puts green "==> All the work for #{dirid.upcase} is done" # Return the absolute path for this problem Dir.pwd end end |