From: Petru Trimbitas <petru@wellcode.com>
Date: Fri, 15 Apr 2022 18:26:23 +0000 (+0300)
Subject: Add javascript
X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;p=gruntmaster-daemon.git

Add javascript
---

diff --git a/README b/README
deleted file mode 100644
index 1b0e7ab..0000000
--- a/README
+++ /dev/null
@@ -1,40 +0,0 @@
-Gruntmaster-Daemon version 0.001
-================================
-
-The README is used to introduce the module and provide instructions on
-how to install the module, any machine dependencies it may have (for
-example C compilers and installed libraries) and any other information
-that should be provided before the module is installed.
-
-A README file is required for CPAN modules since CPAN extracts the
-README file from a module distribution so that people browsing the
-archive can use it get an idea of the modules uses. It is usually a
-good idea to provide version information here so that people can
-decide whether fixes for the module are worth downloading.
-
-INSTALLATION
-
-To install this module type the following:
-
-   perl Makefile.PL
-   make
-   make test
-   make install
-
-DEPENDENCIES
-
-This module requires these other modules and libraries:
-
-  blah blah blah
-
-COPYRIGHT AND LICENCE
-
-Put the correct copyright and licence information here.
-
-Copyright (C) 2013 by Marius Gavrilescu
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself, either Perl version 5.18.1 or,
-at your option, any later version of Perl 5 you may have available.
-
-
diff --git a/gruntmaster-compile b/gruntmaster-compile
index 2538cde..3599621 100755
--- a/gruntmaster-compile
+++ b/gruntmaster-compile
@@ -41,11 +41,12 @@ given ($format){
 		exit
 	}
 
-	when ([qw/GOLFSCRIPT JULIA PERL PHP PYTHON PYTHON3 RUBY SBCL/]){
+	when ([qw/GOLFSCRIPT JAVASCRIPT JULIA PERL PHP PYTHON PYTHON3 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/node\n"                                                                   if $_ eq 'JAVASCRIPT';
 		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/python2.7\n"                                                              if $_ eq 'PYTHON';
diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm
index ef24364..9597572 100644
--- a/lib/Gruntmaster/Daemon.pm
+++ b/lib/Gruntmaster/Daemon.pm
@@ -27,6 +27,7 @@ use constant FORMAT_EXTENSION => {
 	GOLFSCRIPT => 'gs',
 	HASKELL => 'hs',
 	JAVA => 'java',
+	JAVASCRIPT => 'js',
 	JULIA => 'jl',
 	MONO => 'cs',
 	OBERON => 'm',
diff --git a/t/01-jobs.t b/t/01-jobs.t
index 0bb2350..c37e081 100644
--- a/t/01-jobs.t
+++ b/t/01-jobs.t
@@ -26,6 +26,7 @@ use constant COMPILER => {
 	   GOLFSCRIPT golfscript
 	   MONO gmcs
 	   JAVA javac
+	   JAVASCRIPT node
 	   JULIA julia
 	   PASCAL fpc
 	   GOLANG go
@@ -40,7 +41,7 @@ use constant COMPILER => {
 	   OCAML ocaml
 	   SBCL sbcl/};
 
-my %needs_fork = map { $_ => 1 } qw/GOLANG GOLFSCRIPT GCCGO JAVA JULIA RUBY/;
+my %needs_fork = map { $_ => 1 } qw/GOLANG GOLFSCRIPT GCCGO JAVA JAVASCRIPT JULIA RUBY SBCL/;
 
 my $loglevel = $ENV{TEST_LOG_LEVEL} // ($ENV{TEST_VERBOSE} ? 'TRACE' : 'OFF');
 my $log_conf = <<CONF;
diff --git a/t/problems/hello/tests/javascript/meta.yml b/t/problems/hello/tests/javascript/meta.yml
new file mode 100644
index 0000000..c7be177
--- /dev/null
+++ b/t/problems/hello/tests/javascript/meta.yml
@@ -0,0 +1,7 @@
+test_name: Javascript
+test_description: Hello world in Javascript
+problem: hello
+files:
+  prog:
+    format: JAVASCRIPT
+    name: prog.js
diff --git a/t/problems/hello/tests/javascript/prog.js b/t/problems/hello/tests/javascript/prog.js
new file mode 100644
index 0000000..7e2c877
--- /dev/null
+++ b/t/problems/hello/tests/javascript/prog.js
@@ -0,0 +1 @@
+console.log('Hello World!')