Bump version number and update Changes
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon / Format.pm
index 3c0a84ed059ce6d87260a89f013ed80e62137ef6..c49ffc1ea1b1b7336efa8ad04b76691c40531def 100644 (file)
@@ -8,12 +8,14 @@ no if $] > 5.017011, warnings => 'experimental::smartmatch';
 
 use POSIX qw//;
 use File::Basename qw/fileparse/;
+use File::Slurp qw/write_file/;
 use Gruntmaster::Daemon::Constants qw/TLE OLE DIED NZX/;
 use Time::HiRes qw/alarm/;
 use List::MoreUtils qw/natatime/;
+use Log::Log4perl qw/get_logger/;
 use IPC::Signal qw/sig_name sig_num/;
 
-our $VERSION = '0.001';
+our $VERSION = "5999.000_002";
 our @EXPORT_OK = qw/prepare_files/;
 
 ##################################################
@@ -24,9 +26,9 @@ sub command_and_args{
        given($format) {
                "./$basename" when [qw/C CPP PASCAL/];
                "./$basename.exe" when 'MONO';
-               "java $basename" when 'JAVA';
-               "perl $basename" when 'PERL';
-               "python $basename" when 'PYTHON';
+               java => $basename when 'JAVA';
+               perl => $basename when 'PERL';
+               python => $basename when 'PYTHON';
                default { die "Don't know how to execute format $format" }
        }
 }
@@ -70,12 +72,10 @@ sub mkrun{
 
 sub prepare{
        my ($name, $format) = @_;
-       our $errors;
-       my $basename = fileparse $name, qr/\.[^.]*/;
        get_logger->trace("Preparing file $name...");
 
-       $errors .= `gruntmaster-compile $format $basename $name 2>&1`;
-       $errors .= "\n";
+       $Gruntmaster::Daemon::errors .= `gruntmaster-compile $format $name 2>&1`;
+       $Gruntmaster::Daemon::errors .= "\n";
        die 'Compile error' if $?
 }
 
@@ -91,4 +91,55 @@ sub prepare_files{
        }
 }
 
-1
+1;
+__END__
+
+=encoding utf-8
+
+=head1 NAME
+
+Gruntmaster::Daemon::Format - Utility functions for handling source files
+
+=head1 SYNOPSIS
+
+  use Gruntmaster::Daemon::Format qw/prepare_files/;
+  prepare_files { files => {
+    prog => {
+      name => 'prog.pl',
+      format => 'PERL',
+      content => 'print "Hello, world!"'
+    },
+    ver => {
+      name => 'ver.cpp',
+      format => 'CPP',
+      content => ...
+    },
+  }};
+
+=head1 DESCRIPTION
+
+Gruntmaster::Daemon::Format exports utility functions for handling source files.
+
+=over
+
+=item B<prepare_files> I<$meta>
+
+Compiles all the source files in C<< $meta->{files} >>.
+
+=back
+
+=head1 AUTHOR
+
+Marius Gavrilescu E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+
+=cut
This page took 0.01213 seconds and 4 git commands to generate.