コード例 #1
1
 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     // Validate we can run.
     if ($this->platformConfig === null) {
         $output->writeln('<error>Must run command within a Platform.sh project</error>');
         exit(1);
     }
     $this->projectPath = LocalProject::getProjectRoot();
     $this->projectName = Platform::projectName();
     $this->stdOut = $output;
     $this->stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
     $this->stdIn = $input;
     self::$interactive = $input->isInteractive();
 }
コード例 #2
0
 /**
  * Builds the settings.local.php file.
  */
 public function __construct()
 {
     $this->projectName = Platform::projectName();
     $this->containerName = Docker::getContainerName('mariadb');
     $this->string = "<?php\n\n";
     $this->dbFromLocal();
     $this->dbFromDocker();
 }
コード例 #3
0
 public function copyConfigs()
 {
     // Copy configs
     foreach ($this->configsToCopy() as $fileName) {
         $this->fs->copy($this->resourcesDir . '/conf/' . $fileName, $this->projectPath . '/docker/conf/' . $fileName);
     }
     // Quick fix to make nginx PHP_IDE_CONFIG dynamic for now.
     $nginxConfFile = $this->projectPath . '/docker/conf/nginx.conf';
     $nginxConf = file_get_contents($nginxConfFile);
     $nginxConf = str_replace('{{ platform }}', Platform::projectName() . '.platform', $nginxConf);
     file_put_contents($nginxConfFile, $nginxConf);
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->stdOut->writeln("<info>Syncing Platform.sh environment database to local</info>");
     // @todo this isn't as robust as getCurrentEnvironment().
     $git = $this->getHelper('shell');
     $currentBranch = $git->execute(['git', 'symbolic-ref', '--short', 'HEAD'], Platform::repoDir());
     $remoteAlias = '@' . Platform::projectName() . '.' . $currentBranch;
     $localAlias = '@' . Platform::projectName() . '._local';
     // @todo squeeze this into the ShellHelper arguments somehow.
     exec("drush {$remoteAlias} sql-dump --gzip | gzip -cd | drush {$localAlias} sqlc");
     //        $this->stdOut->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     //        $shell = new ShellHelper($this->stdOut);
     //        $shell->execute([
     //            "drush $remoteAlias sql-dump --gzip | gzip -cd | drush $localAlias sqlc"
     //        ], null, true, false);
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  *
  * @see PlatformCommand::getCurrentEnvironment()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = 'http://' . Platform::projectName() . '.platform:' . Docker::getContainerPort('nginx', '80');
     $this->openUrl($url);
 }
コード例 #6
0
 /**
  * @param $type
  *
  * @return string
  */
 public static function getContainerName($type)
 {
     $projectName = str_replace(array('-', '.'), '', Platform::projectName());
     return $projectName . '_' . $type . '_1';
 }