]>
Commit | Line | Data |
---|---|---|
5c5cd38a MG |
1 | package Gruntmaster::Daemon::Generator::File; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | ||
8a8d1a82 | 7 | use File::Copy qw/copy/; |
ab436d78 | 8 | use File::Slurp qw/write_file/; |
5c5cd38a MG |
9 | use Log::Log4perl qw/get_logger/; |
10 | ||
d6a1ae0d | 11 | our $VERSION = "5999.000_002"; |
5c5cd38a MG |
12 | |
13 | ################################################## | |
14 | ||
15 | sub generate{ | |
16 | my ($test, $meta) = @_; | |
17 | get_logger->trace("Generating test $test ..."); | |
8a8d1a82 MG |
18 | if (exists $meta->{infile}) { |
19 | write_file 'input', $meta->{infile}[$test - 1] | |
20 | } else { | |
07d71f40 MG |
21 | my $ct = defined $Gruntmaster::Data::contest ? "ct/$Gruntmaster::Data::contest" : ''; |
22 | copy "/var/lib/gruntmasterd/$ct/pb/$meta->{problem}/$test.in", 'input' | |
8a8d1a82 | 23 | } |
5c5cd38a MG |
24 | } |
25 | ||
bc372959 MG |
26 | 1; |
27 | __END__ | |
28 | ||
29 | =encoding utf-8 | |
30 | ||
31 | =head1 NAME | |
32 | ||
33 | Gruntmaster::Daemon::Generator::File - Generate tests from files | |
34 | ||
35 | =head1 SYNOPSIS | |
36 | ||
37 | use Gruntmaster::Daemon::Generator::File; | |
38 | Gruntmaster::Daemon::Generator::File->generate(5, $meta); | |
39 | ||
40 | =head1 DESCRIPTION | |
41 | ||
42 | Gruntmaster::Daemon::Generator::File is a static test generator. Test C<$i> is C<< $meta->{infile}[$i - 1] >>. | |
43 | ||
44 | =head1 AUTHOR | |
45 | ||
46 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
47 | ||
48 | =head1 COPYRIGHT AND LICENSE | |
49 | ||
50 | Copyright (C) 2014 by Marius Gavrilescu | |
51 | ||
52 | This library is free software: you can redistribute it and/or modify | |
53 | it under the terms of the GNU Affero General Public License as published by | |
54 | the Free Software Foundation, either version 3 of the License, or | |
55 | (at your option) any later version. | |
56 | ||
57 | ||
58 | =cut |