public function configure() { $this->fs->copy(CLI_ROOT . '/resources/stacks/wordpress/wp-config.php', Platform::webDir() . '/wp-config.php', true); $this->fs->remove(Platform::webDir() . '/wp-confg-sample.php'); $this->fs->copy(CLI_ROOT . '/resources/stacks/wordpress/wp-config.local.php', Platform::sharedDir() . '/wp-config.local.php'); $localSettings = file_get_contents(Platform::sharedDir() . '/wp-config.local.php'); $localSettings = str_replace('{{ salts }}', $this->salts(), $localSettings); $localSettings = str_replace('{{ container_name }}', $this->containerName, $localSettings); $localSettings = str_replace('{{ project_domain }}', $this->projectName . '.' . $this->projectTld, $localSettings); file_put_contents(Platform::sharedDir() . '/wp-config.local.php', $localSettings); // Relink if missing. if (!$this->fs->exists(Platform::webDir() . '/wp-config.local.php')) { $this->fs->symlink('../shared/wp-config.local.php', Platform::webDir() . '/wp-config.local.php'); } }
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; }
/** * Write a drushrc */ public function drushrc() { // @todo: Check if drushrc.php exists, load in any $conf changes. switch ($this->version) { case DrupalStackHelper::DRUPAL7: $this->fs->copy(CLI_ROOT . '/resources/stacks/drupal7/drushrc.php', Platform::sharedDir() . '/drushrc.php', true); break; case DrupalStackHelper::DRUPAL8: $this->fs->copy(CLI_ROOT . '/resources/stacks/drupal8/drushrc.php', Platform::sharedDir() . '/drushrc.php', true); break; default: throw new \Exception('Unsupported version of Drupal. Write a pull reuqest!'); } // Replace template variables. $localSettings = file_get_contents(Platform::sharedDir() . '/drushrc.php'); // @todo this expects proxy to be running. $localSettings = str_replace('{{ project_domain }}', $this->projectName . '.' . $this->projectTld, $localSettings); file_put_contents(Platform::sharedDir() . '/drushrc.php', $localSettings); $this->fs->symlink('../../../shared/drushrc.php', Platform::webDir() . '/sites/default/drushrc.php'); }
public function testSharedDir() { mkdir(Platform::sharedDir()); $this->assertTrue(is_dir(self::$tmpName . '/shared')); }