/** * Builds the settings.local.php file. */ public function __construct() { parent::__construct(); /** @var DrupalStackHelper $drupalStack */ $drupalStack = Toolstack::getStackByType('drupal'); $this->version = $drupalStack->version(Platform::webDir()); }
/** * @covers \mglaman\Toolstack\Stacks\Composer::getComposerData() */ public function testComposerData() { /** @var Stacks\Composer $stack */ $stack = Toolstack::getStackByType(Stacks\Composer::TYPE); $data = $stack->getComposerData($this->dir); $this->assertEquals(['require' => ['drupal/core' => 'dev-master']], $data); }
public function testDrupal7() { $dir = $this->dir . '/d7'; /** @var Stacks\Drupal $stack */ $stack = Toolstack::inspect($dir); $this->assertEquals($stack->type(), Stacks\Drupal::TYPE); $this->assertEquals($stack->version($dir), Stacks\Drupal::DRUPAL7); $dir = $this->dir . '/make'; /** @var Stacks\Drupal $stack */ $stack = Toolstack::inspect($dir); $this->assertEquals($stack->type(), Stacks\Drupal::TYPE); $this->assertEquals($stack->version($dir), Stacks\Drupal::DRUPAL7); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $composeConfig = new ComposeConfig(); // Create docker folder in project. try { $composeConfig->ensureDirectories(); } catch (IOException $e) { $this->stdOut->writeln("<error>Error while trying to create docker-compose directories.</error>"); exit(1); } $composeConfig->copyImages(); $composeConfig->copyConfigs(); $composeContainers = new ComposeContainers(Platform::rootDir(), Config::get('name')); // @todo: With #20 and making tool provider aware, read those configs. Or push those configs to main. if (isset(Config::get()['services'])) { foreach (Config::get('services') as $service) { switch ($service) { case 'redis': $composeContainers->addRedis(); break; case 'solr': $composeContainers->addSolr(); break; case 'memcached': $composeContainers->addMemcached(); break; } } } $composeConfig->writeDockerCompose($composeContainers); // @todo move this into a static class to run configure based on type. $stack = Toolstack::inspect(Platform::webDir()); if ($stack) { $this->stdOut->writeln("<comment>Configuring stack:</comment> " . $stack->type()); switch ($stack->type()) { case Stacks\Drupal::TYPE: $drupal = new Drupal(); $drupal->configure(); break; case Stacks\WordPress::TYPE: $wordpress = new WordPress(); $wordpress->configure(); break; } } $this->stdOut->writeln('<info>Building the containers</info>'); Compose::build(); $this->stdOut->writeln('<info>Bringing up the containers</info>'); Compose::up(['-d']); }
/** * Builds the settings.local.php file. */ public function __construct() { $this->projectName = Platform::projectName(); $this->containerName = Compose::getContainerName(Platform::projectName(), 'mariadb'); /** @var DrupalStackHelper $drupalStack */ $drupalStack = Toolstack::getStackByType('drupal'); $this->version = $drupalStack->version(Platform::webDir()); $this->string = "<?php\n\n"; $this->setSalt(); $this->dbFromLocal(); $this->dbFromDocker(); if ($this->version == DrupalStackHelper::DRUPAL8) { $this->string .= <<<EOT // Configuration directories. \$config_directories = array( CONFIG_ACTIVE_DIRECTORY => '../../../shared/config/active', CONFIG_STAGING_DIRECTORY => '../../../shared/config/staging', ); EOT; } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $composeConfig = new ComposeConfig(); // Create docker folder in project. try { $composeConfig->ensureDirectories(); } catch (IOException $e) { $this->stdOut->writeln("<error>Error while trying to create docker-compose directories.</error>"); exit(1); } $composeConfig->copyImages(); $composeConfig->copyConfigs(); $composeContainers = new ComposeContainers(Platform::rootDir(), Config::get('name')); // @todo check if services.yml has redis $composeContainers->addRedis(); // @todo check to make this optional $composeContainers->addSolr(); $composeConfig->writeDockerCompose($composeContainers); // @todo move this into a static class to run configure based on type. $stack = Toolstack::getStackByDir(Platform::webDir()); if ($stack) { $this->stdOut->writeln("<comment>Configuring stack:</comment> " . $stack->type()); switch ($stack->type()) { case Stacks\Drupal::TYPE: $drupal = new Drupal(); $drupal->configure(); break; case Stacks\WordPress::TYPE: $wordpress = new WordPress(); $wordpress->configure(); break; } } $this->stdOut->writeln('<info>Building the containers</info>'); Compose::build(); $this->stdOut->writeln('<info>Bringing up the containers</info>'); Compose::up(['-d']); }
public static function getStack($dir) { return Toolstack::inspect($dir); }
public function testType() { /** @var Stacks\Symfony $stack */ $stack = Toolstack::getStackByType(Stacks\Symfony::TYPE); $this->assertEquals($stack->type(), Stacks\Symfony::TYPE); }
public function testInspect() { $stack = Toolstack::inspect($this->dir); $this->assertEquals(Stacks\WordPress::TYPE, $stack->type(), 'Directory is a WordPress project'); }
public function testInspectCannotDetect() { $inspect = Toolstack::inspect('tests/resources/empty'); $this->assertNull($inspect->type()); }