Skip to content

Commit

Permalink
Implement Tobi his feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed May 14, 2024
1 parent 0a94981 commit 497587d
Showing 1 changed file with 50 additions and 72 deletions.
122 changes: 50 additions & 72 deletions webapp/migrations/Version20240511091916.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,89 +12,67 @@
*/
final class Version20240511091916 extends AbstractMigration
{
final private const COMPILER_VERSION_COMMAND = ['adb'=> 'gnatmake --version',
'awk'=> 'awk --version',
'bash'=> 'bash --version',
'c' => 'gcc --version',
'cpp' => 'g++ --version',
'csharp' => 'mcs --version',
'f95' => 'gfortran --version',
'hs' => 'ghc --version',
'java' => 'javac --version',
'js' => 'nodejs --version',
'kt' => 'kotlinc --version',
'lua' => 'luac -v',
'pas' => 'fpc -iW',
'pl' => 'perl -v',
'plg' => 'swipl --version',
'py3' => 'pypy3 --version',
'ocaml' => 'ocamlopt --version',
'r' => 'Rscript --version',
'rb' => 'ruby --version',
'rs' => 'rustc --version',
'scala' => 'scalac --version',
'sh' => 'md5sum /bin/sh',
'swift' => 'swiftc --version'];

final private const RUNNER_VERSION_COMMAND = ['awk'=> 'awk --version',
'bash'=> 'bash --version',
'csharp' => 'mono --version',
'java' => 'java --version',
'js' => 'nodejs --version',
'kt' => 'kotlin --version',
'lua' => 'lua -v',
'pl' => 'perl -v',
'py3' => 'pypy3 --version',
'r' => 'Rscript --version',
'rb' => 'ruby --version',
'scala' => 'scala --version',
'sh' => 'md5sum /bin/sh'];

public function getDescription(): string
{
return 'Fill default version command for compiler/runner.';
}

public function up(Schema $schema): void
{
$this->addSql('UPDATE language SET compiler_version_command = \'gnatmake --version\' where langid=\'adb\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'awk --version\' where langid=\'awk\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'awk --version\' where langid=\'awk\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'bash --version\' where langid=\'bash\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'bash --version\' where langid=\'bash\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'gcc --version\' where langid=\'c\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'g++ --version\' where langid=\'cpp\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'mono --version\' where langid=\'csharp\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'mcs --version\' where langid=\'csharp\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'gfortran --version\' where langid=\'f95\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'ghc --version\' where langid=\'hs\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'java --version\' where langid=\'java\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'javac --version\' where langid=\'java\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'nodejs --version\' where langid=\'js\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'nodejs --version\' where langid=\'js\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'kotlin --version\' where langid=\'kt\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'kotlinc --version\' where langid=\'kt\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'lua -v\' where langid=\'lua\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'luac -v\' where langid=\'lua\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'fpc -iW\' where langid=\'pas\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'perl -v\' where langid=\'pl\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'perl -v\' where langid=\'pl\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'swipl --version\' where langid=\'plg\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'pypy3 --version\' where langid=\'py3\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'pypy3 --version\' where langid=\'py3\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'ocamlopt --version\' where langid=\'ocaml\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'Rscript --version\' where langid=\'r\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'Rscript --version\' where langid=\'r\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'ruby --version\' where langid=\'rb\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'ruby --version\' where langid=\'rb\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'rustc --version\' where langid=\'rs\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'scala --version\' where langid=\'scala\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'scalac --version\' where langid=\'scala\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET runner_version_command = \'md5sum /bin/sh\' where langid=\'sh\' AND runner_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'md5sum /bin/sh\' where langid=\'sh\' AND compiler_version_command IS NULL;');
$this->addSql('UPDATE language SET compiler_version_command = \'swiftc --version\' where langid=\'swift\' AND compiler_version_command IS NULL;');
foreach (self::COMPILER_VERSION_COMMAND as $lang => $versionCommand) {
$this->addSql("UPDATE language SET compiler_version_command = '" . $versionCommand ."' WHERE langid='" . $lang . "' AND compiler_version_command IS NULL;");
}
foreach (self::RUNNER_VERSION_COMMAND as $lang => $versionCommand) {
$this->addSql("UPDATE language SET runner_version_command = '" . $versionCommand ."' WHERE langid='" . $lang . "' AND runner_version_command IS NULL;");
}
}

public function down(Schema $schema): void
{
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'adb\' AND compiler_version_command = \'gnatmake --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'awk\' AND runner_version_command = \'awk --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'awk\' AND compiler_version_command = \'awk --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'bash\' AND runner_version_command = \'bash --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'bash\' AND compiler_version_command = \'bash --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'c\' AND compiler_version_command = \'gcc --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'cpp\' AND compiler_version_command = \'g++ --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'csharp\' AND runner_version_command = \'mono --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'csharp\' AND compiler_version_command = \'mcs --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'f95\' AND compiler_version_command = \'gfortran --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'hs\' AND compiler_version_command = \'ghc --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'java\' AND runner_version_command = \'java --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'java\' AND compiler_version_command = \'javac --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'js\' AND runner_version_command = \'nodejs --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'js\' AND compiler_version_command = \'nodejs --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'kt\' AND runner_version_command = \'kotlin --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'kt\' AND compiler_version_command = \'kotlinc --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'lua\' AND runner_version_command = \'lua -v\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'lua\' AND compiler_version_command = \'luac -v\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'pas\' AND compiler_version_command = \'fpc -iW\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'pl\' AND runner_version_command = \'perl -v\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'pl\' AND compiler_version_command = \'perl -v\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'plg\' AND compiler_version_command = \'swipl --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'py3\' AND runner_version_command = \'pypy3 --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'py3\' AND compiler_version_command = \'pypy3 --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'ocaml\' AND compiler_version_command = \'ocamlopt --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'r\' AND runner_version_command = \'Rscript --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'r\' AND compiler_version_command = \'Rscript --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'rb\' AND runner_version_command = \'ruby --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'rb\' AND compiler_version_command = \'ruby --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'rs\' AND compiler_version_command = \'rustc --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'scala\' AND runner_version_command = \'scala --version\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'scala\' AND compiler_version_command = \'scalac --version\';');
$this->addSql('UPDATE language SET runner_version_command = NULL where langid=\'sh\' AND runner_version_command = \'md5sum /bin/sh\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'sh\' AND compiler_version_command = \'md5sum /bin/sh\';');
$this->addSql('UPDATE language SET compiler_version_command = NULL where langid=\'swift\' AND compiler_version_command = \'swiftc --version\';');
foreach (self::COMPILER_VERSION_COMMAND as $lang => $versionCommand) {
$this->addSql("UPDATE language SET compiler_version_command = NULL WHERE langid='" . $lang . "' AND compiler_version_command = '" . $versionCommand ."';");
}
foreach (self::RUNNER_VERSION_COMMAND as $lang => $versionCommand) {
$this->addSql("UPDATE language SET runner_version_command = NULL WHERE langid='" . $lang . "' AND runner_version_command = '" . $versionCommand ."';");
}
}

public function isTransactional(): bool
Expand Down

0 comments on commit 497587d

Please sign in to comment.