]>
iEval git - gruntmaster-data.git/blob - gruntmaster-problem
5b4375f40f77aba24cae3c5b95ee427d2c6581bc
5 use Gruntmaster
::Page
::Submit
;
7 use IO
::Prompter
[ -style
=> 'bold', '-stdio', '-verbatim' ];
8 use File
::Slurp qw
/read_file/;
9 use Term
::ANSIColor qw
/RED RESET/;
10 use Getopt
::Long qw
/:config require_order/;
12 ##################################################
21 my ($meta, $name, $prefix) = @_;
22 my $filename = prompt
'$prefix filename', -complete
=> 'filenames';
23 $meta->{files
}{$name}{content
} = read_file
$filename;
24 $meta->{files
}{$name}{format
} = prompt
'$prefix format', -menu
=> Gruntmaster
::Page
::Submit
::FORMATS
;
25 $meta->{files
}{$name}{name
} = prompt
"$prefix filename [$filename]", -default => $filename;
30 my $name = prompt
'Problem name';
31 my $private = prompt
'Private?', '-yn';
32 my $author = prompt
'Problem author (full name)';
33 my $owner = prompt
'Problem owner (username)';
34 my $level = prompt
'Problem level', -menu
=> "beginner\neasy\nmedium\nhard";
35 my $statement = read_file prompt
'File with problem statement', -complete
=> 'filenames';
37 my $generator = prompt
'Generator', -menu
=> "File\nRun\nUndef";
38 my $runner = prompt
'Runner', -menu
=> "File\nVerifier\nInteractive";
39 my $judge = prompt
'Judge', -menu
=> "Absolute\nPoints";
40 my $testcnt = prompt
'Test count', '-i';
42 my $timeout = prompt
'Time limit (seconds)', '-n';
43 my $olimit = prompt
'Output limit (bytes)', '-i';
44 say 'Memory limits are broken, so I won\'t ask you for one';
46 prompt_file \
%meta, gen
=> '[Generator::Run] Generator' if $generator eq 'Run';
48 if ($runner eq 'File') {
49 $meta{tests
}[$_ - 1] = prompt
"[Runner::File] Score for test ${_} [10]", '-i', -default => 10 for 1 .. $testcnt;
52 prompt_file \
%meta, ver
=> '[Runner::Verifier] Verifier' if $runner eq 'Verifier';
54 if ($runner eq 'Interactive') {
55 say RED
, 'WARNING: Runner::Interactive is experimental', RESET
;
56 prompt_file \
%meta, int => '[Runner::Interactive] Interactive verifier';
59 insert_problem
$id => name
=> $name, level
=> $level, statement
=> $statement, author
=> $author, owner
=> $owner, private
=> $private, generator
=> $generator, runner
=> $runner, judge
=> $judge, testcnt
=> $testcnt, (defined $timeout ?
(timeout
=> $timeout) : ()), (defined $olimit ?
(olimit
=> $olimit) : ());
60 set_problem_meta
$id => \
%meta;
61 PUBLISH genpage
=> $contest ?
"ct/$contest/pb/index.html" : 'pb/index.html';
62 PUBLISH genpage
=> $contest ?
"ct/$contest/pb/$id.html" : "pb/$id.html";
67 GetOptions
( 'file!' => \
$file );
68 my ($id, %values) = @ARGV;
69 %values = map { $_ => scalar read_file
$values{$_} } keys %values if $file;
70 edit_problem
$id => %values;
71 PUBLISH genpage
=> 'pb/index.html';
72 PUBLISH genpage
=> "pb/$id.html";
82 PUBLISH genpage
=> $contest ?
"ct/$contest/pb/index.html" : 'pb/index.html';
86 local $_ = shift or goto &cmd_list
;
89 ##################################################
91 GetOptions
( 'contest=s' => \
$contest );
92 local $Gruntmaster::Data
::contest
= $contest;
93 my $cmd = 'cmd_' . shift;
94 cmd_help
unless exists $main::{$cmd};
96 $cmd->(@ARGV) if exists $main::{$cmd};
105 gruntmaster-problem - shell interface to Gruntmaster 6000 problems
109 gruntmaster-problem [--contest=mycontest] add problem_id
110 gruntmaster-problem [--contest=mycontest] list
111 gruntmaster-problem [--contest=mycontest] rm problem_id
112 gruntmaster-problem [--contest=mycontest] show problem_id
113 gruntmaster-problem [--contest=mycontest] set [--file] problem_id key value
117 gruntmaster-problem is a tool for managing problems.
119 Select the contest with the optional argument I<--contest>.
125 Prints the list of problems in the selected contest.
129 Prints detailed information about problem I<id>.
133 Adds a new problem with id I<id>.
137 Removes the problem with id I<id>.
139 =item B<set> I<id> I<key> I<value>
141 Sets the I<key> configuration option of problem I<id> to I<value>.
143 =item B<set> --file I<id> I<key> I<file>
145 Sets the I<key> configuration option of problem I<id> to the contents of the file I<file>.
151 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
153 =head1 COPYRIGHT AND LICENSE
155 Copyright (C) 2014 by Marius Gavrilescu
157 This library is free software: you can redistribute it and/or modify
158 it under the terms of the GNU Affero General Public License as published by
159 the Free Software Foundation, either version 3 of the License, or
160 (at your option) any later version.
This page took 0.066213 seconds and 4 git commands to generate.