diff --git a/app/src/App.php b/app/src/App.php index add20138..88a732ab 100644 --- a/app/src/App.php +++ b/app/src/App.php @@ -9,7 +9,7 @@ class App extends Application { - const NAME = "Doil Version 20240807 - build 2024-08-07"; + const NAME = "Doil Version 20240902 - build 2024-09-02"; public function __construct(Command ...$commands) { diff --git a/app/src/Commands/Instances/CreateCommand.php b/app/src/Commands/Instances/CreateCommand.php index 7f43a266..34119394 100644 --- a/app/src/Commands/Instances/CreateCommand.php +++ b/app/src/Commands/Instances/CreateCommand.php @@ -12,6 +12,7 @@ use CaT\Doil\Lib\Linux\Linux; use CaT\Doil\Lib\ProjectConfig; use CaT\Doil\Lib\Docker\Docker; +use CaT\Doil\Lib\ILIAS\IliasInfo; use CaT\Doil\Commands\Repo\RepoManager; use CaT\Doil\Lib\ConsoleOutput\Writer; use CaT\Doil\Lib\FileSystem\Filesystem; @@ -56,6 +57,7 @@ class CreateCommand extends Command protected Linux $linux; protected ProjectConfig $project_config; protected Writer $writer; + protected IliasInfo $ilias_info; public function __construct( Docker $docker, @@ -65,7 +67,8 @@ public function __construct( Filesystem $filesystem, Linux $linux, ProjectConfig $project_config, - Writer $writer + Writer $writer, + IliasInfo $ilias_info ) { parent::__construct(); @@ -77,6 +80,7 @@ public function __construct( $this->linux = $linux; $this->project_config = $project_config; $this->writer = $writer; + $this->ilias_info = $ilias_info; } public function configure() : void @@ -277,7 +281,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int sleep(5); $this->writer->endBlock(); - $ilias_version = $this->getIliasVersion($instance_path); + $ilias_version = $this->ilias_info->getIliasVersion($instance_path); // set grains $this->writer->beginBlock($output, "Setting up instance configuration"); @@ -713,26 +717,6 @@ protected function getBranches(OutputInterface $output, string $path, string $ur return $branches; } - protected function getIliasVersion(string $path) : string - { - if ($this->filesystem->exists($path . "/volumes/ilias/include/inc.ilias_version.php")) { - $ilias_version_path = $path . "/volumes/ilias/include/inc.ilias_version.php"; - } else if ($this->filesystem->exists($path . "/volumes/ilias/ilias_version.php")) { - $ilias_version_path = $path . "/volumes/ilias/ilias_version.php"; - } else { - throw new RuntimeException("Can't detect ilias version!"); - } - - $ilias_version = $this->filesystem->getLineInFile( - $ilias_version_path, - "ILIAS_VERSION_NUMERIC" - ); - - preg_match("/\d+.\d/", $ilias_version, $version); - - return $version[0]; - } - protected function getComposerVersion(string $ilias_version) : string { if ($ilias_version > 6.9) { diff --git a/app/src/Commands/Pack/ExportCommand.php b/app/src/Commands/Pack/ExportCommand.php index 498d8063..c7bd741b 100644 --- a/app/src/Commands/Pack/ExportCommand.php +++ b/app/src/Commands/Pack/ExportCommand.php @@ -11,6 +11,7 @@ use CaT\Doil\Lib\Docker\Docker; use CaT\Doil\Lib\ProjectConfig; use CaT\Doil\Commands\Repo\Repo; +use CaT\Doil\Lib\ILIAS\IliasInfo; use CaT\Doil\Lib\ConsoleOutput\Writer; use CaT\Doil\Lib\FileSystem\Filesystem; use CaT\Doil\Commands\Repo\RepoManager; @@ -35,6 +36,7 @@ class ExportCommand extends Command protected ProjectConfig $project_config; protected Git $git; protected RepoManager $repo_manager; + protected IliasInfo $ilias_info; public function __construct( Docker $docker, @@ -43,7 +45,8 @@ public function __construct( Writer $writer, ProjectConfig $project_config, Git $git, - RepoManager $repo_manager + RepoManager $repo_manager, + IliasInfo $ilias_info ) { parent::__construct(); @@ -54,6 +57,7 @@ public function __construct( $this->project_config = $project_config; $this->git = $git; $this->repo_manager = $repo_manager; + $this->ilias_info = $ilias_info; } public function configure() : void @@ -130,7 +134,13 @@ public function execute(InputInterface $input, OutputInterface $output) : int $this->docker->copy($instance . "_" . $suffix, "/var/ilias", $name . "/var/"); $this->docker->copy($instance . "_" . $suffix, "/var/www/html/.git/config", $name . "/var/www/html/.git/config"); - $this->docker->copy($instance . "_" . $suffix, "/var/www/html/data", $name . "/var/www/html"); + if ($this->ilias_info->getIliasVersion($path) >= 10) { + $this->filesystem->makeDirectoryRecursive($name . "/var/www/html/public"); + $this->docker->copy($instance . "_" . $suffix, "/var/www/html/public/data", $name . "/var/www/html/public"); + } else { + $this->docker->copy($instance . "_" . $suffix, "/var/www/html/data", $name . "/var/www/html"); + } + if ($this->filesystem->exists($path . "/volumes/ilias/Customizing/global/skin")) { $this->docker->copy($instance . "_" . $suffix, "/var/www/html/Customizing/global/skin", $name . "/var/www/html/Customizing/global"); } @@ -268,12 +278,14 @@ protected function exportProjectConfig(OutputInterface $output, string $path, st return self::FAILURE; } + $local_cat_ilias_repos = []; if (count($local_repos) > 0) { $local_cat_ilias_repos = array_filter($local_repos, function(Repo $local_repo) { return strstr($local_repo->getUrl(), "conceptsandtraining") || strstr($local_repo->getUrl(), "ILIAS-eLearning"); }); } + $global_cat_ilias_repos = []; if (count($global_repos) > 0) { $global_cat_ilias_repos = array_filter($global_repos, function(Repo $local_repo) { return strstr($local_repo->getUrl(), "conceptsandtraining") || strstr($local_repo->getUrl(), "ILIAS-eLearning"); diff --git a/app/src/Commands/Pack/ImportCommand.php b/app/src/Commands/Pack/ImportCommand.php index babda9d5..90e91cbe 100644 --- a/app/src/Commands/Pack/ImportCommand.php +++ b/app/src/Commands/Pack/ImportCommand.php @@ -87,8 +87,8 @@ public function execute(InputInterface $input, OutputInterface $output) : int $output->writeln("Importing instance $instance"); - if (! $this->filesystem->exists($path)) { - if (! $this->confirmCreateNewInstance($input, $output, $instance)) { + if (!$this->filesystem->exists($path)) { + if (!$this->confirmCreateNewInstance($input, $output, $instance)) { $output->writeln("Import aborted!"); return Command::FAILURE; } @@ -107,22 +107,25 @@ public function execute(InputInterface $input, OutputInterface $output) : int if ($this->filesystem->exists($unpacked . "/conf/project_config.json")) { $project_config = $this->filesystem->readFromJsonFile($unpacked . "/conf/project_config.json"); $project_config = array_shift($project_config); - } else if ($this->filesystem->exists("$unpacked/$target/conf/doil.conf")) { - $unpacked = $unpacked . DIRECTORY_SEPARATOR . $target; - $project_config = $this->readOldProjectConfig("$unpacked/conf/doil.conf"); - $sql_dump = $unpacked . DIRECTORY_SEPARATOR . "var/ilias/ilias.sql"; - } else if ($this->filesystem->exists("$unpacked/conf/doil.conf")) { - $project_config = $this->readOldProjectConfig("$unpacked/conf/doil.conf"); - $sql_dump = $unpacked . DIRECTORY_SEPARATOR . "var/ilias/ilias.sql"; } else { - throw new FileNotFoundException("Can not found doil config file in package."); + if ($this->filesystem->exists("$unpacked/$target/conf/doil.conf")) { + $unpacked = $unpacked . DIRECTORY_SEPARATOR . $target; + $project_config = $this->readOldProjectConfig("$unpacked/conf/doil.conf"); + $sql_dump = $unpacked . DIRECTORY_SEPARATOR . "var/ilias/ilias.sql"; + } else { + if ($this->filesystem->exists("$unpacked/conf/doil.conf")) { + $project_config = $this->readOldProjectConfig("$unpacked/conf/doil.conf"); + $sql_dump = $unpacked . DIRECTORY_SEPARATOR . "var/ilias/ilias.sql"; + } else { + throw new FileNotFoundException("Can not found doil config file in package."); + } + } } $repo = $this->repo_manager->getEmptyRepo(); $repo = $repo ->withName($instance . "_import") - ->withUrl($project_config->getRepositoryUrl()) - ; + ->withUrl($project_config->getRepositoryUrl()); $existing_repo = null; if ($this->repo_manager->repoUrlExists($repo)) { @@ -134,7 +137,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int } } - if (! is_null($existing_repo)) { + if (!is_null($existing_repo)) { $repo = $existing_repo; } else { if ($this->repo_manager->repoNameExists($repo)) { @@ -200,10 +203,18 @@ public function execute(InputInterface $input, OutputInterface $output) : int ); } - $this->filesystem->copyDirectory( - $unpacked . "/var/www/html/data", - $path . "/volumes/ilias/data") - ; + if ($this->filesystem->exists($unpacked . "/var/www/html/data")) { + $this->filesystem->copyDirectory( + $unpacked . "/var/www/html/data", + $path . "/volumes/ilias/data"); + } else if ($this->filesystem->exists($unpacked . "/var/www/html/public/data")) { + $this->filesystem->copyDirectory( + $unpacked . "/var/www/html/public/data", + $path . "/volumes/ilias/public/data"); + } else { + throw new RuntimeException("Can not found unpacked data folder in package."); + } + $this->filesystem->copyDirectory( $unpacked . "/var/ilias/data", $path . "/volumes/data") @@ -254,7 +265,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int "mysql ilias < /var/ilias/data/ilias.sql" ); - $location = $this->filesystem->searchForFileRecursive($path . "/volumes/ilias/data", "/client\.ini\.php/"); + $location = $this->filesystem->searchForFileRecursive($path . "/volumes/ilias", "/client\.ini\.php/"); if (is_null($location)) { $this->writer->error( @@ -276,13 +287,26 @@ public function execute(InputInterface $input, OutputInterface $output) : int $this->writer->endBlock(); $this->writer->beginBlock($output, "Apply ilias config"); - $this->docker->executeCommand( - $path, - $instance, - "bash", - "-c", - "php /var/www/html/setup/setup.php update /var/ilias/data/ilias-config.json -y" - ); + if ($this->filesystem->exists($path . "/var/www/html/setup/setup.php")) { + $this->docker->executeCommand( + $path, + $instance, + "bash", + "-c", + "php /var/www/html/setup/setup.php update /var/ilias/data/ilias-config.json -y" + ); + } else if ($path . "/var/www/html/cli/setup.php") { + $this->docker->executeCommand( + $path, + $instance, + "bash", + "-c", + "php /var/www/html/cli/setup.php update /var/ilias/data/ilias-config.json -y" + ); + } else { + throw new RuntimeException("Can not found setup.php."); + } + $this->writer->endBlock(); if ($this->docker->isInstanceUp($path)) { diff --git a/app/src/Commands/Pack/PackCreateCommand.php b/app/src/Commands/Pack/PackCreateCommand.php index bf9bcc16..c93b3cdc 100644 --- a/app/src/Commands/Pack/PackCreateCommand.php +++ b/app/src/Commands/Pack/PackCreateCommand.php @@ -7,13 +7,14 @@ use Closure; use RuntimeException; use CaT\Doil\Lib\Git\Git; -use CaT\Doil\Commands\Repo\Repo; use CaT\Doil\Lib\Posix\Posix; use CaT\Doil\Lib\Linux\Linux; use CaT\Doil\Lib\ProjectConfig; use CaT\Doil\Lib\Docker\Docker; -use CaT\Doil\Commands\Repo\RepoManager; +use CaT\Doil\Commands\Repo\Repo; +use CaT\Doil\Lib\ILIAS\IliasInfo; use CaT\Doil\Lib\ConsoleOutput\Writer; +use CaT\Doil\Commands\Repo\RepoManager; use CaT\Doil\Lib\FileSystem\Filesystem; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Question\Question; @@ -56,6 +57,7 @@ class PackCreateCommand extends Command protected Linux $linux; protected ProjectConfig $project_config; protected Writer $writer; + protected IliasInfo $ilias_info; public function __construct( Docker $docker, @@ -65,7 +67,8 @@ public function __construct( Filesystem $filesystem, Linux $linux, ProjectConfig $project_config, - Writer $writer + Writer $writer, + IliasInfo $ilias_info ) { parent::__construct(); @@ -77,6 +80,7 @@ public function __construct( $this->linux = $linux; $this->project_config = $project_config; $this->writer = $writer; + $this->ilias_info = $ilias_info; } public function configure() : void @@ -278,7 +282,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int sleep(5); $this->writer->endBlock(); - $ilias_version = $this->getIliasVersion($instance_path); + $ilias_version = $this->ilias_info->getIliasVersion($instance_path); // set grains $this->writer->beginBlock($output, "Setting up instance configuration"); @@ -657,26 +661,6 @@ protected function getBranches(OutputInterface $output, string $path, string $ur return $branches; } - protected function getIliasVersion(string $path) : string - { - if ($this->filesystem->exists($path . "/volumes/ilias/include/inc.ilias_version.php")) { - $ilias_version_path = $path . "/volumes/ilias/include/inc.ilias_version.php"; - } else if ($this->filesystem->exists($path . "/volumes/ilias/ilias_version.php")) { - $ilias_version_path = $path . "/volumes/ilias/ilias_version.php"; - } else { - throw new RuntimeException("Can't detect ilias version!"); - } - - $ilias_version = $this->filesystem->getLineInFile( - $ilias_version_path, - "ILIAS_VERSION_NUMERIC" - ); - - preg_match("/\d+.\d/", $ilias_version, $version); - - return $version[0]; - } - protected function getComposerVersion(string $ilias_version) : string { if ($ilias_version > 6.9) { diff --git a/app/src/Lib/ILIAS/ILIAS.php b/app/src/Lib/ILIAS/ILIAS.php new file mode 100644 index 00000000..8442b688 --- /dev/null +++ b/app/src/Lib/ILIAS/ILIAS.php @@ -0,0 +1,10 @@ + - Extended GPL, see LICENSE */ + +namespace CaT\Doil\Lib\ILIAS; + +interface ILIAS +{ + public function getIliasVersion(string $path) : string; +} \ No newline at end of file diff --git a/app/src/Lib/ILIAS/IliasInfo.php b/app/src/Lib/ILIAS/IliasInfo.php new file mode 100644 index 00000000..24ebbe57 --- /dev/null +++ b/app/src/Lib/ILIAS/IliasInfo.php @@ -0,0 +1,39 @@ + - Extended GPL, see LICENSE */ + +namespace CaT\Doil\Lib\ILIAS; + +use RuntimeException; +use CaT\Doil\Lib\FileSystem\Filesystem; + +class IliasInfo implements ILIAS +{ + protected Filesystem $filesystem; + + public function __construct( + Filesystem $filesystem + ) { + $this->filesystem = $filesystem; + } + + public function getIliasVersion(string $path) : string + { + if ($this->filesystem->exists($path . "/volumes/ilias/include/inc.ilias_version.php")) { + $ilias_version_path = $path . "/volumes/ilias/include/inc.ilias_version.php"; + } else if ($this->filesystem->exists($path . "/volumes/ilias/ilias_version.php")) { + $ilias_version_path = $path . "/volumes/ilias/ilias_version.php"; + } else { + throw new RuntimeException("Can't detect ilias version!"); + } + + $ilias_version = $this->filesystem->getLineInFile( + $ilias_version_path, + "ILIAS_VERSION_NUMERIC" + ); + + preg_match("/\d+.\d/", $ilias_version, $version); + + return $version[0]; + } +} \ No newline at end of file diff --git a/app/src/cli.php b/app/src/cli.php index 20655eeb..f53b5e19 100644 --- a/app/src/cli.php +++ b/app/src/cli.php @@ -13,6 +13,7 @@ use CaT\Doil\Lib\Git\GitShell; use CaT\Doil\Lib\ProjectConfig; use CaT\Doil\Commands\Instances; +use CaT\Doil\Lib\ILIAS\IliasInfo; use CaT\Doil\Lib\Posix\PosixShell; use CaT\Doil\Lib\Linux\LinuxShell; use CaT\Doil\Lib\Docker\DockerShell; @@ -86,6 +87,12 @@ function buildContainerForApp() : Container ); }; + $c["ilias.info"] = function($c) { + return new IliasInfo( + $c["filesystem.shell"] + ); + }; + $c["git.shell"] = function($c) { return new GitShell( $c["logger"] @@ -152,7 +159,8 @@ function buildContainerForApp() : Container $c["filesystem.shell"], $c["linux.shell"], $c["project.config"], - $c["command.writer"] + $c["command.writer"], + $c["ilias.info"] ); }; @@ -284,7 +292,8 @@ function buildContainerForApp() : Container $c["command.writer"], $c["project.config"], $c["git.shell"], - $c["repo.manager"] + $c["repo.manager"], + $c["ilias.info"] ); }; @@ -307,7 +316,8 @@ function buildContainerForApp() : Container $c["filesystem.shell"], $c["linux.shell"], $c["project.config"], - $c["command.writer"] + $c["command.writer"], + $c["ilias.info"] ); }; diff --git a/app/tests/Commands/Instances/CreateCommandTest.php b/app/tests/Commands/Instances/CreateCommandTest.php index 9b77cf08..a381f175 100644 --- a/app/tests/Commands/Instances/CreateCommandTest.php +++ b/app/tests/Commands/Instances/CreateCommandTest.php @@ -10,6 +10,7 @@ use CaT\Doil\Lib\Docker\Docker; use PHPUnit\Framework\TestCase; use CaT\Doil\Lib\ProjectConfig; +use CaT\Doil\Lib\ILIAS\IliasInfo; use CaT\Doil\Lib\ConsoleOutput\Writer; use CaT\Doil\Lib\FileSystem\Filesystem; use CaT\Doil\Commands\Repo\RepoManager; @@ -60,6 +61,7 @@ public function test_execute_with_wrong_chars_in_instance_param() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = new CommandWriter(); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommandWrapper( $docker, @@ -69,7 +71,8 @@ public function test_execute_with_wrong_chars_in_instance_param() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); @@ -90,6 +93,7 @@ public function test_execute_with_no_repo_param() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = new CommandWriter(); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommand( $docker, @@ -99,7 +103,8 @@ public function test_execute_with_no_repo_param() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); @@ -120,6 +125,7 @@ public function test_execute_with_wrong_formatted_phpversion_param() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = new CommandWriter(); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommand( $docker, @@ -129,7 +135,8 @@ public function test_execute_with_wrong_formatted_phpversion_param() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); @@ -156,6 +163,7 @@ public function test_execute_with_non_existing_target() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = new CommandWriter(); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommand( $docker, @@ -165,7 +173,8 @@ public function test_execute_with_non_existing_target() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); @@ -199,6 +208,7 @@ public function test_execute_with_no_write_access_on_target() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = new CommandWriter(); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommand( $docker, @@ -208,7 +218,8 @@ public function test_execute_with_no_write_access_on_target() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); @@ -249,6 +260,7 @@ public function test_execute_with_no_write_access_on_target_by_param() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = new CommandWriter(); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommandWrapper( $docker, @@ -258,7 +270,8 @@ public function test_execute_with_no_write_access_on_target_by_param() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); @@ -293,6 +306,7 @@ public function test_execute() : void $linux = $this->createMock(Linux::class); $project_config = $this->createMock(ProjectConfig::class); $writer = $this->createMock(Writer::class); + $ilias_info = $this->createMock(IliasInfo::class); $command = new CreateCommandWrapper( $docker, @@ -302,7 +316,8 @@ public function test_execute() : void $filesystem, $linux, $project_config, - $writer + $writer, + $ilias_info ); $tester = new CommandTester($command); $app = new Application("doil"); diff --git a/app/tests/Commands/Pack/ExportCommandTest.php b/app/tests/Commands/Pack/ExportCommandTest.php index c9d86422..6d8c11ff 100644 --- a/app/tests/Commands/Pack/ExportCommandTest.php +++ b/app/tests/Commands/Pack/ExportCommandTest.php @@ -8,6 +8,7 @@ use PHPUnit\Framework\TestCase; use CaT\Doil\Lib\Docker\Docker; use CaT\Doil\Lib\ProjectConfig; +use CaT\Doil\Lib\ILIAS\IliasInfo; use CaT\Doil\Lib\FileSystem\Filesystem; use CaT\Doil\Commands\Repo\RepoManager; use CaT\Doil\Lib\ConsoleOutput\CommandWriter; @@ -24,8 +25,18 @@ public function test_execute_without_instance_param() : void $git = $this->createMock(Git::class); $repo_manager = $this->createMock(RepoManager::class); $writer = new CommandWriter(); - - $command = new ExportCommand($docker, $posix, $filesystem, $writer, $project_config, $git, $repo_manager); + $ilias_info = $this->createMock(IliasInfo::class); + + $command = new ExportCommand( + $docker, + $posix, + $filesystem, + $writer, + $project_config, + $git, + $repo_manager, + $ilias_info + ); $tester = new CommandTester($command); $this->expectException(RuntimeException::class); @@ -42,8 +53,18 @@ public function test_execute_with_empty_instance_param() : void $git = $this->createMock(Git::class); $repo_manager = $this->createMock(RepoManager::class); $writer = new CommandWriter(); - - $command = new ExportCommand($docker, $posix, $filesystem, $writer, $project_config, $git, $repo_manager); + $ilias_info = $this->createMock(IliasInfo::class); + + $command = new ExportCommand( + $docker, + $posix, + $filesystem, + $writer, + $project_config, + $git, + $repo_manager, + $ilias_info + ); $tester = new CommandTester($command); $this->expectException(RuntimeException::class); @@ -60,8 +81,18 @@ public function test_execute_with_wrong_chars_in_instance_param() : void $git = $this->createMock(Git::class); $repo_manager = $this->createMock(RepoManager::class); $writer = new CommandWriter(); - - $command = new ExportCommand($docker, $posix, $filesystem, $writer, $project_config, $git, $repo_manager); + $ilias_info = $this->createMock(IliasInfo::class); + + $command = new ExportCommand( + $docker, + $posix, + $filesystem, + $writer, + $project_config, + $git, + $repo_manager, + $ilias_info + ); $tester = new CommandTester($command); $this->expectException(RuntimeException::class); @@ -78,8 +109,18 @@ public function test_execute_with_no_docker_compose_file() : void $git = $this->createMock(Git::class); $repo_manager = $this->createMock(RepoManager::class); $writer = new CommandWriter(); - - $command = new ExportCommand($docker, $posix, $filesystem, $writer, $project_config, $git, $repo_manager); + $ilias_info = $this->createMock(IliasInfo::class); + + $command = new ExportCommand( + $docker, + $posix, + $filesystem, + $writer, + $project_config, + $git, + $repo_manager, + $ilias_info + ); $tester = new CommandTester($command); $posix diff --git a/setup/stack/states/dev/devtools/init.sls b/setup/stack/states/dev/devtools/init.sls index 328c40e0..ae657576 100755 --- a/setup/stack/states/dev/devtools/init.sls +++ b/setup/stack/states/dev/devtools/init.sls @@ -1,3 +1,10 @@ +{% set ilias_version = salt['grains.get']('ilias_version', '9') %} +{% if ilias_version | int < 9 %} +{% set skin_compiler = 'lessc' %} +{% else %} +{% set skin_compiler = 'sass' %} +{% endif %} + ### Standard dev packages devtools_packages: pkg.installed: @@ -8,18 +15,18 @@ devtools_packages: - ghostscript - npm -# Install lessc -/root/install-lessc.sh: +# Install lessc/sass +/root/install-{{ skin_compiler }}.sh: file.managed: - - source: salt://devtools/install-lessc.sh + - source: salt://devtools/install-{{ skin_compiler }}.sh - user: root - group: root - mode: 740 -install-lessc: +install-{{ skin_compiler }}: cmd.run: - cwd: /root/ - - name: ./install-lessc.sh + - name: ./install-{{ skin_compiler }}.sh # Install githook /var/www/html/.git/hooks/post-merge: diff --git a/setup/stack/states/dev/devtools/install-lessc.sh b/setup/stack/states/dev/devtools/install-lessc.sh index d8ce34bc..ce4bcceb 100755 --- a/setup/stack/states/dev/devtools/install-lessc.sh +++ b/setup/stack/states/dev/devtools/install-lessc.sh @@ -1,3 +1,4 @@ #!/bin/bash +npm update -g npm npm install -g less \ No newline at end of file diff --git a/setup/stack/states/dev/devtools/install-sass.sh b/setup/stack/states/dev/devtools/install-sass.sh new file mode 100644 index 00000000..9947bfe7 --- /dev/null +++ b/setup/stack/states/dev/devtools/install-sass.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +npm update -g npm +npm install -g sass \ No newline at end of file diff --git a/setup/updates/update-20240902.sh b/setup/updates/update-20240902.sh new file mode 100644 index 00000000..30e1ac33 --- /dev/null +++ b/setup/updates/update-20240902.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +doil_update_20240902() { + cp -r ${SCRIPT_DIR}/../app/src/* /usr/local/lib/doil/app/src/ + cp -r ${SCRIPT_DIR}/../setup/stack/states/* /usr/local/share/doil/stack/states/ + return $? +} \ No newline at end of file