From 8473542d42779eebcd7b0dd45dcf5183d112252c Mon Sep 17 00:00:00 2001 From: Sergiu Date: Thu, 21 Jan 2016 06:17:48 +0200 Subject: [PATCH] Add PHP --- gruntmaster-compile | 19 ++++++++++++------- lib/Gruntmaster/Daemon.pm | 1 + t/01-jobs.t | 1 + t/problems/hello/tests/php/meta.yml | 7 +++++++ t/problems/hello/tests/php/prog.php | 3 +++ 5 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 t/problems/hello/tests/php/meta.yml create mode 100644 t/problems/hello/tests/php/prog.php diff --git a/gruntmaster-compile b/gruntmaster-compile index cea2733..0ab18fc 100755 --- a/gruntmaster-compile +++ b/gruntmaster-compile @@ -38,15 +38,16 @@ given ($format){ exit } - when ([qw/GOLFSCRIPT JULIA PERL PYTHON RUBY SBCL/]){ + when ([qw/GOLFSCRIPT JULIA PERL PHP PYTHON RUBY SBCL/]){ open IN, '<', $name; open OUT, '>', $basename; - print OUT "#!/usr/bin/golfscript\n" if $_ eq 'GOLFSCRIPT'; - print OUT "#!/usr/bin/julia -O\n" if $_ eq 'JULIA'; - print OUT "#!/usr/bin/perl\n" if $_ eq 'PERL'; - print OUT "#!/usr/bin/python\n" if $_ eq 'PYTHON'; - print OUT "#!/usr/bin/ruby\n" if $_ eq 'RUBY'; - print OUT "#!/usr/bin/sbcl --script\n" if $_ eq 'SBCL'; + print OUT "#!/usr/bin/golfscript\n" if $_ eq 'GOLFSCRIPT'; + print OUT "#!/usr/bin/julia -O\n" if $_ eq 'JULIA'; + print OUT "#!/usr/bin/perl\n" if $_ eq 'PERL'; + print OUT "#!/usr/bin/php -d ONLINE_JUDGE=true\n" if $_ eq 'PHP'; + print OUT "#!/usr/bin/python\n" if $_ eq 'PYTHON'; + print OUT "#!/usr/bin/ruby\n" if $_ eq 'RUBY'; + print OUT "#!/usr/bin/sbcl --script\n" if $_ eq 'SBCL'; print OUT while ; close OUT; close IN; @@ -125,6 +126,10 @@ Compile commands for each format: cp $input $output +=item PHP + + cp $input $output + =item PYTHON cp $input $output diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index ad4e727..b6d3a52 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -30,6 +30,7 @@ use constant FORMAT_EXTENSION => { MONO => 'cs', PASCAL => 'pas', PERL => 'pl', + PHP => 'php', PYTHON => 'py', RUBY => 'rb', RUST => 'rs', diff --git a/t/01-jobs.t b/t/01-jobs.t index e3464fc..90f7d70 100644 --- a/t/01-jobs.t +++ b/t/01-jobs.t @@ -31,6 +31,7 @@ use constant COMPILER => { GCCGO gccgo HASKELL ghc PERL perl + PHP php PYTHON python RUBY ruby RUST rustc diff --git a/t/problems/hello/tests/php/meta.yml b/t/problems/hello/tests/php/meta.yml new file mode 100644 index 0000000..0f9f474 --- /dev/null +++ b/t/problems/hello/tests/php/meta.yml @@ -0,0 +1,7 @@ +test_name: PHP +test_description: Hello world in PHP +problem: hello +files: + prog: + format: PHP + name: prog.php diff --git a/t/problems/hello/tests/php/prog.php b/t/problems/hello/tests/php/prog.php new file mode 100644 index 0000000..c1319fb --- /dev/null +++ b/t/problems/hello/tests/php/prog.php @@ -0,0 +1,3 @@ + -- 2.39.2