public function configure() { $fs = new Filesystem(); $fs->copy(CLI_ROOT . '/resources/stacks/wordpress/wp-config.php', Platform::webDir() . '/wp-config.php', true); $fs->remove(Platform::webDir() . '/wp-confg-sample.php'); $fs->dumpFile(Platform::sharedDir() . '/wp-config.local.php', $this->string); // Relink if missing. if (!$fs->exists(Platform::webDir() . '/wp-config.local.php')) { $fs->symlink('../shared/wp-config.local.php', Platform::webDir() . '/wp-config .local.php'); } }
/** * */ public function configure() { $fs = new Filesystem(); if (!file_exists(Platform::webDir() . '/sites/default/settings.php')) { $fs->copy(CLI_ROOT . '/resources/stacks/drupal/drupal7.settings.php', Platform::webDir() . '/sites/default/settings.php', true); } $fs->dumpFile(Platform::sharedDir() . '/settings.local.php', $this->string); // Relink if missing. if (!$fs->exists(Platform::webDir() . '/sites/default/settings.local.php')) { $fs->symlink('../../../shared/settings.local.php', Platform::webDir() . '/sites/default/settings.local.php'); } }
/** * {@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']); }
/** * {@inheritdoc} * * @see PlatformCommand::getCurrentEnvironment() */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var \Symfony\Component\Console\Helper\ProcessHelper $process */ $process = $this->getHelper('process'); $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); if (!is_dir(Platform::rootDir() . '/docker/fg')) { $process->mustRun($output, ['git', 'clone', 'https://github.com/brendangregg/FlameGraph.git', Platform::rootDir() . '/docker/fg']); } if (!is_dir(Platform::rootDir() . '/docker/xhpfg')) { $process->mustRun($output, ['git', 'clone', 'https://github.com/msonnabaum/xhprof-flamegraphs.git', Platform::rootDir() . '/docker/xhpfg']); } $this->stdOut->writeln("<comment>Patching Drupal for xhprof</comment>"); $patchProcess = new Process('patch -p1 < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir()); $patchProcess->mustRun(); }
/** * {@inheritdoc} * * @see PlatformCommand::getCurrentEnvironment() */ protected function execute(InputInterface $input, OutputInterface $output) { $this->stdOut->writeln("<info>Syncing Platform.sh environment database to local</info>"); /** @var \Symfony\Component\Console\Helper\ProcessHelper $process */ $process = $this->getHelper('process'); // If this is a Platform.sh project, get latest dump. // @todo: add proper provider integration if (Config::get('id')) { $process->mustRun($this->stdOut, ['platform', 'sql-dump']); } $cd = getcwd(); chdir(Platform::webDir()); $process->run($this->stdOut, 'drush sqlc < ' . $input->getArgument('file')); chdir($cd); }
/** * */ public function configure() { $fs = new Filesystem(); if ($this->version == DrupalStackHelper::DRUPAL7) { $fs->copy(CLI_ROOT . '/resources/stacks/drupal/drupal7.settings.php', Platform::webDir() . '/sites/default/settings.php', true); } elseif ($this->version == DrupalStackHelper::DRUPAL8) { $fs->copy(CLI_ROOT . '/resources/stacks/drupal/drupal8.settings.php', Platform::webDir() . '/sites/default/settings.php', true); } if ($this->version == DrupalStackHelper::DRUPAL8) { $fs->mkdir([Platform::sharedDir() . '/config', Platform::sharedDir() . '/config/active', Platform::sharedDir() . '/config/staging']); } $fs->dumpFile(Platform::sharedDir() . '/settings.local.php', $this->string); // Relink if missing. if (!$fs->exists(Platform::webDir() . '/sites/default/settings.local.php')) { $fs->symlink('../../../shared/settings.local.php', Platform::webDir() . '/sites/default/settings.local.php'); } }
/** * {@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 function testWebRoot() { mkdir(Platform::webDir()); $this->assertTrue(is_dir(self::$tmpName . '/www')); }
protected function discoverBehatYml() { $scanDirs = [Platform::sharedDir(), Platform::webDir(), Platform::rootDir() . '/tests']; if (is_dir(Platform::repoDir())) { $scanDirs[] = Platform::repoDir(); } $finder = new Finder(); $finder->files()->in($scanDirs)->name('behat.yml'); return $finder; }
/** * Write a drushrc */ public function drushrc() { $drushrc = <<<EOT <?php \$options['uri'] = "http://{$this->projectName}.{$this->projectTld}"; EOT; $fs = new Filesystem(); $fs->dumpFile(Platform::sharedDir() . '/drushrc.php', $drushrc); $fs->symlink('../../../shared/drushrc.php', Platform::webDir() . '/sites/default/drushrc.php'); }
/** * {@inheritdoc} * * @see PlatformCommand::getCurrentEnvironment() */ protected function execute(InputInterface $input, OutputInterface $output) { $processBuilder = ProcessBuilder::create(['drush', $input->getArgument('cmd'), '--root=' . Platform::webDir(), '--uri=' . Platform::projectName() . '.' . Platform::projectTld()]); passthru($processBuilder->getProcess()->getCommandLine()); }
/** * {@inheritdoc} * * @see PlatformCommand::getCurrentEnvironment() */ protected function execute(InputInterface $input, OutputInterface $output) { $this->stdOut->writeln("<comment>Removing patch on Drupal for xhprof</comment>"); $process = new Process('patch -p1 -R < ' . CLI_ROOT . '/resources/drupal-enable-profiling.patch', Platform::webDir()); $process->mustRun(null); }
protected function discoverBehatYml() { $depth = $this->stdIn->getOption('depth'); $scanDirs = [Platform::sharedDir(), Platform::webDir()]; if (is_dir(Platform::repoDir())) { $scanDirs[] = Platform::repoDir(); } if (is_dir(Platform::testsDir())) { $scanDirs[] = Platform::testsDir(); } $extraDir = $this->stdIn->getOption('folder'); if ($extraDir && is_dir($extraDir)) { $scanDirs[] = $extraDir; } $finder = new Finder(); $finder->files()->in($scanDirs)->depth("< {$depth}")->name('behat.yml'); return $finder; }